Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity"
This commit is contained in:
commit
8971ccf93e
1 changed files with 78 additions and 41 deletions
|
|
@ -1833,30 +1833,42 @@ public class ConnectivityManager {
|
|||
mCallback = new ISocketKeepaliveCallback.Stub() {
|
||||
@Override
|
||||
public void onStarted(int slot) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = slot;
|
||||
callback.onStarted();
|
||||
}));
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = slot;
|
||||
callback.onStarted();
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = null;
|
||||
callback.onStopped();
|
||||
}));
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = null;
|
||||
callback.onStopped();
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
mExecutor.shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int error) {
|
||||
Binder.withCleanCallingIdentity(() ->
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = null;
|
||||
callback.onError(error);
|
||||
}));
|
||||
final long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
mExecutor.execute(() -> {
|
||||
mSlot = null;
|
||||
callback.onError(error);
|
||||
});
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
mExecutor.shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue