Do not use hidden withCleanCallingIdentity
Do not use hidden withCleanCallingIdentity API Bug: 140908357 Test: make Merged-In: I131f7affd811eb7a848ea230b332b53654e6fd43 Change-Id: I131f7affd811eb7a848ea230b332b53654e6fd43
This commit is contained in:
@@ -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;
|
||||
@@ -2684,9 +2682,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);
|
||||
|
||||
@@ -5549,16 +5549,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) {
|
||||
@@ -5591,16 +5599,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) {
|
||||
@@ -6465,16 +6482,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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11276,9 +11301,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() {
|
||||
@@ -11287,9 +11317,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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -11361,14 +11396,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;
|
||||
}
|
||||
@@ -11379,9 +11424,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,
|
||||
|
||||
Reference in New Issue
Block a user