Merge "Introduce Radio Shutdown System APIs for Mainline" am: c107c3a958 am: 684df48afc
Change-Id: I74283f4f9414a3b768f2307197b5cc8987394fb2
This commit is contained in:
@@ -8924,6 +8924,7 @@ package android.telephony {
|
||||
method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannelBySlot(int, @Nullable String, int);
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduBasicChannelBySlot(int, int, int, int, int, int, @Nullable String);
|
||||
method @Nullable @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public String iccTransmitApduLogicalChannelBySlot(int, int, int, int, int, int, int, @Nullable String);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isAnyRadioPoweredOn();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isApplicationOnUicc(int);
|
||||
method public boolean isDataConnectivityPossible();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int);
|
||||
@@ -8965,6 +8966,7 @@ package android.telephony {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerStateForSlot(int, int);
|
||||
method @Deprecated public void setVisualVoicemailEnabled(android.telecom.PhoneAccountHandle, boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setVoiceActivationState(int);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void shutdownAllRadios();
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean supplyPin(String);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int[] supplyPinReportResult(String);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean supplyPuk(String, String);
|
||||
|
||||
@@ -41,12 +41,12 @@ import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
import android.os.Vibrator;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.TimingsTraceLog;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.android.internal.telephony.ITelephony;
|
||||
import com.android.server.RescueParty;
|
||||
import com.android.server.LocalServices;
|
||||
import com.android.server.pm.PackageManagerService;
|
||||
@@ -584,19 +584,15 @@ public final class ShutdownThread extends Thread {
|
||||
TimingsTraceLog shutdownTimingsTraceLog = newTimingsLog();
|
||||
boolean radioOff;
|
||||
|
||||
final ITelephony phone =
|
||||
ITelephony.Stub.asInterface(ServiceManager.checkService("phone"));
|
||||
TelephonyManager telephonyManager = mContext.getSystemService(
|
||||
TelephonyManager.class);
|
||||
|
||||
try {
|
||||
radioOff = phone == null || !phone.needMobileRadioShutdown();
|
||||
if (!radioOff) {
|
||||
Log.w(TAG, "Turning off cellular radios...");
|
||||
metricStarted(METRIC_RADIO);
|
||||
phone.shutdownMobileRadios();
|
||||
}
|
||||
} catch (RemoteException ex) {
|
||||
Log.e(TAG, "RemoteException during radio shutdown", ex);
|
||||
radioOff = true;
|
||||
radioOff = telephonyManager == null
|
||||
|| !telephonyManager.isAnyRadioPoweredOn();
|
||||
if (!radioOff) {
|
||||
Log.w(TAG, "Turning off cellular radios...");
|
||||
metricStarted(METRIC_RADIO);
|
||||
telephonyManager.shutdownAllRadios();
|
||||
}
|
||||
|
||||
Log.i(TAG, "Waiting for Radio...");
|
||||
@@ -611,12 +607,7 @@ public final class ShutdownThread extends Thread {
|
||||
}
|
||||
|
||||
if (!radioOff) {
|
||||
try {
|
||||
radioOff = !phone.needMobileRadioShutdown();
|
||||
} catch (RemoteException ex) {
|
||||
Log.e(TAG, "RemoteException during radio shutdown", ex);
|
||||
radioOff = true;
|
||||
}
|
||||
radioOff = !telephonyManager.isAnyRadioPoweredOn();
|
||||
if (radioOff) {
|
||||
Log.i(TAG, "Radio turned off.");
|
||||
metricEnded(METRIC_RADIO);
|
||||
|
||||
@@ -8258,6 +8258,44 @@ public class TelephonyManager {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shut down all the live radios over all the slot index.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||
public void shutdownAllRadios() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
telephony.shutdownMobileRadios();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error calling ITelephony#shutdownMobileRadios", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any radio is on over all the slot indexes.
|
||||
*
|
||||
* @return {@code true} if any radio is on over any slot index.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
public boolean isAnyRadioPoweredOn() {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
if (telephony != null) {
|
||||
return telephony.needMobileRadioShutdown();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "Error calling ITelephony#needMobileRadioShutdown", e);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Radio explicitly powered off (e.g, airplane mode).
|
||||
* @hide
|
||||
|
||||
Reference in New Issue
Block a user