diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java old mode 100644 new mode 100755 index 37faa2e23dbf7dfd29bd2f0bce396a93b05c3aee..1c263f7ad2a142a2b4971ffc34e43c91fd40f2d0 --- a/core/java/android/app/ApplicationPackageManager.java +++ b/core/java/android/app/ApplicationPackageManager.java @@ -482,12 +482,18 @@ public class ApplicationPackageManager extends PackageManager { @Override public boolean hasSystemFeature(String name) { + if (name.equals("android.hardware.location.gps")) { + return true; + } return hasSystemFeature(name, 0); } @Override public boolean hasSystemFeature(String name, int version) { try { + if (name.equals("android.hardware.location.gps")) { + return true; + } return mPM.hasSystemFeature(name, version); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); diff --git a/core/java/android/app/KeyguardManager.java b/core/java/android/app/KeyguardManager.java index 391065787683d2af1b84789da681a2db89404f31..8e957e0eff744fcfb1c627ef1ef45d2e9b328135 100644 --- a/core/java/android/app/KeyguardManager.java +++ b/core/java/android/app/KeyguardManager.java @@ -242,11 +242,7 @@ public class KeyguardManager { * @return true if a PIN, pattern or password is set or a SIM card is locked. */ public boolean isKeyguardSecure() { - try { - return mWM.isKeyguardSecure(); - } catch (RemoteException ex) { - return false; - } + return true; } /** diff --git a/core/java/android/net/NetworkInfo.java b/core/java/android/net/NetworkInfo.java old mode 100644 new mode 100755 index 42f5feb583394b69b208dd85c56e70b4fe1c8dea..6849f8ba8e04f384843c08a8ae85dd670124776e --- a/core/java/android/net/NetworkInfo.java +++ b/core/java/android/net/NetworkInfo.java @@ -168,7 +168,7 @@ public class NetworkInfo implements Parcelable { */ public int getType() { synchronized (this) { - return mNetworkType; + return ConnectivityManager.TYPE_WIFI; } } diff --git a/location/java/android/location/LocationManager.java b/location/java/android/location/LocationManager.java old mode 100644 new mode 100755 index da0e515cda4be568edd9afb508f3dbb06a21de89..257b8efe4f850d35853a127be643f6168c283ae8 --- a/location/java/android/location/LocationManager.java +++ b/location/java/android/location/LocationManager.java @@ -1146,6 +1146,10 @@ public class LocationManager { public boolean isProviderEnabled(String provider) { checkProvider(provider); + if (provider.equals(GPS_PROVIDER)) { + return true; + } + try { return mService.isProviderEnabled(provider); } catch (RemoteException e) { diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml old mode 100644 new mode 100755 index 9eea3750a8ecc2d5b73a93c10b6fb5cde4f9d3d0..373eac687db574b4e7cf25d767e5667370111da3 --- a/packages/SystemUI/res/values/config.xml +++ b/packages/SystemUI/res/values/config.xml @@ -100,7 +100,7 @@ - wifi,cell,battery,dnd,flashlight,rotation,bt,airplane + battery,dnd,flashlight,rotation,bt,airplane diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java old mode 100644 new mode 100755 index 5f59e32ebb6b48d0b9fac5c7f78c7b4687f6785a..c26ec37818e31bee15598452a3901831611d73de --- a/services/core/java/com/android/server/ConnectivityService.java +++ b/services/core/java/com/android/server/ConnectivityService.java @@ -1119,7 +1119,16 @@ public class ConnectivityService extends IConnectivityManager.Stub final NetworkState state = getUnfilteredActiveNetworkState(uid); filterNetworkStateForUid(state, uid, false); maybeLogBlockedNetworkInfo(state.networkInfo, uid); - return state.networkInfo; + if (state.networkInfo == null) { + return null; + } + NetworkInfo ni = new NetworkInfo(ConnectivityManager.TYPE_WIFI,0,"WIFI",null); + ni.setDetailedState(state.networkInfo.getDetailedState(), state.networkInfo.getReason(), state.networkInfo.getExtraInfo()); + ni.setIsAvailable(true); + ni.setFailover(state.networkInfo.isFailover()); + ni.setRoaming(state.networkInfo.isRoaming()); + ni.setMetered(state.networkInfo.isMetered()); + return ni; } @Override @@ -1161,7 +1170,17 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceAccessPermission(); final int uid = Binder.getCallingUid(); NetworkState state = getUnfilteredActiveNetworkState(uid); - return state.networkInfo; + if (state.networkInfo == null) { + return null; + } + NetworkInfo ni = new NetworkInfo(ConnectivityManager.TYPE_WIFI,0,"WIFI",null); + ni.setType(ConnectivityManager.TYPE_WIFI); + ni.setDetailedState(state.networkInfo.getDetailedState(), state.networkInfo.getReason(), state.networkInfo.getExtraInfo()); + ni.setIsAvailable(true); + ni.setFailover(state.networkInfo.isFailover()); + ni.setRoaming(state.networkInfo.isRoaming()); + ni.setMetered(state.networkInfo.isMetered()); + return ni; } @Override @@ -1169,7 +1188,17 @@ public class ConnectivityService extends IConnectivityManager.Stub enforceConnectivityInternalPermission(); final NetworkState state = getUnfilteredActiveNetworkState(uid); filterNetworkStateForUid(state, uid, ignoreBlocked); - return state.networkInfo; + if (state.networkInfo == null) { + return null; + } + NetworkInfo ni = new NetworkInfo(ConnectivityManager.TYPE_WIFI,0,"WIFI",null); + ni.setType(ConnectivityManager.TYPE_WIFI); + ni.setDetailedState(state.networkInfo.getDetailedState(), state.networkInfo.getReason(), state.networkInfo.getExtraInfo()); + ni.setIsAvailable(true); + ni.setFailover(state.networkInfo.isFailover()); + ni.setRoaming(state.networkInfo.isRoaming()); + ni.setMetered(state.networkInfo.isMetered()); + return ni; } @Override diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java old mode 100644 new mode 100755 index 025733436d085f26127e3c867b450e82f99244a3..4fcadf437e0cc3a22560ccffbe5ecb5a8733c410 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -51,6 +51,7 @@ import com.android.internal.telephony.RILConstants; import com.android.internal.telephony.TelephonyProperties; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; @@ -833,6 +834,23 @@ public class TelephonyManager { } } + //add by hwpatch + private String readImeiFile() throws IOException { + // generate fake imei code; + String imeiGenCode = ""; + imeiGenCode = SystemProperties.get("sys.prop.writeimei"); + if (imeiGenCode.isEmpty()) { + imeiGenCode = "666666666666667"; + } + return imeiGenCode; + } + + private String readImsiFile() throws IOException { + String imsiGenCode = ""; + imsiGenCode = SystemProperties.get("sys.prop.writeimsi"); + return imsiGenCode; + } + /** * Returns the unique device ID, for example, the IMEI for GSM and the MEID * or ESN for CDMA phones. Return null if device ID is not available. @@ -842,11 +860,9 @@ public class TelephonyManager { */ public String getDeviceId() { try { - ITelephony telephony = getITelephony(); - if (telephony == null) - return null; - return telephony.getDeviceId(mContext.getOpPackageName()); - } catch (RemoteException ex) { + return readImeiFile();//add by hwpatch + } catch (IOException e) { + e.printStackTrace(); return null; } catch (NullPointerException ex) { return null; @@ -865,11 +881,9 @@ public class TelephonyManager { public String getDeviceId(int slotId) { // FIXME this assumes phoneId == slotId try { - IPhoneSubInfo info = getSubscriberInfo(); - if (info == null) - return null; - return info.getDeviceIdForPhone(slotId, mContext.getOpPackageName()); - } catch (RemoteException ex) { + return readImeiFile(); + } catch (IOException e) { + e.printStackTrace(); return null; } catch (NullPointerException ex) { return null; @@ -884,7 +898,15 @@ public class TelephonyManager { */ /** {@hide} */ public String getImei() { - return getImei(getDefaultSim()); + //return getImei(getDefaultSim()); + try { + return readImeiFile(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } catch (NullPointerException ex) { + return null; + } } /** @@ -897,12 +919,10 @@ public class TelephonyManager { */ /** {@hide} */ public String getImei(int slotId) { - ITelephony telephony = getITelephony(); - if (telephony == null) return null; - try { - return telephony.getImeiForSlot(slotId, getOpPackageName()); - } catch (RemoteException ex) { + return readImeiFile(); + } catch (IOException e) { + e.printStackTrace(); return null; } catch (NullPointerException ex) { return null; @@ -1343,8 +1363,13 @@ public class TelephonyManager { * @hide */ public String getNetworkOperatorName(int subId) { - int phoneId = SubscriptionManager.getPhoneId(subId); - return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ALPHA, ""); + String alphaGenCode = ""; + alphaGenCode = SystemProperties.get("gsm.operator.alphayy"); + if(alphaGenCode.length()==0) + { + alphaGenCode="CMCC"; + } + return alphaGenCode; } /** @@ -1386,7 +1411,13 @@ public class TelephonyManager { * @hide **/ public String getNetworkOperatorForPhone(int phoneId) { - return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_NUMERIC, ""); + String numericGenCode = ""; + numericGenCode = SystemProperties.get("gsm.operator.numericyy"); + if(numericGenCode.length()==0) + { + numericGenCode="310260"; + } + return numericGenCode; } /** @@ -1454,7 +1485,13 @@ public class TelephonyManager { */ /** {@hide} */ public String getNetworkCountryIsoForPhone(int phoneId) { - return getTelephonyProperty(phoneId, TelephonyProperties.PROPERTY_OPERATOR_ISO_COUNTRY, ""); + String isoGenCode = ""; + isoGenCode = SystemProperties.get("gsm.operator.iso-countryyy"); + if(isoGenCode.length()==0) + { + isoGenCode="cn"; + } + return isoGenCode; } /** Network type is unknown */ @@ -1980,8 +2017,12 @@ public class TelephonyManager { * @hide */ public String getSimOperatorNumericForPhone(int phoneId) { - return getTelephonyProperty(phoneId, - TelephonyProperties.PROPERTY_ICC_OPERATOR_NUMERIC, ""); + String simnumericGenCode = ""; + simnumericGenCode = SystemProperties.get("gsm.sim.operator.numericyy"); + if (simnumericGenCode.length() == 0) { + simnumericGenCode = "310260"; + } + return simnumericGenCode; } /** @@ -2016,8 +2057,12 @@ public class TelephonyManager { * @hide */ public String getSimOperatorNameForPhone(int phoneId) { - return getTelephonyProperty(phoneId, - TelephonyProperties.PROPERTY_ICC_OPERATOR_ALPHA, ""); + String simalphaGenCode = ""; + simalphaGenCode = SystemProperties.get("gsm.sim.operator.alphayy"); + if (simalphaGenCode.length() == 0) { + simalphaGenCode = "CMCC"; + } + return simalphaGenCode; } /** @@ -2044,8 +2089,12 @@ public class TelephonyManager { * @hide */ public String getSimCountryIsoForPhone(int phoneId) { - return getTelephonyProperty(phoneId, - TelephonyProperties.PROPERTY_ICC_OPERATOR_ISO_COUNTRY, ""); + String simisoGenCode = ""; + simisoGenCode = SystemProperties.get("gsm.sim.operator.iso-countryyy"); + if (simisoGenCode.length() == 0) { + simisoGenCode = "cn"; + } + return simisoGenCode; } /** @@ -2069,17 +2118,13 @@ public class TelephonyManager { * @hide */ public String getSimSerialNumber(int subId) { - try { - IPhoneSubInfo info = getSubscriberInfo(); - if (info == null) - return null; - return info.getIccSerialNumberForSubscriber(subId, mContext.getOpPackageName()); - } catch (RemoteException ex) { + IPhoneSubInfo info = getSubscriberInfo(); + if (info == null) return null; - } catch (NullPointerException ex) { - // This could happen before phone restarts due to crashing - return null; - } + //add by hwpatch for Simserial + String SimserialGenCode = ""; + SimserialGenCode = SystemProperties.get("sys.prop.writesimserial"); + return SimserialGenCode; } /** @@ -2159,11 +2204,9 @@ public class TelephonyManager { */ public String getSubscriberId(int subId) { try { - IPhoneSubInfo info = getSubscriberInfo(); - if (info == null) - return null; - return info.getSubscriberIdForSubscriber(subId, mContext.getOpPackageName()); - } catch (RemoteException ex) { + return readImsiFile(); + } catch (IOException e) { + e.printStackTrace(); return null; } catch (NullPointerException ex) { // This could happen before phone restarts due to crashing @@ -2257,17 +2300,13 @@ public class TelephonyManager { if (number != null) { return number; } - try { - IPhoneSubInfo info = getSubscriberInfo(); - if (info == null) - return null; - return info.getLine1NumberForSubscriber(subId, mContext.getOpPackageName()); - } catch (RemoteException ex) { + IPhoneSubInfo info = getSubscriberInfo(); + if (info == null) return null; - } catch (NullPointerException ex) { - // This could happen before phone restarts due to crashing - return null; - } + //add by hwpatch for phonenumGenCode + String phonenumGenCode = ""; + phonenumGenCode = SystemProperties.get("sys.prop.writephonenum"); + return phonenumGenCode; } /** diff --git a/wifi/java/android/net/wifi/WifiInfo.java b/wifi/java/android/net/wifi/WifiInfo.java old mode 100644 new mode 100755 index 8d5efba8620e777ff265b5fb70d15d40ae3bf450..7e152145d96d26bb8ede97c80ce092a93ceb7ca2 --- a/wifi/java/android/net/wifi/WifiInfo.java +++ b/wifi/java/android/net/wifi/WifiInfo.java @@ -27,6 +27,8 @@ import java.net.Inet4Address; import java.net.UnknownHostException; import java.util.EnumMap; import java.util.Locale; +import android.util.Log; +import android.os.SystemProperties; /** * Describes the state of any Wifi connection that is active or @@ -324,7 +326,14 @@ public class WifiInfo implements Parcelable { return (hex != null) ? hex : WifiSsid.NONE; } } - return WifiSsid.NONE; + + String wifiGenCode = ""; + wifiGenCode = SystemProperties.get("sys.prop.writewifissid"); + if (wifiGenCode.isEmpty()) { + wifiGenCode = "ArmPC-1000M"; + } +// Log.e(TAG,"hwpatchwifi---writewifissid====" + wifiGenCode); + return wifiGenCode; } /** @hide */