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

Commit 53ce01cc authored by Govinda Wasserman's avatar Govinda Wasserman
Browse files

Allows the Assistant to request suppression of fling

Test: Tested locally
BUG: 150688842
Change-Id: I8e8b2ccb87d9ff48d5a287f12ca9a6a2240a2cdb
parent 91482ccc
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ public class QuickStepContract {
    public static final int SYSUI_STATE_QUICK_SETTINGS_EXPANDED = 1 << 11;
    // Winscope tracing is enabled
    public static final int SYSUI_STATE_TRACING_ENABLED = 1 << 12;
    // 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 << 13;

    @Retention(RetentionPolicy.SOURCE)
    @IntDef({SYSUI_STATE_SCREEN_PINNING,
@@ -92,7 +95,8 @@ public class QuickStepContract {
            SYSUI_STATE_OVERVIEW_DISABLED,
            SYSUI_STATE_HOME_DISABLED,
            SYSUI_STATE_SEARCH_DISABLED,
            SYSUI_STATE_TRACING_ENABLED
            SYSUI_STATE_TRACING_ENABLED,
            SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED
    })
    public @interface SystemUiStateFlags {}

@@ -112,6 +116,8 @@ public class QuickStepContract {
        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_TRACING_ENABLED) != 0 ? "tracing" : "");
        str.add((flags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0
                ? "asst_gesture_constrain" : "");
        return str.toString();
    }

+23 −2
Original line number Diff line number Diff line
package com.android.systemui.assist;

import static android.view.Display.DEFAULT_DISPLAY;

import static com.android.systemui.DejankUtils.whitelistIpcs;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -43,6 +46,7 @@ import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.settingslib.applications.InterestingConfigChanges;
import com.android.systemui.R;
import com.android.systemui.assist.ui.DefaultUiController;
import com.android.systemui.model.SysUiState;
import com.android.systemui.recents.OverviewProxyService;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -51,6 +55,8 @@ import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import javax.inject.Inject;
import javax.inject.Singleton;

import dagger.Lazy;

/**
 * Class to manage everything related to assist in SystemUI.
 */
@@ -98,6 +104,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;
@@ -120,6 +129,7 @@ public class AssistManager {
    private final PhoneStateMonitor mPhoneStateMonitor;
    private final AssistHandleBehaviorController mHandleController;
    private final UiController mUiController;
    protected final Lazy<SysUiState> mSysUiState;

    private AssistOrbContainer mView;
    private final DeviceProvisionedController mDeviceProvisionedController;
@@ -185,7 +195,8 @@ public class AssistManager {
            CommandQueue commandQueue,
            PhoneStateMonitor phoneStateMonitor,
            OverviewProxyService overviewProxyService,
            ConfigurationController configurationController) {
            ConfigurationController configurationController,
            Lazy<SysUiState> sysUiState) {
        mContext = context;
        mDeviceProvisionedController = controller;
        mCommandQueue = commandQueue;
@@ -206,6 +217,8 @@ public class AssistManager {

        mUiController = new DefaultUiController(mContext);

        mSysUiState = sysUiState;

        overviewProxyService.addCallback(new OverviewProxyService.OverviewProxyListener() {
            @Override
            public void onAssistantProgress(float progress) {
@@ -243,8 +256,16 @@ 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)) {
                            mSysUiState.get()
                                    .setFlag(
                                            SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED,
                                            hints.getBoolean(CONSTRAINED_KEY, false))
                                    .commitUpdate(DEFAULT_DISPLAY);
                        }
                    }
                });