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

Commit 04e281a2 authored by Matt Casey's avatar Matt Casey Committed by Automerger Merge Worker
Browse files

Merge "Revert "Add setting for touch gesture and long-press home assist...""...

Merge "Revert "Add setting for touch gesture and long-press home assist..."" into sc-dev am: 304bd59b

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13998375

Change-Id: I656b5aa1c3c906ddc31dab81156be5e67e44dd38
parents e0d66849 304bd59b
Loading
Loading
Loading
Loading
+0 −16
Original line number Original line Diff line number Diff line
@@ -9175,22 +9175,6 @@ public final class Settings {
        @Readable
        @Readable
        public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
        public static final String ASSIST_GESTURE_SETUP_COMPLETE = "assist_gesture_setup_complete";
        /**
         * Whether the assistant can be triggered by a touch gesture.
         *
         * @hide
         */
        public static final String ASSIST_TOUCH_GESTURE_ENABLED =
                "assist_touch_gesture_enabled";
        /**
         * Whether the assistant can be triggered by long-pressing the home button
         *
         * @hide
         */
        public static final String ASSIST_LONG_PRESS_HOME_ENABLED =
                "assist_long_press_home_enabled";
        /**
        /**
         * Control whether Trust Agents are in active unlock or extend unlock mode.
         * Control whether Trust Agents are in active unlock or extend unlock mode.
         * @hide
         * @hide
+0 −2
Original line number Original line Diff line number Diff line
@@ -123,8 +123,6 @@ message SecureSettingsProto {
        optional SettingProto gesture_silence_alerts_enabled = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto gesture_silence_alerts_enabled = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto gesture_wake_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto gesture_wake_enabled = 8 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto gesture_setup_complete = 9 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto gesture_setup_complete = 9 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto touch_gesture_enabled = 10 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto long_press_home_enabled = 11 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    }
    optional Assist assist = 7;
    optional Assist assist = 7;


+0 −2
Original line number Original line Diff line number Diff line
@@ -165,8 +165,6 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.ASSIST_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_WAKE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_GESTURE_WAKE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_TOUCH_GESTURE_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.ASSIST_LONG_PRESS_HOME_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.VR_DISPLAY_MODE, new DiscreteValueValidator(new String[] {"0", "1"}));
        VALIDATORS.put(Secure.VR_DISPLAY_MODE, new DiscreteValueValidator(new String[] {"0", "1"}));
        VALIDATORS.put(Secure.NOTIFICATION_BADGING, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.NOTIFICATION_BADGING, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.NOTIFICATION_DISMISS_RTL, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.NOTIFICATION_DISMISS_RTL, BOOLEAN_VALIDATOR);
+0 −6
Original line number Original line Diff line number Diff line
@@ -1881,12 +1881,6 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
        dumpSetting(s, p,
                Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
                Settings.Secure.ASSIST_GESTURE_SETUP_COMPLETE,
                SecureSettingsProto.Assist.GESTURE_SETUP_COMPLETE);
                SecureSettingsProto.Assist.GESTURE_SETUP_COMPLETE);
        dumpSetting(s, p,
                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED,
                SecureSettingsProto.Assist.TOUCH_GESTURE_ENABLED);
        dumpSetting(s, p,
                Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED,
                SecureSettingsProto.Assist.LONG_PRESS_HOME_ENABLED);
        p.end(assistToken);
        p.end(assistToken);


        final long assistHandlesToken = p.start(SecureSettingsProto.ASSIST_HANDLES);
        final long assistHandlesToken = p.start(SecureSettingsProto.ASSIST_HANDLES);
+13 −29
Original line number Original line Diff line number Diff line
@@ -209,8 +209,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
    private @TransitionMode int mNavigationBarMode;
    private @TransitionMode int mNavigationBarMode;
    private ContentResolver mContentResolver;
    private ContentResolver mContentResolver;
    private boolean mAssistantAvailable;
    private boolean mAssistantAvailable;
    private boolean mLongPressHomeEnabled;
    private boolean mAssistantTouchGestureEnabled;


    private int mDisabledFlags1;
    private int mDisabledFlags1;
    private int mDisabledFlags2;
    private int mDisabledFlags2;
@@ -311,7 +309,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,


            // Send the assistant availability upon connection
            // Send the assistant availability upon connection
            if (isConnected) {
            if (isConnected) {
                updateAssistantEntrypoints();
                sendAssistantAvailability(mAssistantAvailable);
            }
            }
        }
        }


@@ -406,7 +404,12 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
            new Handler(Looper.getMainLooper())) {
            new Handler(Looper.getMainLooper())) {
        @Override
        @Override
        public void onChange(boolean selfChange, Uri uri) {
        public void onChange(boolean selfChange, Uri uri) {
            updateAssistantEntrypoints();
            boolean available = mAssistManagerLazy.get()
                    .getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
            if (mAssistantAvailable != available) {
                sendAssistantAvailability(available);
                mAssistantAvailable = available;
            }
        }
        }
    };
    };


@@ -528,13 +531,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        mContentResolver.registerContentObserver(
        mContentResolver.registerContentObserver(
                Settings.Secure.getUriFor(Settings.Secure.ASSISTANT),
                Settings.Secure.getUriFor(Settings.Secure.ASSISTANT),
                false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);
                false /* notifyForDescendants */, mAssistContentObserver, UserHandle.USER_ALL);
        mContentResolver.registerContentObserver(
                Settings.Secure.getUriFor(Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED),
                false, mAssistContentObserver, UserHandle.USER_ALL);
        mContentResolver.registerContentObserver(
                Settings.Secure.getUriFor(Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED),
                false, mAssistContentObserver, UserHandle.USER_ALL);
        updateAssistantEntrypoints();


        if (savedState != null) {
        if (savedState != null) {
            mDisabledFlags1 = savedState.getInt(EXTRA_DISABLE_STATE, 0);
            mDisabledFlags1 = savedState.getInt(EXTRA_DISABLE_STATE, 0);
@@ -827,7 +823,7 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                || mNavigationBarView.getHomeButton().getCurrentView() == null) {
                || mNavigationBarView.getHomeButton().getCurrentView() == null) {
            return;
            return;
        }
        }
        if (mHomeButtonLongPressDurationMs.isPresent() || !mLongPressHomeEnabled) {
        if (mHomeButtonLongPressDurationMs.isPresent()) {
            mNavigationBarView.getHomeButton().getCurrentView().setLongClickable(false);
            mNavigationBarView.getHomeButton().getCurrentView().setLongClickable(false);
            mNavigationBarView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(false);
            mNavigationBarView.getHomeButton().getCurrentView().setHapticFeedbackEnabled(false);
            mNavigationBarView.getHomeButton().setOnLongClickListener(null);
            mNavigationBarView.getHomeButton().setOnLongClickListener(null);
@@ -849,8 +845,6 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
        pw.println("  mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation);
        pw.println("  mStartingQuickSwitchRotation=" + mStartingQuickSwitchRotation);
        pw.println("  mCurrentRotation=" + mCurrentRotation);
        pw.println("  mCurrentRotation=" + mCurrentRotation);
        pw.println("  mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs);
        pw.println("  mHomeButtonLongPressDurationMs=" + mHomeButtonLongPressDurationMs);
        pw.println("  mLongPressHomeEnabled=" + mLongPressHomeEnabled);
        pw.println("  mAssistantTouchGestureEnabled=" + mAssistantTouchGestureEnabled);


        if (mNavigationBarView != null) {
        if (mNavigationBarView != null) {
            pw.println("  mNavigationBarWindowState="
            pw.println("  mNavigationBarWindowState="
@@ -1212,11 +1206,9 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                        return true;
                        return true;
                    }
                    }
                }
                }
                if (mLongPressHomeEnabled) {
                mHomeButtonLongPressDurationMs.ifPresent(longPressDuration -> {
                mHomeButtonLongPressDurationMs.ifPresent(longPressDuration -> {
                    mHandler.postDelayed(mOnVariableDurationHomeLongClick, longPressDuration);
                    mHandler.postDelayed(mOnVariableDurationHomeLongClick, longPressDuration);
                });
                });
                }
                break;
                break;
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_CANCEL:
            case MotionEvent.ACTION_CANCEL:
@@ -1488,23 +1480,15 @@ public class NavigationBar implements View.OnAttachStateChangeListener,
                | (requestingServices >= 2 ? SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE : 0);
                | (requestingServices >= 2 ? SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE : 0);
    }
    }


    private void updateAssistantEntrypoints() {
    private void sendAssistantAvailability(boolean available) {
        mAssistantAvailable = mAssistManagerLazy.get()
                .getAssistInfoForUser(UserHandle.USER_CURRENT) != null;
        mLongPressHomeEnabled = Settings.Secure.getInt(mContentResolver,
                Settings.Secure.ASSIST_LONG_PRESS_HOME_ENABLED, 1) != 0;
        mAssistantTouchGestureEnabled = Settings.Secure.getInt(mContentResolver,
                Settings.Secure.ASSIST_TOUCH_GESTURE_ENABLED, 1) != 0;
        if (mOverviewProxyService.getProxy() != null) {
        if (mOverviewProxyService.getProxy() != null) {
            try {
            try {
                mOverviewProxyService.getProxy().onAssistantAvailable(mAssistantAvailable
                mOverviewProxyService.getProxy().onAssistantAvailable(available
                        && mAssistantTouchGestureEnabled
                        && QuickStepContract.isGesturalMode(mNavBarMode));
                        && QuickStepContract.isGesturalMode(mNavBarMode));
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.w(TAG, "Unable to send assistant availability data to launcher");
                Log.w(TAG, "Unable to send assistant availability data to launcher");
            }
            }
        }
        }
        reconfigureHomeLongClick();
    }
    }


    // ----- Methods that DisplayNavigationBarController talks to -----
    // ----- Methods that DisplayNavigationBarController talks to -----