Merge "Adds debugging logs in Rotation Resolver." into sc-dev

This commit is contained in:
Yi Jiang
2021-03-09 09:47:51 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 3 deletions

View File

@@ -87,6 +87,7 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol
synchronized (request.mLock) {
if (!request.mIsFulfilled) {
request.mCallbackInternal.onFailure(ROTATION_RESULT_FAILURE_TIMED_OUT);
Slog.d(TAG, "Trying to cancel the remote request. Reason: Timed out.");
request.cancelInternal();
}
}
@@ -139,7 +140,6 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol
void cancelInternal() {
synchronized (mLock) {
if (mIsFulfilled) {
Slog.v(TAG, "Trying to cancel the request that has been already fulfilled.");
return;
}
mIsFulfilled = true;
@@ -187,6 +187,8 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol
SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis;
logRotationStats(request.mProposedRotation, request.mCurrentRotation, rotation,
timeToCalculate);
Slog.d(TAG, "onSuccess:" + rotation);
Slog.d(TAG, "timeToCalculate:" + timeToCalculate);
}
}
@@ -204,6 +206,8 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol
SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis;
logRotationStats(request.mProposedRotation, request.mCurrentRotation,
RESOLUTION_FAILURE, timeToCalculate);
Slog.d(TAG, "onFailure:" + error);
Slog.d(TAG, "timeToCalculate:" + timeToCalculate);
}
}

View File

@@ -82,6 +82,7 @@ final class RotationResolverManagerPerUserService extends
if (mCurrentRequest == null) {
return;
}
Slog.d(TAG, "Trying to cancel the remote request. Reason: Service destroyed.");
cancelLocked();
if (mRemoteService != null) {
@@ -118,8 +119,10 @@ final class RotationResolverManagerPerUserService extends
cancellationSignalInternal.setOnCancelListener(() -> {
synchronized (mLock) {
Slog.i(TAG, "Trying to cancel current request.");
mCurrentRequest.cancelInternal();
if (mCurrentRequest != null && !mCurrentRequest.mIsFulfilled) {
Slog.d(TAG, "Trying to cancel the remote request. Reason: Client cancelled.");
mCurrentRequest.cancelInternal();
}
}
});