Merge "[DO NOT MERGE]Add check for slot index value" into pi-dev
This commit is contained in:
@@ -7581,6 +7581,9 @@ public class TelephonyManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||||
public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
|
public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
|
||||||
|
if (!SubscriptionManager.isValidPhoneId(slotIndex)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
ITelephony service = getITelephony();
|
ITelephony service = getITelephony();
|
||||||
if (service != null) {
|
if (service != null) {
|
||||||
@@ -7608,15 +7611,17 @@ public class TelephonyManager {
|
|||||||
@SystemApi
|
@SystemApi
|
||||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||||
public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
|
public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
|
||||||
try {
|
if (SubscriptionManager.isValidPhoneId(slotIndex)) {
|
||||||
ITelephony service = getITelephony();
|
try {
|
||||||
if (service != null) {
|
ITelephony service = getITelephony();
|
||||||
return service.getAllowedCarriers(slotIndex);
|
if (service != null) {
|
||||||
|
return service.getAllowedCarriers(slotIndex);
|
||||||
|
}
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
|
||||||
}
|
}
|
||||||
} catch (RemoteException e) {
|
|
||||||
Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
|
|
||||||
} catch (NullPointerException e) {
|
|
||||||
Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
|
|
||||||
}
|
}
|
||||||
return new ArrayList<CarrierIdentifier>(0);
|
return new ArrayList<CarrierIdentifier>(0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user