Loading packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +29 −1 Original line number Diff line number Diff line Loading @@ -32,13 +32,17 @@ import android.view.SurfaceControl; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.OverviewProxyService.OverviewProxyListener; import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; import java.util.ArrayList; import java.util.List; /** * Class to send information from overview to launcher with a binder. */ public class OverviewProxyService { public class OverviewProxyService implements CallbackController<OverviewProxyListener> { private static final String TAG = "OverviewProxyService"; private static final long BACKOFF_MILLIS = 5000; Loading @@ -48,6 +52,7 @@ public class OverviewProxyService { private final Runnable mConnectionRunnable = this::startConnectionToCurrentUser; private final DeviceProvisionedController mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>(); private IOverviewProxy mOverviewProxy; private int mConnectionBackoffAttempts; Loading Loading @@ -82,6 +87,7 @@ public class OverviewProxyService { } catch (RemoteException e) { Log.e(TAG, "Failed to call onBind()", e); } notifyConnectionChanged(); } } Loading Loading @@ -144,6 +150,17 @@ public class OverviewProxyService { } } @Override public void addCallback(OverviewProxyListener listener) { mConnectionCallbacks.add(listener); listener.onConnectionChanged(mOverviewProxy != null); } @Override public void removeCallback(OverviewProxyListener listener) { mConnectionCallbacks.remove(listener); } public IOverviewProxy getProxy() { return mOverviewProxy; } Loading @@ -152,6 +169,17 @@ public class OverviewProxyService { if (mOverviewProxy != null) { mContext.unbindService(mOverviewServiceConnection); mOverviewProxy = null; notifyConnectionChanged(); } } private void notifyConnectionChanged() { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onConnectionChanged(mOverviewProxy != null); } } public interface OverviewProxyListener { void onConnectionChanged(boolean isConnected); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java +11 −5 Original line number Diff line number Diff line Loading @@ -112,20 +112,26 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL mIsRTL = isRTL; } public boolean onInterceptTouchEvent(MotionEvent event) { private boolean proxyMotionEvents(MotionEvent event) { final IOverviewProxy overviewProxy = mOverviewEventSender.getProxy(); if (overviewProxy != null) { mNavigationBarView.requestUnbufferedDispatch(event); try { overviewProxy.onMotionEvent(event); return true; } catch (RemoteException e) { Log.e(TAG, "Callback failed", e); } } return false; } public boolean onInterceptTouchEvent(MotionEvent event) { if (!proxyMotionEvents(event)) { // If we move more than a fixed amount, then start capturing for the // task switcher detector // task switcher detector, disabled when proxying motion events to launcher service mTaskSwitcherDetector.onTouchEvent(event); } int action = event.getAction(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: { Loading Loading @@ -289,7 +295,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL } public boolean onTouchEvent(MotionEvent event) { boolean result = mTaskSwitcherDetector.onTouchEvent(event); boolean result = proxyMotionEvents(event) || mTaskSwitcherDetector.onTouchEvent(event); if (mDockWindowEnabled) { result |= handleDockWindowEvent(event); } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +25 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import android.widget.FrameLayout; import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.DockedStackExistsListener; import com.android.systemui.OverviewProxyService; import com.android.systemui.OverviewProxyService.OverviewProxyListener; import com.android.systemui.R; import com.android.systemui.RecentsComponent; import com.android.systemui.plugins.PluginListener; Loading Loading @@ -196,6 +198,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav } } private final OverviewProxyListener mOverviewProxyListener = isConnected -> setSlippery(!isConnected); public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -531,6 +536,24 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav } } private void setSlippery(boolean slippery) { boolean changed = false; final ViewGroup navbarView = ((ViewGroup) getParent()); final WindowManager.LayoutParams lp = (WindowManager.LayoutParams) navbarView .getLayoutParams(); if (slippery && (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) == 0) { lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY; changed = true; } else if (!slippery && (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) != 0) { lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY; changed = true; } if (changed) { WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE); wm.updateViewLayout(navbarView, lp); } } public void setMenuVisibility(final boolean show) { setMenuVisibility(show, false); } Loading Loading @@ -756,6 +779,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); } @Override Loading @@ -765,6 +789,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav if (mGestureHelper != null) { mGestureHelper.destroy(); } Dependency.get(OverviewProxyService.class).removeCallback(mOverviewProxyListener); } @Override Loading Loading
packages/SystemUI/src/com/android/systemui/OverviewProxyService.java +29 −1 Original line number Diff line number Diff line Loading @@ -32,13 +32,17 @@ import android.view.SurfaceControl; import com.android.systemui.shared.recents.IOverviewProxy; import com.android.systemui.shared.recents.ISystemUiProxy; import com.android.systemui.OverviewProxyService.OverviewProxyListener; import com.android.systemui.statusbar.policy.CallbackController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.statusbar.policy.DeviceProvisionedController.DeviceProvisionedListener; import java.util.ArrayList; import java.util.List; /** * Class to send information from overview to launcher with a binder. */ public class OverviewProxyService { public class OverviewProxyService implements CallbackController<OverviewProxyListener> { private static final String TAG = "OverviewProxyService"; private static final long BACKOFF_MILLIS = 5000; Loading @@ -48,6 +52,7 @@ public class OverviewProxyService { private final Runnable mConnectionRunnable = this::startConnectionToCurrentUser; private final DeviceProvisionedController mDeviceProvisionedController = Dependency.get(DeviceProvisionedController.class); private final List<OverviewProxyListener> mConnectionCallbacks = new ArrayList<>(); private IOverviewProxy mOverviewProxy; private int mConnectionBackoffAttempts; Loading Loading @@ -82,6 +87,7 @@ public class OverviewProxyService { } catch (RemoteException e) { Log.e(TAG, "Failed to call onBind()", e); } notifyConnectionChanged(); } } Loading Loading @@ -144,6 +150,17 @@ public class OverviewProxyService { } } @Override public void addCallback(OverviewProxyListener listener) { mConnectionCallbacks.add(listener); listener.onConnectionChanged(mOverviewProxy != null); } @Override public void removeCallback(OverviewProxyListener listener) { mConnectionCallbacks.remove(listener); } public IOverviewProxy getProxy() { return mOverviewProxy; } Loading @@ -152,6 +169,17 @@ public class OverviewProxyService { if (mOverviewProxy != null) { mContext.unbindService(mOverviewServiceConnection); mOverviewProxy = null; notifyConnectionChanged(); } } private void notifyConnectionChanged() { for (int i = mConnectionCallbacks.size() - 1; i >= 0; --i) { mConnectionCallbacks.get(i).onConnectionChanged(mOverviewProxy != null); } } public interface OverviewProxyListener { void onConnectionChanged(boolean isConnected); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarGestureHelper.java +11 −5 Original line number Diff line number Diff line Loading @@ -112,20 +112,26 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL mIsRTL = isRTL; } public boolean onInterceptTouchEvent(MotionEvent event) { private boolean proxyMotionEvents(MotionEvent event) { final IOverviewProxy overviewProxy = mOverviewEventSender.getProxy(); if (overviewProxy != null) { mNavigationBarView.requestUnbufferedDispatch(event); try { overviewProxy.onMotionEvent(event); return true; } catch (RemoteException e) { Log.e(TAG, "Callback failed", e); } } return false; } public boolean onInterceptTouchEvent(MotionEvent event) { if (!proxyMotionEvents(event)) { // If we move more than a fixed amount, then start capturing for the // task switcher detector // task switcher detector, disabled when proxying motion events to launcher service mTaskSwitcherDetector.onTouchEvent(event); } int action = event.getAction(); switch (action & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: { Loading Loading @@ -289,7 +295,7 @@ public class NavigationBarGestureHelper extends GestureDetector.SimpleOnGestureL } public boolean onTouchEvent(MotionEvent event) { boolean result = mTaskSwitcherDetector.onTouchEvent(event); boolean result = proxyMotionEvents(event) || mTaskSwitcherDetector.onTouchEvent(event); if (mDockWindowEnabled) { result |= handleDockWindowEvent(event); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +25 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,8 @@ import android.widget.FrameLayout; import com.android.settingslib.Utils; import com.android.systemui.Dependency; import com.android.systemui.DockedStackExistsListener; import com.android.systemui.OverviewProxyService; import com.android.systemui.OverviewProxyService.OverviewProxyListener; import com.android.systemui.R; import com.android.systemui.RecentsComponent; import com.android.systemui.plugins.PluginListener; Loading Loading @@ -196,6 +198,9 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav } } private final OverviewProxyListener mOverviewProxyListener = isConnected -> setSlippery(!isConnected); public NavigationBarView(Context context, AttributeSet attrs) { super(context, attrs); Loading Loading @@ -531,6 +536,24 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav } } private void setSlippery(boolean slippery) { boolean changed = false; final ViewGroup navbarView = ((ViewGroup) getParent()); final WindowManager.LayoutParams lp = (WindowManager.LayoutParams) navbarView .getLayoutParams(); if (slippery && (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) == 0) { lp.flags |= WindowManager.LayoutParams.FLAG_SLIPPERY; changed = true; } else if (!slippery && (lp.flags & WindowManager.LayoutParams.FLAG_SLIPPERY) != 0) { lp.flags &= ~WindowManager.LayoutParams.FLAG_SLIPPERY; changed = true; } if (changed) { WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE); wm.updateViewLayout(navbarView, lp); } } public void setMenuVisibility(final boolean show) { setMenuVisibility(show, false); } Loading Loading @@ -756,6 +779,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); } @Override Loading @@ -765,6 +789,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav if (mGestureHelper != null) { mGestureHelper.destroy(); } Dependency.get(OverviewProxyService.class).removeCallback(mOverviewProxyListener); } @Override Loading