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

Commit f09a5ce9 authored by Chris Göllner's avatar Chris Göllner
Browse files

Start logging rotation lock history + include caller information

There have been a few reports on foldables where rotation lock suddenly
changed, without user interaction.
Adding these logs will make it easier to debug the issue.

Bug: 289023967
Bug: 289534937
Bug: 279685215
Test: Manually - Change rotation lock and check logs in dumpsys
Change-Id: I2a877e7b47c863871a2c6ba29ce46e63d28c8008
parent f357f322
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -54,7 +54,8 @@ public class LockScreenRotationPreferenceController extends TogglePreferenceCont
     */
    @Override
    public boolean setChecked(boolean isChecked) {
        RotationPolicy.setRotationLock(mContext, !isChecked);
        RotationPolicy.setRotationLock(mContext, !isChecked,
                /* caller= */ "LockScreenRotationPreferenceController#setChecked");
        return true;
    }

+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ public class AutoRotatePreferenceController extends TogglePreferenceController i
        final boolean isLocked = !isChecked;
        mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATION_LOCK,
                isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked,
                /* caller= */ "AutoRotatePreferenceController#setChecked");
        return true;
    }
}
+2 −1
Original line number Diff line number Diff line
@@ -82,7 +82,8 @@ public class AutoRotateSwitchBarController extends SettingsMainSwitchPreferenceC
        final boolean isLocked = !isChecked;
        mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATE_ROTATE_MASTER_TOGGLE,
                isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked,
                /* caller= */ "AutoRotateSwitchBarController#setChecked");
        return true;
    }

+2 −1
Original line number Diff line number Diff line
@@ -169,7 +169,8 @@ public class SmartAutoRotatePreferenceController extends TogglePreferenceControl
        final boolean isLocked = !isChecked;
        mMetricsFeatureProvider.action(mContext, SettingsEnums.ACTION_ROTATION_LOCK,
                isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked);
        RotationPolicy.setRotationLock(mContext, isLocked,
                /* caller= */ "SmartAutoRotatePreferenceController#setChecked");
        return true;
    }

+3 −2
Original line number Diff line number Diff line
@@ -30,12 +30,13 @@ public class ShadowRotationPolicy {
    private static boolean rotationSupported = true;

    @Implementation
    protected static void setRotationLock(Context context, final boolean enabled) {
    protected static void setRotationLock(Context context, final boolean enabled, String caller) {
        rotationLockEnabled = enabled;
    }

    @Implementation
    protected static void setRotationLockForAccessibility(Context context, final boolean enabled) {
    protected static void setRotationLockForAccessibility(
            Context context, final boolean enabled, String caller) {
        rotationLockEnabled = enabled;
    }