Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 861c8d4a authored by Siddika Parlak Polatkan's avatar Siddika Parlak Polatkan
Browse files

Remove the flag gating logging and fix a bug.

This flag was needed for gating the raw sensor data collection, which is
now moved to somewhere else.

Calling evaluateRotationChangeLocked() before setting
mDesiredRotation = reportedRotation is meaningless since it always
returns -1, so that is also removed.

Test: statsd_testdrive on Redfin

Bug: 186088594

Change-Id: I3389c0df9f0762ad15375edbfb391ba01ac6aa0f
parent cc47505d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -254,7 +254,7 @@ public class DisplayRotation {

        if (isDefaultDisplay) {
            final Handler uiHandler = UiThread.getHandler();
            mOrientationListener = new OrientationListener(mContext, uiHandler, mService);
            mOrientationListener = new OrientationListener(mContext, uiHandler);
            mOrientationListener.setCurrentRotation(mRotation);
            mSettingsObserver = new SettingsObserver(uiHandler);
            mSettingsObserver.observe();
@@ -1514,8 +1514,8 @@ public class DisplayRotation {
        final SparseArray<Runnable> mRunnableCache = new SparseArray<>(5);
        boolean mEnabled;

        OrientationListener(Context context, Handler handler, WindowManagerService service) {
            super(context, handler, service);
        OrientationListener(Context context, Handler handler) {
            super(context, handler);
        }

        private class UpdateRunnable implements Runnable {
+0 −17
Original line number Diff line number Diff line
@@ -49,10 +49,6 @@ final class WindowManagerConstants {
    static final String KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS =
            "system_gesture_exclusion_log_debounce_millis";

    // Enable logging from the sensor which publishes accel and gyro data generating a rotation
    // event
    private static final String KEY_RAW_SENSOR_LOGGING_ENABLED = "raw_sensor_logging_enabled";

    private static final int MIN_GESTURE_EXCLUSION_LIMIT_DP = 200;

    /** @see #KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS */
@@ -62,8 +58,6 @@ final class WindowManagerConstants {
    /** @see AndroidDeviceConfig#KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE */
    boolean mSystemGestureExcludedByPreQStickyImmersive;

    boolean mRawSensorLoggingEnabled;

    private final WindowManagerGlobalLock mGlobalLock;
    private final Runnable mUpdateSystemGestureExclusionCallback;
    private final DeviceConfigInterface mDeviceConfig;
@@ -139,9 +133,6 @@ final class WindowManagerConstants {
                    case KEY_SYSTEM_GESTURE_EXCLUSION_LOG_DEBOUNCE_MILLIS:
                        updateSystemGestureExclusionLogDebounceMillis();
                        break;
                    case KEY_RAW_SENSOR_LOGGING_ENABLED:
                        updateRawSensorDataLoggingEnabled();
                        break;
                    default:
                        break;
                }
@@ -167,12 +158,6 @@ final class WindowManagerConstants {
                KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE, false);
    }

    private void updateRawSensorDataLoggingEnabled() {
        mRawSensorLoggingEnabled = DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_WINDOW_MANAGER,
                KEY_RAW_SENSOR_LOGGING_ENABLED, false);
    }

    void dump(PrintWriter pw) {
        pw.println("WINDOW MANAGER CONSTANTS (dumpsys window constants):");

@@ -182,8 +167,6 @@ final class WindowManagerConstants {
        pw.print("="); pw.println(mSystemGestureExclusionLimitDp);
        pw.print("  "); pw.print(KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE);
        pw.print("="); pw.println(mSystemGestureExcludedByPreQStickyImmersive);
        pw.print("  "); pw.print(KEY_RAW_SENSOR_LOGGING_ENABLED);
        pw.print("="); pw.println(mRawSensorLoggingEnabled);
        pw.println();
    }
}
+1 −2
Original line number Diff line number Diff line
@@ -451,8 +451,7 @@ public class WindowManagerService extends IWindowManager.Stub

    private static final int ANIMATION_COMPLETED_TIMEOUT_MS = 5000;

    @VisibleForTesting
    WindowManagerConstants mConstants;
    final WindowManagerConstants mConstants;

    final WindowTracing mWindowTracing;

+8 −17
Original line number Diff line number Diff line
@@ -85,7 +85,6 @@ public abstract class WindowOrientationListener {

    private int mCurrentRotation = -1;
    private final Context mContext;
    private final WindowManagerConstants mConstants;

    private final Object mLock = new Object();

@@ -94,11 +93,9 @@ public abstract class WindowOrientationListener {
     *
     * @param context for the WindowOrientationListener.
     * @param handler Provides the Looper for receiving sensor updates.
     * @param wmService WindowManagerService to read the device config from.
     */
    public WindowOrientationListener(
            Context context, Handler handler, WindowManagerService wmService) {
        this(context, handler, wmService, SensorManager.SENSOR_DELAY_UI);
    public WindowOrientationListener(Context context, Handler handler) {
        this(context, handler, SensorManager.SENSOR_DELAY_UI);
    }

    /**
@@ -115,10 +112,9 @@ public abstract class WindowOrientationListener {
     * This constructor is private since no one uses it.
     */
    private WindowOrientationListener(
            Context context, Handler handler, WindowManagerService wmService, int rate) {
            Context context, Handler handler, int rate) {
        mContext = context;
        mHandler = handler;
        mConstants = wmService.mConstants;
        mSensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
        mRate = rate;
        List<Sensor> l = mSensorManager.getSensorList(Sensor.TYPE_DEVICE_ORIENTATION);
@@ -1134,16 +1130,11 @@ public abstract class WindowOrientationListener {
                return;
            }

            // Log raw sensor rotation.
            if (evaluateRotationChangeLocked() >= 0) {
                if (mConstants.mRawSensorLoggingEnabled) {
            FrameworkStatsLog.write(
                    FrameworkStatsLog.DEVICE_ROTATED,
                    event.timestamp,
                    rotationToLogEnum(reportedRotation),
                    FrameworkStatsLog.DEVICE_ROTATED__ROTATION_EVENT_TYPE__ACTUAL_EVENT);
                }
            }

            if (isRotationResolverEnabled()) {
                if (mRotationResolverService == null) {
+3 −6
Original line number Diff line number Diff line
@@ -51,8 +51,6 @@ public class WindowOrientationListenerTest {
    private InputSensorInfo mMockInputSensorInfo;
    @Mock
    private SensorManager mMockSensorManager;
    @Mock
    private WindowManagerService mMockWindowManagerService;

    private TestableRotationResolver mFakeRotationResolverInternal;
    private com.android.server.wm.WindowOrientationListener mWindowOrientationListener;
@@ -69,7 +67,7 @@ public class WindowOrientationListenerTest {
        mFakeRotationResolverInternal = new TestableRotationResolver();
        doReturn(mMockSensorManager).when(mMockContext).getSystemService(Context.SENSOR_SERVICE);
        mWindowOrientationListener = new TestableWindowOrientationListener(mMockContext,
                mMockHandler, mMockWindowManagerService);
                mMockHandler);
        mWindowOrientationListener.mRotationResolverService = mFakeRotationResolverInternal;

        mFakeSensor = new Sensor(mMockInputSensorInfo);
@@ -115,9 +113,8 @@ public class WindowOrientationListenerTest {

    final class TestableWindowOrientationListener extends WindowOrientationListener {

        TestableWindowOrientationListener(Context context, Handler handler,
                WindowManagerService service) {
            super(context, handler, service);
        TestableWindowOrientationListener(Context context, Handler handler) {
            super(context, handler);
            this.mOrientationJudge = new OrientationSensorJudge();
        }

Loading