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) { ResultReceiver wrappedListener = new ResultReceiver(null) {
@Override @Override
protected void onReceiveResult(int resultCode, Bundle resultData) { protected void onReceiveResult(int resultCode, Bundle resultData) {
Binder.withCleanCallingIdentity(() -> final long token = Binder.clearCallingIdentity();
executor.execute(() -> { try {
listener.onTetheringEntitlementResult(resultCode); executor.execute(() -> {
})); listener.onTetheringEntitlementResult(resultCode);
});
} finally {
Binder.restoreCallingIdentity(token);
}
} }
}; };