OSDN Git Service

Remove recents button and longpress home when connected to service (1/2)
authorMatthew Ng <ngmatthew@google.com>
Fri, 15 Dec 2017 01:37:35 +0000 (17:37 -0800)
committerMatthew Ng <ngmatthew@google.com>
Fri, 15 Dec 2017 22:34:03 +0000 (14:34 -0800)
When overview is connected to the launcher service, long press to launch
assistant, the diamond animation and the recents button will be
removed.

Test: manual - enable new experience in launcher settings
Bug: 67957962
Change-Id: I8e976ae36465476e6287e0c1190cd2964099bbc6

packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java

index 61b007f..695168e 100644 (file)
@@ -69,6 +69,7 @@ import com.android.internal.logging.MetricsLogger;
 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 import com.android.internal.util.LatencyTracker;
 import com.android.systemui.Dependency;
+import com.android.systemui.OverviewProxyService;
 import com.android.systemui.R;
 import com.android.systemui.SysUiServiceProvider;
 import com.android.systemui.assist.AssistManager;
@@ -125,6 +126,8 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
     private int mSystemUiVisibility;
     private LightBarController mLightBarController;
 
+    private OverviewProxyService mOverviewProxyService;
+
     public boolean mHomeBlockedThisTouch;
 
     // ----- Fragment Lifecycle Callbacks -----
@@ -152,6 +155,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
             mDisabledFlags1 = savedInstanceState.getInt(EXTRA_DISABLE_STATE, 0);
         }
         mAssistManager = Dependency.get(AssistManager.class);
+        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
 
         try {
             WindowManagerGlobal.getWindowManagerService()
@@ -364,7 +368,8 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
 
     private boolean shouldDisableNavbarGestures() {
         return !mStatusBar.isDeviceProvisioned()
-                || (mDisabledFlags1 & StatusBarManager.DISABLE_SEARCH) != 0;
+                || (mDisabledFlags1 & StatusBarManager.DISABLE_SEARCH) != 0
+                || mOverviewProxyService.getProxy() != null;
     }
 
     private void repositionNavigationBar() {
@@ -449,6 +454,7 @@ public class NavigationBarFragment extends Fragment implements Callbacks {
         MetricsLogger.action(getContext(), MetricsEvent.ACTION_ASSIST_LONG_PRESS);
         mAssistManager.startAssist(new Bundle() /* args */);
         mStatusBar.awakenDreams();
+
         if (mNavigationBarView != null) {
             mNavigationBarView.abortCurrentGesture();
         }
index 4e7f205..2796f0f 100644 (file)
@@ -98,6 +98,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
     private GestureHelper mGestureHelper;
     private DeadZone mDeadZone;
     private final NavigationBarTransitions mBarTransitions;
+    private final OverviewProxyService mOverviewProxyService;
 
     // workaround for LayoutTransitions leaving the nav buttons in a weird state (bug 5549288)
     final static boolean WORKAROUND_INVALID_LAYOUT = true;
@@ -226,6 +227,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         mButtonDispatchers.put(R.id.ime_switcher, new ButtonDispatcher(R.id.ime_switcher));
         mButtonDispatchers.put(R.id.accessibility_button,
                 new ButtonDispatcher(R.id.accessibility_button));
+        mOverviewProxyService = Dependency.get(OverviewProxyService.class);
     }
 
     public BarTransitions getBarTransitions() {
@@ -464,6 +466,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
             disableBack = false;
             disableRecent = false;
         }
+        if (mOverviewProxyService.getProxy() != null) {
+            // When overview is connected to the launcher service, disable the recents button
+            disableRecent = true;
+        }
 
         ViewGroup navButtons = (ViewGroup) getCurrentView().findViewById(R.id.nav_buttons);
         if (navButtons != null) {
@@ -779,7 +785,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         onPluginDisconnected(null); // Create default gesture helper
         Dependency.get(PluginManager.class).addPluginListener(this,
                 NavGesture.class, false /* Only one */);
-        Dependency.get(OverviewProxyService.class).addCallback(mOverviewProxyListener);
+        mOverviewProxyService.addCallback(mOverviewProxyListener);
     }
 
     @Override
@@ -789,7 +795,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav
         if (mGestureHelper != null) {
             mGestureHelper.destroy();
         }
-        Dependency.get(OverviewProxyService.class).removeCallback(mOverviewProxyListener);
+        mOverviewProxyService.removeCallback(mOverviewProxyListener);
     }
 
     @Override