[DO NOT MERGE] Allows the Assistant to request suppression of fling

Test: Tested locally
BUG: 150688842
Change-Id: I8e8b2ccb87d9ff48d5a287f12ca9a6a2240a2cdb
This commit is contained in:
Govinda Wasserman
2020-03-05 17:01:21 -05:00
parent d17b648a01
commit ace57ca0df
2 changed files with 25 additions and 5 deletions

View File

@@ -85,6 +85,9 @@ public class QuickStepContract {
// The notification panel is expanded and interactive (either locked or unlocked), and the
// quick settings is not expanded
public static final int SYSUI_STATE_QUICK_SETTINGS_EXPANDED = 1 << 11;
// The Assistant gesture should be constrained. It is up to the launcher implementation to
// decide how to constrain it
public static final int SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED = 1 << 12;
@Retention(RetentionPolicy.SOURCE)
@IntDef({SYSUI_STATE_SCREEN_PINNING,
@@ -117,6 +120,8 @@ public class QuickStepContract {
str.add((flags & SYSUI_STATE_BOUNCER_SHOWING) != 0 ? "bouncer_visible" : "");
str.add((flags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0 ? "a11y_click" : "");
str.add((flags & SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE) != 0 ? "a11y_long_click" : "");
str.add((flags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0
? "asst_gesture_constrain" : "");
return str.toString();
}

View File

@@ -1,5 +1,9 @@
package com.android.systemui.assist;
import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -39,7 +43,6 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.settingslib.applications.InterestingConfigChanges;
import com.android.systemui.Dependency;
import com.android.systemui.R;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.assist.ui.DefaultUiController;
@@ -103,6 +106,9 @@ public class AssistManager {
public static final String INVOCATION_TYPE_KEY = "invocation_type";
protected static final String ACTION_KEY = "action";
protected static final String SHOW_ASSIST_HANDLES_ACTION = "show_assist_handles";
protected static final String SET_ASSIST_GESTURE_CONSTRAINED_ACTION =
"set_assist_gesture_constrained";
protected static final String CONSTRAINED_KEY = "should_constrain";
public static final int INVOCATION_TYPE_GESTURE = 1;
public static final int INVOCATION_TYPE_ACTIVE_EDGE = 2;
@@ -125,6 +131,7 @@ public class AssistManager {
private final PhoneStateMonitor mPhoneStateMonitor;
private final AssistHandleBehaviorController mHandleController;
private final UiController mUiController;
protected final OverviewProxyService mOverviewProxyService;
private AssistOrbContainer mView;
private final DeviceProvisionedController mDeviceProvisionedController;
@@ -186,7 +193,8 @@ public class AssistManager {
Context context,
AssistUtils assistUtils,
AssistHandleBehaviorController handleController,
ConfigurationController configurationController) {
ConfigurationController configurationController,
OverviewProxyService overviewProxyService) {
mContext = context;
mDeviceProvisionedController = controller;
mWindowManager = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
@@ -206,8 +214,8 @@ public class AssistManager {
mUiController = new DefaultUiController(mContext);
OverviewProxyService overviewProxy = Dependency.get(OverviewProxyService.class);
overviewProxy.addCallback(new OverviewProxyService.OverviewProxyListener() {
mOverviewProxyService = overviewProxyService;
mOverviewProxyService.addCallback(new OverviewProxyService.OverviewProxyListener() {
@Override
public void onAssistantProgress(float progress) {
// Progress goes from 0 to 1 to indicate how close the assist gesture is to
@@ -244,8 +252,15 @@ public class AssistManager {
if (VERBOSE) {
Log.v(TAG, "UI hints received");
}
if (SHOW_ASSIST_HANDLES_ACTION.equals(hints.getString(ACTION_KEY))) {
String action = hints.getString(ACTION_KEY);
if (SHOW_ASSIST_HANDLES_ACTION.equals(action)) {
requestAssistHandles();
} else if (SET_ASSIST_GESTURE_CONSTRAINED_ACTION.equals(action)) {
mOverviewProxyService.setSystemUiStateFlag(
SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
hints.getBoolean(CONSTRAINED_KEY, false),
DEFAULT_DISPLAY);
}
}
});