Merge "Replace withCleanCallingIdentity with [clear|restore]CallingIdentity"
This commit is contained in:
@@ -623,32 +623,41 @@ public class ConnectivityDiagnosticsManager {
|
|||||||
/** @hide */
|
/** @hide */
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void onConnectivityReportAvailable(@NonNull ConnectivityReport report) {
|
public void onConnectivityReportAvailable(@NonNull ConnectivityReport report) {
|
||||||
Binder.withCleanCallingIdentity(() -> {
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mCb.onConnectivityReportAvailable(report);
|
mCb.onConnectivityReportAvailable(report);
|
||||||
});
|
});
|
||||||
});
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void onDataStallSuspected(@NonNull DataStallReport report) {
|
public void onDataStallSuspected(@NonNull DataStallReport report) {
|
||||||
Binder.withCleanCallingIdentity(() -> {
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mCb.onDataStallSuspected(report);
|
mCb.onDataStallSuspected(report);
|
||||||
});
|
});
|
||||||
});
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public void onNetworkConnectivityReported(
|
public void onNetworkConnectivityReported(
|
||||||
@NonNull Network network, boolean hasConnectivity) {
|
@NonNull Network network, boolean hasConnectivity) {
|
||||||
Binder.withCleanCallingIdentity(() -> {
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mCb.onNetworkConnectivityReported(network, hasConnectivity);
|
mCb.onNetworkConnectivityReported(network, hasConnectivity);
|
||||||
});
|
});
|
||||||
});
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1833,30 +1833,42 @@ public class ConnectivityManager {
|
|||||||
mCallback = new ISocketKeepaliveCallback.Stub() {
|
mCallback = new ISocketKeepaliveCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onStarted(int slot) {
|
public void onStarted(int slot) {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mSlot = slot;
|
mSlot = slot;
|
||||||
callback.onStarted();
|
callback.onStarted();
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopped() {
|
public void onStopped() {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mSlot = null;
|
mSlot = null;
|
||||||
callback.onStopped();
|
callback.onStopped();
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
mExecutor.shutdown();
|
mExecutor.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(int error) {
|
public void onError(int error) {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mSlot = null;
|
mSlot = null;
|
||||||
callback.onError(error);
|
callback.onError(error);
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
mExecutor.shutdown();
|
mExecutor.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,38 +187,54 @@ public abstract class SocketKeepalive implements AutoCloseable {
|
|||||||
mCallback = new ISocketKeepaliveCallback.Stub() {
|
mCallback = new ISocketKeepaliveCallback.Stub() {
|
||||||
@Override
|
@Override
|
||||||
public void onStarted(int slot) {
|
public void onStarted(int slot) {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
mExecutor.execute(() -> {
|
mExecutor.execute(() -> {
|
||||||
mSlot = slot;
|
mSlot = slot;
|
||||||
callback.onStarted();
|
callback.onStarted();
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStopped() {
|
public void onStopped() {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
mSlot = null;
|
mSlot = null;
|
||||||
callback.onStopped();
|
callback.onStopped();
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(int error) {
|
public void onError(int error) {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
mSlot = null;
|
mSlot = null;
|
||||||
callback.onError(error);
|
callback.onError(error);
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataReceived() {
|
public void onDataReceived() {
|
||||||
Binder.withCleanCallingIdentity(() ->
|
final long token = Binder.clearCallingIdentity();
|
||||||
|
try {
|
||||||
executor.execute(() -> {
|
executor.execute(() -> {
|
||||||
mSlot = null;
|
mSlot = null;
|
||||||
callback.onDataReceived();
|
callback.onDataReceived();
|
||||||
}));
|
});
|
||||||
|
} finally {
|
||||||
|
Binder.restoreCallingIdentity(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user