Merge changes Idf152091,I131f7aff
* changes: Make hidden subscription apis as system Do not use hidden withCleanCallingIdentity
This commit is contained in:
@@ -44965,6 +44965,7 @@ package android.telephony {
|
||||
method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.os.ParcelUuid createSubscriptionGroup(@NonNull java.util.List<java.lang.Integer>);
|
||||
method @Deprecated public static android.telephony.SubscriptionManager from(android.content.Context);
|
||||
method public java.util.List<android.telephony.SubscriptionInfo> getAccessibleSubscriptionInfoList();
|
||||
method @Nullable public java.util.List<android.telephony.SubscriptionInfo> getActiveAndHiddenSubscriptionInfoList();
|
||||
method public static int getActiveDataSubscriptionId();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telephony.SubscriptionInfo getActiveSubscriptionInfo(int);
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getActiveSubscriptionInfoCount();
|
||||
|
||||
@@ -8559,6 +8559,7 @@ package android.telephony {
|
||||
public class SubscriptionInfo implements android.os.Parcelable {
|
||||
method @Nullable public java.util.List<android.telephony.UiccAccessRule> getAccessRules();
|
||||
method public int getProfileClass();
|
||||
method public boolean isGroupDisabled();
|
||||
}
|
||||
|
||||
public class SubscriptionManager {
|
||||
@@ -8674,7 +8675,9 @@ package android.telephony {
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled();
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isInEmergencySmsMode();
|
||||
method public boolean isModemEnabledForSlot(int);
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isOffhook();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isOpportunisticNetworkEnabled();
|
||||
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isPotentialEmergencyNumber(@NonNull String);
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRadioOn();
|
||||
method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
|
||||
@@ -8696,6 +8699,7 @@ package android.telephony {
|
||||
method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
|
||||
|
||||
@@ -654,6 +654,7 @@ public class SubscriptionInfo implements Parcelable {
|
||||
* Return whether the subscription's group is disabled.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isGroupDisabled() {
|
||||
return mIsGroupDisabled;
|
||||
}
|
||||
|
||||
@@ -51,12 +51,10 @@ import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.os.HandlerExecutor;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.ParcelUuid;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.telephony.Annotation.NetworkType;
|
||||
import android.telephony.euicc.EuiccManager;
|
||||
import android.telephony.ims.ImsMmTelManager;
|
||||
import android.util.DisplayMetrics;
|
||||
@@ -1292,12 +1290,32 @@ public class SubscriptionManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* This is similar to {@link #getActiveSubscriptionInfoList()}, but if userVisibleOnly
|
||||
* is true, it will filter out the hidden subscriptions.
|
||||
* Get both hidden and visible SubscriptionInfo(s) of the currently active SIM(s).
|
||||
* The records will be sorted by {@link SubscriptionInfo#getSimSlotIndex}
|
||||
* then by {@link SubscriptionInfo#getSubscriptionId}.
|
||||
*
|
||||
* <p>Requires Permission: {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
|
||||
* or that the calling app has carrier privileges (see
|
||||
* {@link TelephonyManager#hasCarrierPrivileges}). In the latter case, only records accessible
|
||||
* to the calling app are returned.
|
||||
*
|
||||
* @return Sorted list of the currently available {@link SubscriptionInfo}
|
||||
* records on the device.
|
||||
* This is similar to {@link #getActiveSubscriptionInfoList} except that it will return
|
||||
* both active and hidden SubscriptionInfos.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public List<SubscriptionInfo> getActiveSubscriptionInfoList(boolean userVisibleOnly) {
|
||||
public @Nullable List<SubscriptionInfo> getActiveAndHiddenSubscriptionInfoList() {
|
||||
return getActiveSubscriptionInfoList(/* userVisibleonly */false);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is similar to {@link #getActiveSubscriptionInfoList()}, but if userVisibleOnly
|
||||
* is true, it will filter out the hidden subscriptions.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public @Nullable List<SubscriptionInfo> getActiveSubscriptionInfoList(boolean userVisibleOnly) {
|
||||
List<SubscriptionInfo> activeList = null;
|
||||
|
||||
try {
|
||||
@@ -2685,9 +2703,14 @@ public class SubscriptionManager {
|
||||
if (executor == null || callback == null) {
|
||||
return;
|
||||
}
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
};
|
||||
iSub.setPreferredDataSubscriptionId(subId, needValidation, callbackStub);
|
||||
|
||||
@@ -5539,16 +5539,24 @@ public class TelephonyManager {
|
||||
new ICellInfoCallback.Stub() {
|
||||
@Override
|
||||
public void onCellInfo(List<CellInfo> cellInfo) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() -> callback.onCellInfo(cellInfo)));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> callback.onCellInfo(cellInfo));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, String exceptionName, String message) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() -> callback.onError(
|
||||
errorCode,
|
||||
createThrowableByClassName(exceptionName, message))));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> callback.onError(
|
||||
errorCode,
|
||||
createThrowableByClassName(exceptionName, message)));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
}, getOpPackageName());
|
||||
} catch (RemoteException ex) {
|
||||
@@ -5581,16 +5589,25 @@ public class TelephonyManager {
|
||||
new ICellInfoCallback.Stub() {
|
||||
@Override
|
||||
public void onCellInfo(List<CellInfo> cellInfo) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() -> callback.onCellInfo(cellInfo)));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> callback.onCellInfo(cellInfo));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errorCode, String exceptionName, String message) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() -> callback.onError(
|
||||
errorCode,
|
||||
createThrowableByClassName(exceptionName, message))));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> callback.onError(
|
||||
errorCode,
|
||||
createThrowableByClassName(exceptionName, message)));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
}, getOpPackageName(), workSource);
|
||||
} catch (RemoteException ex) {
|
||||
@@ -6455,16 +6472,24 @@ public class TelephonyManager {
|
||||
INumberVerificationCallback internalCallback = new INumberVerificationCallback.Stub() {
|
||||
@Override
|
||||
public void onCallReceived(String phoneNumber) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() ->
|
||||
callback.onCallReceived(phoneNumber)));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() ->
|
||||
callback.onCallReceived(phoneNumber));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVerificationFailed(int reason) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
executor.execute(() ->
|
||||
callback.onVerificationFailed(reason)));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() ->
|
||||
callback.onVerificationFailed(reason));
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -10678,6 +10703,7 @@ public class TelephonyManager {
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
|
||||
@SystemApi
|
||||
public boolean setOpportunisticNetworkState(boolean enable) {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
boolean ret = false;
|
||||
@@ -10705,6 +10731,7 @@ public class TelephonyManager {
|
||||
* @hide
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
|
||||
@SystemApi
|
||||
public boolean isOpportunisticNetworkEnabled() {
|
||||
String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
|
||||
boolean isEnabled = false;
|
||||
@@ -11266,9 +11293,14 @@ public class TelephonyManager {
|
||||
if (executor == null || callback == null) {
|
||||
return;
|
||||
}
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> {
|
||||
callback.accept(SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
return;
|
||||
}
|
||||
ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
|
||||
@@ -11277,9 +11309,14 @@ public class TelephonyManager {
|
||||
if (executor == null || callback == null) {
|
||||
return;
|
||||
}
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11351,14 +11388,24 @@ public class TelephonyManager {
|
||||
return;
|
||||
}
|
||||
if (iOpportunisticNetworkService == null) {
|
||||
/* Todo<b/130595455> passing unknown due to lack of good error codes */
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
/* Todo<b/130595455> passing unknown due to lack of good error codes */
|
||||
executor.execute(() -> {
|
||||
callback.accept(UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
} else {
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> {
|
||||
callback.accept(UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -11369,9 +11416,14 @@ public class TelephonyManager {
|
||||
if (executor == null || callback == null) {
|
||||
return;
|
||||
}
|
||||
Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
}));
|
||||
final long identity = Binder.clearCallingIdentity();
|
||||
try {
|
||||
executor.execute(() -> {
|
||||
callback.accept(result);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(identity);
|
||||
}
|
||||
}
|
||||
};
|
||||
iOpportunisticNetworkService.updateAvailableNetworks(availableNetworks, callbackStub,
|
||||
@@ -11417,6 +11469,7 @@ public class TelephonyManager {
|
||||
* @param slotIndex which slot it's checking.
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi
|
||||
public boolean isModemEnabledForSlot(int slotIndex) {
|
||||
try {
|
||||
ITelephony telephony = getITelephony();
|
||||
|
||||
Reference in New Issue
Block a user