summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java11
-rw-r--r--telephony/java/android/telephony/TelephonyManager.java116
2 files changed, 91 insertions, 36 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 43d9c1102b1a..3f28c6d694fa 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -2713,9 +2713,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);
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 8759a2933f7a..7204a9d5c514 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5682,16 +5682,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(), getFeatureId());
} catch (RemoteException ex) {
@@ -5724,16 +5732,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(), getFeatureId(), workSource);
} catch (RemoteException ex) {
@@ -6598,16 +6615,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);
+ }
}
};
@@ -11432,9 +11457,14 @@ public class TelephonyManager {
if (executor == null || callback == null) {
return;
}
- Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
- callback.accept(SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION);
- }));
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ executor.execute(() -> {
+ callback.accept(SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION);
+ });
+ } finally {
+ Binder.restoreCallingIdentity(identity);
+ }
return;
}
ISetOpportunisticDataCallback callbackStub = new ISetOpportunisticDataCallback.Stub() {
@@ -11443,9 +11473,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);
+ }
}
};
@@ -11519,13 +11554,23 @@ public class TelephonyManager {
return;
}
if (iOpportunisticNetworkService == null) {
- Binder.withCleanCallingIdentity(() -> executor.execute(() -> {
- callback.accept(UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION);
- }));
+ final long identity = Binder.clearCallingIdentity();
+ try {
+ executor.execute(() -> {
+ callback.accept(UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION);
+ });
+ } 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;
}
@@ -11536,9 +11581,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,