Merge "Add Flags to be able to run experiments for the Back Gesture Problem." into rvc-dev am: 6ff27423b8 am: d1d00283ac
Change-Id: Id4d357c090c6b96035d5763ed0039b44a0be1c4c
This commit is contained in:
committed by
Automerger Merge Worker
commit
561e1ed80c
@@ -210,7 +210,7 @@ public final class SystemUiDeviceConfigFlags {
|
||||
* Allow touch passthrough above assist area during a session.
|
||||
*/
|
||||
public static final String ASSIST_TAP_PASSTHROUGH = "assist_tap_passthrough";
|
||||
|
||||
|
||||
/**
|
||||
* (bool) Whether to show handles when taught.
|
||||
*/
|
||||
@@ -393,6 +393,21 @@ public final class SystemUiDeviceConfigFlags {
|
||||
*/
|
||||
public static final String PIP_USER_RESIZE = "pip_user_resize";
|
||||
|
||||
/**
|
||||
* (float) Bottom height in DP for Back Gesture.
|
||||
*/
|
||||
public static final String BACK_GESTURE_BOTTOM_HEIGHT = "back_gesture_bottom_height";
|
||||
|
||||
/**
|
||||
* (float) Edge width in DP where touch down is allowed for Back Gesture.
|
||||
*/
|
||||
public static final String BACK_GESTURE_EDGE_WIDTH = "back_gesture_edge_width";
|
||||
|
||||
/**
|
||||
* (float) Slop multiplier for Back Gesture.
|
||||
*/
|
||||
public static final String BACK_GESTURE_SLOP_MULTIPLIER = "back_gesture_slop_multiplier";
|
||||
|
||||
private SystemUiDeviceConfigFlags() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,17 @@
|
||||
|
||||
package com.android.internal.policy;
|
||||
|
||||
import static com.android.internal.config.sysui.SystemUiDeviceConfigFlags.BACK_GESTURE_EDGE_WIDTH;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.os.Handler;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.provider.Settings;
|
||||
import android.util.TypedValue;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -30,14 +34,27 @@ import android.provider.Settings;
|
||||
public class GestureNavigationSettingsObserver extends ContentObserver {
|
||||
private Context mContext;
|
||||
private Runnable mOnChangeRunnable;
|
||||
private Handler mMainHandler;
|
||||
|
||||
public GestureNavigationSettingsObserver(Handler handler, Context context,
|
||||
Runnable onChangeRunnable) {
|
||||
super(handler);
|
||||
mMainHandler = handler;
|
||||
mContext = context;
|
||||
mOnChangeRunnable = onChangeRunnable;
|
||||
}
|
||||
|
||||
private final DeviceConfig.OnPropertiesChangedListener mOnPropertiesChangedListener =
|
||||
new DeviceConfig.OnPropertiesChangedListener() {
|
||||
@Override
|
||||
public void onPropertiesChanged(DeviceConfig.Properties properties) {
|
||||
if (DeviceConfig.NAMESPACE_SYSTEMUI.equals(properties.getNamespace())
|
||||
&& mOnChangeRunnable != null) {
|
||||
mOnChangeRunnable.run();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public void register() {
|
||||
ContentResolver r = mContext.getContentResolver();
|
||||
r.registerContentObserver(
|
||||
@@ -49,10 +66,15 @@ public class GestureNavigationSettingsObserver extends ContentObserver {
|
||||
r.registerContentObserver(
|
||||
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE),
|
||||
false, this, UserHandle.USER_ALL);
|
||||
DeviceConfig.addOnPropertiesChangedListener(
|
||||
DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
runnable -> mMainHandler.post(runnable),
|
||||
mOnPropertiesChangedListener);
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
mContext.getContentResolver().unregisterContentObserver(this);
|
||||
DeviceConfig.removeOnPropertiesChangedListener(mOnPropertiesChangedListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,8 +99,12 @@ public class GestureNavigationSettingsObserver extends ContentObserver {
|
||||
}
|
||||
|
||||
private int getSensitivity(Resources userRes, String side) {
|
||||
final int inset = userRes.getDimensionPixelSize(
|
||||
final float defaultInset = userRes.getDimension(
|
||||
com.android.internal.R.dimen.config_backGestureInset);
|
||||
final float backGestureInset = DeviceConfig.getFloat(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
BACK_GESTURE_EDGE_WIDTH, defaultInset);
|
||||
final float inset = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, backGestureInset,
|
||||
userRes.getDisplayMetrics());
|
||||
final float scale = Settings.Secure.getFloatForUser(
|
||||
mContext.getContentResolver(), side, 1.0f, UserHandle.USER_CURRENT);
|
||||
return (int) (inset * scale);
|
||||
|
||||
@@ -34,8 +34,10 @@ import android.os.RemoteException;
|
||||
import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.DeviceConfig;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ISystemGestureExclusionListener;
|
||||
import android.view.InputChannel;
|
||||
import android.view.InputDevice;
|
||||
@@ -50,6 +52,7 @@ import android.view.ViewConfiguration;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||
import com.android.internal.policy.GestureNavigationSettingsObserver;
|
||||
import com.android.systemui.Dependency;
|
||||
import com.android.systemui.R;
|
||||
@@ -144,9 +147,9 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
||||
// The right side edge width where touch down is allowed
|
||||
private int mEdgeWidthRight;
|
||||
// The bottom gesture area height
|
||||
private int mBottomGestureHeight;
|
||||
private float mBottomGestureHeight;
|
||||
// The slop to distinguish between horizontal and vertical motion
|
||||
private final float mTouchSlop;
|
||||
private float mTouchSlop;
|
||||
// Duration after which we consider the event as longpress.
|
||||
private final int mLongPressTimeout;
|
||||
private int mStartingQuickstepRotation = -1;
|
||||
@@ -211,10 +214,6 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
||||
mPluginManager = pluginManager;
|
||||
Dependency.get(ProtoTracer.class).add(this);
|
||||
|
||||
// Reduce the default touch slop to ensure that we can intercept the gesture
|
||||
// before the app starts to react to it.
|
||||
// TODO(b/130352502) Tune this value and extract into a constant
|
||||
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 0.75f;
|
||||
mLongPressTimeout = Math.min(MAX_LONG_PRESS_TIMEOUT,
|
||||
ViewConfiguration.getLongPressTimeout());
|
||||
|
||||
@@ -233,8 +232,20 @@ public class EdgeBackGestureHandler extends CurrentUserTracker implements Displa
|
||||
mIsBackGestureAllowed =
|
||||
!mGestureNavigationSettingsObserver.areNavigationButtonForcedVisible();
|
||||
|
||||
mBottomGestureHeight = res.getDimensionPixelSize(
|
||||
final float defaultGestureHeight = res.getDimension(
|
||||
com.android.internal.R.dimen.navigation_bar_gesture_height);
|
||||
final float gestureHeight = DeviceConfig.getFloat(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.BACK_GESTURE_BOTTOM_HEIGHT,
|
||||
defaultGestureHeight);
|
||||
mBottomGestureHeight = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP, gestureHeight, res.getDisplayMetrics());
|
||||
|
||||
// Reduce the default touch slop to ensure that we can intercept the gesture
|
||||
// before the app starts to react to it.
|
||||
// TODO(b/130352502) Tune this value and extract into a constant
|
||||
final float backGestureSlop = DeviceConfig.getFloat(DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||
SystemUiDeviceConfigFlags.BACK_GESTURE_SLOP_MULTIPLIER, 0.75f);
|
||||
mTouchSlop = ViewConfiguration.get(mContext).getScaledTouchSlop() * backGestureSlop;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user