Loading services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java +9 −6 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import static android.content.Context.BIND_INCLUDE_CAPABILITIES; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT; import static com.android.server.rotationresolver.RotationResolverManagerService.RESOLUTION_FAILURE; import static com.android.server.rotationresolver.RotationResolverManagerService.logRotationStats; import static com.android.server.rotationresolver.RotationResolverManagerService.errorCodeToProto; import static com.android.server.rotationresolver.RotationResolverManagerService.surfaceRotationToProto; import android.annotation.NonNull; import android.content.ComponentName; Loading Loading @@ -173,8 +173,10 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol request.mCallbackInternal.onSuccess(rotation); final long timeToCalculate = SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis; logRotationStats(request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), rotation, timeToCalculate); RotationResolverManagerService.logRotationStatsWithTimeToCalculate( request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), surfaceRotationToProto(rotation), timeToCalculate); Slog.d(TAG, "onSuccess:" + rotation); Slog.d(TAG, "timeToCalculate:" + timeToCalculate); } Loading @@ -192,8 +194,9 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol request.mCallbackInternal.onFailure(error); final long timeToCalculate = SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis; logRotationStats(request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), RESOLUTION_FAILURE, RotationResolverManagerService.logRotationStatsWithTimeToCalculate( request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), errorCodeToProto(error), timeToCalculate); Slog.d(TAG, "onFailure:" + error); Slog.d(TAG, "timeToCalculate:" + timeToCalculate); Loading services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java +25 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.rotationresolver; import static android.provider.DeviceConfig.NAMESPACE_ROTATION_RESOLVER; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_NOT_SUPPORTED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_PREEMPTED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT; import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0; import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_180; Loading @@ -37,6 +40,7 @@ import android.os.UserHandle; import android.provider.DeviceConfig; import android.rotationresolver.RotationResolverInternal; import android.service.rotationresolver.RotationResolutionRequest; import android.service.rotationresolver.RotationResolverService; import android.text.TextUtils; import android.util.IndentingPrintWriter; import android.util.Slog; Loading Loading @@ -217,24 +221,37 @@ public class RotationResolverManagerService extends } } static void logRotationStats(int proposedRotation, int currentRotation, int resolvedRotation, long timeToCalculate) { static void logRotationStatsWithTimeToCalculate(int proposedRotation, int currentRotation, int result, long timeToCalculate) { FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED, /* previous_orientation= */ surfaceRotationToProto(currentRotation), /* proposed_orientation= */ surfaceRotationToProto(proposedRotation), /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation), result, /* process_duration_millis= */ timeToCalculate); } static void logRotationStats(int proposedRotation, int currentRotation, int resolvedRotation) { int result) { FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED, /* previous_orientation= */ surfaceRotationToProto(currentRotation), /* proposed_orientation= */ surfaceRotationToProto(proposedRotation), /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation)); result); } private static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) { static int errorCodeToProto(@RotationResolverService.FailureCodes int error) { switch (error) { case ROTATION_RESULT_FAILURE_NOT_SUPPORTED: return RESOLUTION_UNAVAILABLE; case ROTATION_RESULT_FAILURE_TIMED_OUT: case ROTATION_RESULT_FAILURE_PREEMPTED: case ROTATION_RESULT_FAILURE_CANCELLED: return ORIENTATION_UNKNOWN; default: return RESOLUTION_FAILURE; } } static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) { switch (rotationPoseResult) { case Surface.ROTATION_0: return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0; Loading @@ -245,7 +262,8 @@ public class RotationResolverManagerService extends case Surface.ROTATION_270: return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_270; default: return ORIENTATION_UNKNOWN; // Should not reach here. return RESOLUTION_FAILURE; } } } Loading
services/core/java/com/android/server/rotationresolver/RemoteRotationResolverService.java +9 −6 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import static android.content.Context.BIND_INCLUDE_CAPABILITIES; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT; import static com.android.server.rotationresolver.RotationResolverManagerService.RESOLUTION_FAILURE; import static com.android.server.rotationresolver.RotationResolverManagerService.logRotationStats; import static com.android.server.rotationresolver.RotationResolverManagerService.errorCodeToProto; import static com.android.server.rotationresolver.RotationResolverManagerService.surfaceRotationToProto; import android.annotation.NonNull; import android.content.ComponentName; Loading Loading @@ -173,8 +173,10 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol request.mCallbackInternal.onSuccess(rotation); final long timeToCalculate = SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis; logRotationStats(request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), rotation, timeToCalculate); RotationResolverManagerService.logRotationStatsWithTimeToCalculate( request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), surfaceRotationToProto(rotation), timeToCalculate); Slog.d(TAG, "onSuccess:" + rotation); Slog.d(TAG, "timeToCalculate:" + timeToCalculate); } Loading @@ -192,8 +194,9 @@ class RemoteRotationResolverService extends ServiceConnector.Impl<IRotationResol request.mCallbackInternal.onFailure(error); final long timeToCalculate = SystemClock.elapsedRealtime() - request.mRequestStartTimeMillis; logRotationStats(request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), RESOLUTION_FAILURE, RotationResolverManagerService.logRotationStatsWithTimeToCalculate( request.mRemoteRequest.getProposedRotation(), request.mRemoteRequest.getCurrentRotation(), errorCodeToProto(error), timeToCalculate); Slog.d(TAG, "onFailure:" + error); Slog.d(TAG, "timeToCalculate:" + timeToCalculate); Loading
services/core/java/com/android/server/rotationresolver/RotationResolverManagerService.java +25 −7 Original line number Diff line number Diff line Loading @@ -18,6 +18,9 @@ package com.android.server.rotationresolver; import static android.provider.DeviceConfig.NAMESPACE_ROTATION_RESOLVER; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_CANCELLED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_NOT_SUPPORTED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_PREEMPTED; import static android.service.rotationresolver.RotationResolverService.ROTATION_RESULT_FAILURE_TIMED_OUT; import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0; import static com.android.internal.util.FrameworkStatsLog.AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_180; Loading @@ -37,6 +40,7 @@ import android.os.UserHandle; import android.provider.DeviceConfig; import android.rotationresolver.RotationResolverInternal; import android.service.rotationresolver.RotationResolutionRequest; import android.service.rotationresolver.RotationResolverService; import android.text.TextUtils; import android.util.IndentingPrintWriter; import android.util.Slog; Loading Loading @@ -217,24 +221,37 @@ public class RotationResolverManagerService extends } } static void logRotationStats(int proposedRotation, int currentRotation, int resolvedRotation, long timeToCalculate) { static void logRotationStatsWithTimeToCalculate(int proposedRotation, int currentRotation, int result, long timeToCalculate) { FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED, /* previous_orientation= */ surfaceRotationToProto(currentRotation), /* proposed_orientation= */ surfaceRotationToProto(proposedRotation), /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation), result, /* process_duration_millis= */ timeToCalculate); } static void logRotationStats(int proposedRotation, int currentRotation, int resolvedRotation) { int result) { FrameworkStatsLog.write(FrameworkStatsLog.AUTO_ROTATE_REPORTED, /* previous_orientation= */ surfaceRotationToProto(currentRotation), /* proposed_orientation= */ surfaceRotationToProto(proposedRotation), /* resolved_orientation= */ surfaceRotationToProto(resolvedRotation)); result); } private static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) { static int errorCodeToProto(@RotationResolverService.FailureCodes int error) { switch (error) { case ROTATION_RESULT_FAILURE_NOT_SUPPORTED: return RESOLUTION_UNAVAILABLE; case ROTATION_RESULT_FAILURE_TIMED_OUT: case ROTATION_RESULT_FAILURE_PREEMPTED: case ROTATION_RESULT_FAILURE_CANCELLED: return ORIENTATION_UNKNOWN; default: return RESOLUTION_FAILURE; } } static int surfaceRotationToProto(@Surface.Rotation int rotationPoseResult) { switch (rotationPoseResult) { case Surface.ROTATION_0: return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_0; Loading @@ -245,7 +262,8 @@ public class RotationResolverManagerService extends case Surface.ROTATION_270: return AUTO_ROTATE_REPORTED__PROPOSED_ORIENTATION__ROTATION_270; default: return ORIENTATION_UNKNOWN; // Should not reach here. return RESOLUTION_FAILURE; } } }