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: Iccd492741a0a5b1c2531fc5fc1378933b65ae038
This commit is contained in:
parent
67f888738b
commit
be80138c19
1 changed files with 78 additions and 41 deletions
|
|
@ -623,32 +623,41 @@ public class ConnectivityDiagnosticsManager {
|
|||
/** @hide */
|
||||
@VisibleForTesting
|
||||
public void onConnectivityReportAvailable(@NonNull ConnectivityReport report) {
|
||||
Binder.withCleanCallingIdentity(() -> {
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mCb.onConnectivityReportAvailable(report);
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@VisibleForTesting
|
||||
public void onDataStallSuspected(@NonNull DataStallReport report) {
|
||||
Binder.withCleanCallingIdentity(() -> {
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mCb.onDataStallSuspected(report);
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
@VisibleForTesting
|
||||
public void onNetworkConnectivityReported(
|
||||
@NonNull Network network, boolean hasConnectivity) {
|
||||
Binder.withCleanCallingIdentity(() -> {
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mCb.onNetworkConnectivityReported(network, hasConnectivity);
|
||||
});
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue