Replace withCleanCallingIdentity with [clear|restore]CallingIdentity

To prevent using @hide method - withCleanCallingIdentity() from
mainline module, use clearCallingIdentity() &
restoreCallingIdentity() instead.

Bug: 172183305
Test: FrameworksNetTests, CtsNetTestCasesLatestSdk
Change-Id: I8221bb8717ba6809c5087ea2808cd4ccef948cfd
This commit is contained in:
lucaslin
2021-03-04 09:38:21 +08:00
parent 48172e9b5d
commit eaff72d544

View File

@@ -2886,10 +2886,14 @@ public class ConnectivityManager {
ResultReceiver wrappedListener = new ResultReceiver(null) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
Binder.withCleanCallingIdentity(() ->
executor.execute(() -> {
listener.onTetheringEntitlementResult(resultCode);
}));
final long token = Binder.clearCallingIdentity();
try {
executor.execute(() -> {
listener.onTetheringEntitlementResult(resultCode);
});
} finally {
Binder.restoreCallingIdentity(token);
}
}
};