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

Commit fc4f7c94 authored by Jason Chang's avatar Jason Chang
Browse files

Fix change One-handed mode screen size from 50% to 40% but also keep

adb command mechanism for UX tuning

Provide both config.xml and adb command mechanism.

Bug: 169724216

Test:
adb shell setprop persist.debug.one_handed_offset_percentage 60
adb shell pidof com.android.systemui |xargs -i adb shell kill -9 {}
or adb reboot

adb shell setprop
persist.debug.one_handed_translate_animation_duration 150
adb shell pidof com.android.systemui |xargs -i adb shell kill -9 {}
or adb reboot

Test: manual
Test: atest WMShellUnitTests
Change-Id: I9502cbe8e496f484fdeb8041b5618c47aba0f1d1
parent 4f8866ea
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,12 @@
    <!-- Animation duration when using long press on recents to dock -->
    <integer name="long_press_dock_anim_duration">250</integer>

    <!-- Animation duration for translating of one handed when trigger / dismiss. -->
    <integer name="config_one_handed_translate_animation_duration">300</integer>

    <!-- One handed mode default offset % of display size -->
    <fraction name="config_one_handed_offset">40%</fraction>

    <!-- Allow one handed to enable round corner -->
    <bool name="config_one_handed_enable_round_corner">true</bool>

+6 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.wm.shell.R;
import com.android.wm.shell.common.DisplayChangeController;
import com.android.wm.shell.common.DisplayController;
import com.android.wm.shell.common.TaskStackListenerCallback;
@@ -205,8 +206,11 @@ public class OneHandedController implements OneHanded {
        mGestureHandler = gestureHandler;
        mOverlayManager = overlayManager;

        mOffSetFraction = SystemProperties.getInt(ONE_HANDED_MODE_OFFSET_PERCENTAGE, 50)
                / 100.0f;
        final float offsetPercentageConfig = context.getResources().getFraction(
                R.fraction.config_one_handed_offset, 1, 1);
        final int sysPropPercentageConfig = SystemProperties.getInt(
                ONE_HANDED_MODE_OFFSET_PERCENTAGE, Math.round(offsetPercentageConfig * 100.0f));
        mOffSetFraction = sysPropPercentageConfig / 100.0f;
        mIsOneHandedEnabled = OneHandedSettingsUtil.getSettingsOneHandedModeEnabled(
                context.getContentResolver());
        mIsSwipeToNotificationEnabled =
+5 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;

import com.android.internal.os.SomeArgs;
import com.android.wm.shell.R;
import com.android.wm.shell.common.DisplayController;

import java.io.PrintWriter;
@@ -156,8 +157,11 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer {
        mDisplayController = displayController;
        mDefaultDisplayBounds.set(getDisplayBounds());
        mLastVisualDisplayBounds.set(getDisplayBounds());
        final int animationDurationConfig = context.getResources().getInteger(
                R.integer.config_one_handed_translate_animation_duration);
        mEnterExitAnimationDurationMs =
                SystemProperties.getInt(ONE_HANDED_MODE_TRANSLATE_ANIMATION_DURATION, 300);
                SystemProperties.getInt(ONE_HANDED_MODE_TRANSLATE_ANIMATION_DURATION,
                        animationDurationConfig);
        mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
        mTutorialHandler = tutorialHandler;
    }
+5 −2
Original line number Diff line number Diff line
@@ -86,8 +86,11 @@ public class OneHandedTutorialHandler implements OneHandedTransitionCallback {
                context.getSystemService(Context.ACCESSIBILITY_SERVICE);
        mTargetViewContainer = new FrameLayout(context);
        mTargetViewContainer.setClipChildren(false);
        mTutorialAreaHeight = Math.round(mDisplaySize.y
                * (SystemProperties.getInt(ONE_HANDED_MODE_OFFSET_PERCENTAGE, 50) / 100.0f));
        final float offsetPercentageConfig = context.getResources().getFraction(
                R.fraction.config_one_handed_offset, 1, 1);
        final int sysPropPercentageConfig = SystemProperties.getInt(
                ONE_HANDED_MODE_OFFSET_PERCENTAGE, Math.round(offsetPercentageConfig * 100.0f));
        mTutorialAreaHeight = Math.round(mDisplaySize.y * (sysPropPercentageConfig / 100.0f));
        mTutorialView = LayoutInflater.from(context).inflate(R.layout.one_handed_tutorial, null);
        mTargetViewContainer.addView(mTutorialView);
        mCanShowTutorial = (Settings.Secure.getInt(mContentResolver,