From: Chen Xu Date: Tue, 3 Apr 2018 01:14:24 +0000 (+0000) Subject: Merge "A test api to override carrier information" into pi-dev X-Git-Tag: android-x86-9.0-r1~153^2~6 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=b71c76036c5ab8e9127e40b0aeec5224357f5e31;p=android-x86%2Fframeworks-base.git Merge "A test api to override carrier information" into pi-dev --- b71c76036c5ab8e9127e40b0aeec5224357f5e31 diff --cc telephony/java/android/telephony/TelephonyManager.java index 15e06321206a,aa66feddede3..e15d35b5f744 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@@ -7803,9 -7844,51 +7811,54 @@@ public class TelephonyManager } } catch (RemoteException ex) { // This could happen if binder process crashes. + if (!isSystemProcess()) { + ex.rethrowAsRuntimeException(); + } } } + + /** + * A test API to override carrier information including mccmnc, imsi, iccid, gid1, gid2, + * plmn and spn. This would be handy for, eg, forcing a particular carrier id, carrier's config + * (also any country or carrier overlays) to be loaded when using a test SIM with a call box. + * + *

Requires Permission: + * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} + * + * @hide + */ + @TestApi + public void setCarrierTestOverride(String mccmnc, String imsi, String iccid, String gid1, + String gid2, String plmn, String spn) { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + telephony.setCarrierTestOverride( + getSubId(), mccmnc, imsi, iccid, gid1, gid2, plmn, spn); + } + } catch (RemoteException ex) { + // This could happen if binder process crashes. + } + } + + /** + * A test API to return installed carrier id list version + * + *

Requires Permission: + * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE} + * + * @hide + */ + @TestApi + public int getCarrierIdListVersion() { + try { + ITelephony telephony = getITelephony(); + if (telephony != null) { + return telephony.getCarrierIdListVersion(getSubId()); + } + } catch (RemoteException ex) { + // This could happen if binder process crashes. + } + return UNKNOWN_CARRIER_ID_LIST_VERSION; + } }