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

Commit 115027ed authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Merge "Skip restoring one handed settings if not supported on device" am: f74e31b6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12996358

Change-Id: Ie243f516fecb1235170db4d47223bb84217f3f0f
parents c59aa1a6 f74e31b6
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -46,6 +46,8 @@ public abstract class OneHandedTestCase {

    @Before
    public void setupSettings() {
        assumeTrue(SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false));

        final Context testContext =
                InstrumentationRegistry.getInstrumentation().getTargetContext();
        final DisplayManager dm = testContext.getSystemService(DisplayManager.class);
@@ -74,13 +76,13 @@ public abstract class OneHandedTestCase {
                Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 1);
    }

    @Before
    public void assumeOneHandedModeSupported() {
        assumeTrue(SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false));
    }

    @After
    public void restoreSettings() {
        if (mContext == null) {
            // Return early if one-handed mode is not supported
            return;
        }

        Settings.Secure.putInt(getContext().getContentResolver(),
                Settings.Secure.ONE_HANDED_MODE_ENABLED, sOrigEnabled ? 1 : 0);
        Settings.Secure.putInt(mContext.getContentResolver(),