From 8f25fb96e2e3c064869dad00e7234013ac22c5d7 Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Tue, 16 Jan 2018 17:17:24 -0800 Subject: [PATCH] Add more controls for launcher to control sysui Added a 4 flags to control the state of system ui: 1. Disable swipe up navigation (prevents motion events going through) 2. Disable quick scrub (& step) 3. Show overview button (hidden by default) 4. Hide back button (shown by default) Test: manual Bug: 67957962 Bug: 70180755 Change-Id: Ibc44af9bbdfa9611688fe12285a999d81b8287e9 --- .../systemui/shared/recents/ISystemUiProxy.aidl | 5 +++ .../shared/system/NavigationBarCompat.java | 29 ++++++++++++++ .../com/android/systemui/OverviewProxyService.java | 24 +++++++++++ .../statusbar/phone/NavigationBarFragment.java | 7 +++- .../phone/NavigationBarGestureHelper.java | 4 +- .../statusbar/phone/NavigationBarView.java | 46 +++++++++++++++++----- .../statusbar/phone/QuickScrubController.java | 19 +++------ 7 files changed, 109 insertions(+), 25 deletions(-) diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl index 4cf817e02fff..b8319a8e8822 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/recents/ISystemUiProxy.aidl @@ -44,4 +44,9 @@ interface ISystemUiProxy { * Specifies the text to be shown for onboarding the new swipe-up gesture to access recents. */ void setRecentsOnboardingText(CharSequence text); + + /** + * Enables/disables launcher/overview interaction features {@link InteractionType}. + */ + void setInteractionState(int flags); } diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java index f622d4a3338c..171918682099 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/system/NavigationBarCompat.java @@ -28,4 +28,33 @@ public class NavigationBarCompat { public static final int HIT_TARGET_NONE = 0; public static final int HIT_TARGET_BACK = 1; public static final int HIT_TARGET_HOME = 2; + + @Retention(RetentionPolicy.SOURCE) + @IntDef({FLAG_DISABLE_SWIPE_UP, + FLAG_DISABLE_QUICK_SCRUB, + FLAG_SHOW_OVERVIEW_BUTTON, + FLAG_HIDE_BACK_BUTTON + }) + public @interface InteractionType {} + + /** + * Interaction type: whether the gesture to swipe up from the navigation bar will trigger + * launcher to show overview + */ + + public static final int FLAG_DISABLE_SWIPE_UP = 0x1; + /** + * Interaction type: enable quick scrub and switch interaction on the home button + */ + public static final int FLAG_DISABLE_QUICK_SCRUB = 0x2; + + /** + * Interaction type: show/hide the overview button while this service is connected to launcher + */ + public static final int FLAG_SHOW_OVERVIEW_BUTTON = 0x4; + + /** + * Interaction type: show/hide the back button while this service is connected to launcher + */ + public static final int FLAG_HIDE_BACK_BUTTON = 0x8; } diff --git a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java index d0128efe2c44..1185f45469df 100644 --- a/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +++ b/packages/SystemUI/src/com/android/systemui/OverviewProxyService.java @@ -47,6 +47,8 @@ import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; +import static com.android.systemui.shared.system.NavigationBarCompat.InteractionType; + /** * Class to send information from overview to launcher with a binder. */ @@ -67,6 +69,7 @@ public class OverviewProxyService implements CallbackController { + for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { + mConnectionCallbacks.get(i).onInteractionFlagsChanged(flags); + } + }); + } + } finally { + Binder.restoreCallingIdentity(token); + } + } }; private final BroadcastReceiver mLauncherAddedReceiver = new BroadcastReceiver() { @@ -230,6 +249,10 @@ public class OverviewProxyService implements CallbackController { final static boolean DEBUG = false; final static String TAG = "StatusBar/NavBarView"; @@ -372,6 +378,19 @@ public class NavigationBarView extends FrameLayout implements PluginListener