Merge "Added telephony manager set sim power state API"

am: cbffe38631

Change-Id: I9fbe161505905c3d3c1c431d1589248324fb3e4f
This commit is contained in:
Jack Yu
2017-02-22 02:50:29 +00:00
committed by android-build-merger
2 changed files with 46 additions and 0 deletions

View File

@@ -5333,6 +5333,44 @@ public class TelephonyManager {
TelephonyProperties.PROPERTY_SIM_STATE, state); TelephonyProperties.PROPERTY_SIM_STATE, state);
} }
/**
* Set SIM card power state. Request is equivalent to inserting or removing the card.
*
* @param powerUp True if powering up the SIM, otherwise powering down
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @hide
**/
public void setSimPowerState(boolean powerUp) {
setSimPowerStateForSlot(getDefaultSim(), powerUp);
}
/**
* Set SIM card power state. Request is equivalent to inserting or removing the card.
*
* @param slotId SIM slot id
* @param powerUp True if powering up the SIM, otherwise powering down
*
* <p>Requires Permission:
* {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
*
* @hide
**/
public void setSimPowerStateForSlot(int slotId, boolean powerUp) {
try {
ITelephony telephony = getITelephony();
if (telephony != null) {
telephony.setSimPowerStateForSlot(slotId, powerUp);
}
} catch (RemoteException e) {
Log.e(TAG, "Error calling ITelephony#setSimPowerStateForSlot", e);
} catch (SecurityException e) {
Log.e(TAG, "Permission error calling ITelephony#setSimPowerStateForSlot", e);
}
}
/** /**
* Set baseband version for the default phone. * Set baseband version for the default phone.
* *

View File

@@ -1227,4 +1227,12 @@ interface ITelephony {
* @hide * @hide
*/ */
List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid); List<ClientRequestStats> getClientRequestStats(String callingPackage, int subid);
/**
* Set SIM card power state. Request is equivalent to inserting or removing the card.
* @param slotId SIM slot id
* @param powerUp True if powering up the SIM, otherwise powering down
* @hide
* */
void setSimPowerStateForSlot(int slotId, boolean powerUp);
} }