Fine-tune the screen size by adb command to adjust the

screen size for UX

Add system properties for UX adjust:
1) one-handed screen translate offset percentage.
2) one-handed screen translate animation duration milliseconds.

[TODO]: This is temporary solution for UX to refine the threshold,
and it needs to revert after the threshold has been confirmed.

Bug: 153694010

Test:
adb shell setprop persist.debug.one_handed_offset_percentage 40
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 SystemUITests
Change-Id: I9fb73b98d78c766d6e2e839ee10eb73c7190af9d
This commit is contained in:
Jason Chang
2020-08-10 20:44:08 +08:00
parent 5fed70ab92
commit 084ebda9d1
4 changed files with 15 additions and 13 deletions

View File

@@ -565,15 +565,9 @@
<!-- If the config font scale is >= this value, potentially adjust the number of columns-->
<item name="controls_max_columns_adjust_above_font_scale" translatable="false" format="float" type="dimen">1.25</item>
<!-- One handed mode default offset % of display size -->
<fraction name="config_one_handed_offset">50%</fraction>
<!-- Allow one handed to enable round corner -->
<bool name="config_one_handed_enable_round_corner">true</bool>
<!-- Animation duration for translating of one handed when trigger / dismiss. -->
<integer name="config_one_handed_translate_animation_duration">150</integer>
<!-- Show a separate icon for low and high volume on the volume dialog -->
<bool name="config_showLowMediaVolumeIcon">false</bool>
</resources>

View File

@@ -26,6 +26,7 @@ import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemProperties;
import android.util.Log;
import android.view.SurfaceControl;
import android.window.DisplayAreaInfo;
@@ -61,6 +62,8 @@ import javax.inject.Inject;
*/
public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer implements Dumpable {
private static final String TAG = "OneHandedDisplayAreaOrganizer";
private static final String ONE_HANDED_MODE_TRANSLATE_ANIMATION_DURATION =
"persist.debug.one_handed_translate_animation_duration";
@VisibleForTesting
static final int MSG_RESET_IMMEDIATE = 1;
@@ -156,8 +159,8 @@ public class OneHandedDisplayAreaOrganizer extends DisplayAreaOrganizer implemen
mDisplayController = displayController;
mDefaultDisplayBounds.set(getDisplayBounds());
mLastVisualDisplayBounds.set(getDisplayBounds());
mEnterExitAnimationDurationMs = context.getResources().getInteger(
com.android.systemui.R.integer.config_one_handed_translate_animation_duration);
mEnterExitAnimationDurationMs =
SystemProperties.getInt(ONE_HANDED_MODE_TRANSLATE_ANIMATION_DURATION, 300);
mSurfaceControlTransactionFactory = SurfaceControl.Transaction::new;
mTutorialHandler = tutorialHandler;
}

View File

@@ -24,13 +24,13 @@ import android.content.ComponentName;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.SystemProperties;
import android.view.KeyEvent;
import androidx.annotation.NonNull;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dumpable;
import com.android.systemui.R;
import com.android.systemui.model.SysUiState;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
@@ -50,6 +50,8 @@ import javax.inject.Singleton;
@Singleton
public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
private static final String TAG = "OneHandedManager";
private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
"persist.debug.one_handed_offset_percentage";
private boolean mIsOneHandedEnabled;
private boolean mIsSwipeToNotificationEnabled;
@@ -117,8 +119,8 @@ public class OneHandedManagerImpl implements OneHandedManager, Dumpable {
mDisplayController = displayController;
mDisplayController.addDisplayChangingController(mRotationController);
mSysUiFlagContainer = sysUiState;
mOffSetFraction =
context.getResources().getFraction(R.fraction.config_one_handed_offset, 1, 1);
mOffSetFraction = SystemProperties.getInt(ONE_HANDED_MODE_OFFSET_PERCENTAGE, 50) / 100.0f;
mIsOneHandedEnabled = OneHandedSettingsUtil.getSettingsOneHandedModeEnabled(
context.getContentResolver());
mIsSwipeToNotificationEnabled = OneHandedSettingsUtil.getSettingsSwipeToNotificationEnabled(

View File

@@ -22,6 +22,7 @@ import android.graphics.PixelFormat;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Handler;
import android.os.SystemProperties;
import android.provider.Settings;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -50,6 +51,8 @@ import javax.inject.Singleton;
@Singleton
public class OneHandedTutorialHandler implements OneHandedTransitionCallback, Dumpable {
private static final String TAG = "OneHandedTutorialHandler";
private static final String ONE_HANDED_MODE_OFFSET_PERCENTAGE =
"persist.debug.one_handed_offset_percentage";
private static final int MAX_TUTORIAL_SHOW_COUNT = 2;
private final Rect mLastUpdatedBounds = new Rect();
private final WindowManager mWindowManager;
@@ -81,8 +84,8 @@ public class OneHandedTutorialHandler implements OneHandedTransitionCallback, Du
mWindowManager = context.getSystemService(WindowManager.class);
mTargetViewContainer = new FrameLayout(context);
mTargetViewContainer.setClipChildren(false);
mTutorialAreaHeight = Math.round(mDisplaySize.y * context.getResources().getFraction(
R.fraction.config_one_handed_offset, 1, 1));
mTutorialAreaHeight = Math.round(mDisplaySize.y
* (SystemProperties.getInt(ONE_HANDED_MODE_OFFSET_PERCENTAGE, 50) / 100.0f));
mTutorialView = LayoutInflater.from(context).inflate(R.xml.one_handed_tutorial, null);
mTargetViewContainer.addView(mTutorialView);
mCanShowTutorial = (Settings.Secure.getInt(mContentResolver,