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

Commit 7cd65a14 authored by Shivangi Dubey's avatar Shivangi Dubey Committed by Android (Google) Code Review
Browse files

Merge "Adapt to APIs changes in DeviceStateAutoRotateSettingManagerImpl" into main

parents 756108fe b7313a08
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -113,7 +113,11 @@ public class DeviceStateAutoRotateSettingController extends TogglePreferenceCont

    @Override
    public boolean isChecked() {
        return !mAutoRotateSettingsManager.isRotationLocked(mDeviceState);
        // It is highly unlikely to receive null value here. In the improbable event of null, a
        // non-null update will follow shortly, and the users will potentially see incorrect
        // state for a short time.
        final Boolean isRotationLocked = mAutoRotateSettingsManager.isRotationLocked(mDeviceState);
        return isRotationLocked != null && !isRotationLocked;
    }

    @Override
+7 −3
Original line number Diff line number Diff line
@@ -85,8 +85,7 @@ public class SmartAutoRotateController extends TogglePreferenceController implem
        mPrivacyManager = SensorPrivacyManager.getInstance(context);
        mPowerManager = context.getSystemService(PowerManager.class);
        mDeviceStateAutoRotateSettingsManager =
                DeviceStateAutoRotateSettingManagerProvider.getSingletonInstance(
                        context);
                DeviceStateAutoRotateSettingManagerProvider.getSingletonInstance(context);
    }

    @Override
@@ -100,7 +99,12 @@ public class SmartAutoRotateController extends TogglePreferenceController implem

    protected boolean isRotationLocked() {
        if (DeviceStateAutoRotationHelper.isDeviceStateRotationEnabled(mContext)) {
            return mDeviceStateAutoRotateSettingsManager.isRotationLockedForAllStates();
            // It is highly unlikely to receive null value here. In the improbable event of null, a
            // non-null update will follow shortly, and the users will potentially see incorrect
            // state for a short time.
            final Boolean isRotationLockedForAllStates =
                    mDeviceStateAutoRotateSettingsManager.isRotationLockedForAllStates();
            return isRotationLockedForAllStates == null || isRotationLockedForAllStates;
        }
        return RotationPolicy.isRotationLocked(mContext);
    }