Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationAssistantAction.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.phone; import android.annotation.NonNull; import android.os.Bundle; import android.view.MotionEvent; import com.android.systemui.assist.AssistManager; import com.android.systemui.recents.OverviewProxyService; /** * Assistant is triggered with this action */ public class NavigationAssistantAction extends NavigationGestureAction { private static final String TAG = "NavigationAssistantActions"; private final AssistManager mAssistManager; public NavigationAssistantAction(@NonNull NavigationBarView navigationBarView, @NonNull OverviewProxyService service, AssistManager assistManager) { super(navigationBarView, service); mAssistManager = assistManager; } @Override public boolean isEnabled() { return true; } @Override public void onGestureStart(MotionEvent event) { mAssistManager.startAssist(new Bundle()); } } packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBackAction.java +2 −3 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class NavigationBackAction extends NavigationGestureAction { @Override public boolean isEnabled() { return !getGlobalBoolean(NavigationPrototypeController.NAVBAR_EXPERIMENTS_DISABLED); return true; } @Override Loading Loading @@ -102,8 +102,7 @@ public class NavigationBackAction extends NavigationGestureAction { } private boolean shouldExecuteBackOnUp() { return !getGlobalBoolean(NavigationPrototypeController.NAVBAR_EXPERIMENTS_DISABLED) && getGlobalBoolean(BACK_AFTER_END_PROP); return getGlobalBoolean(BACK_AFTER_END_PROP); } private void sendEvent(int action, int code) { Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mIsOnDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY; } mNavigationBarView.setComponents(mStatusBar.getPanel()); mNavigationBarView.setComponents(mStatusBar.getPanel(), mAssistManager); mNavigationBarView.setDisabledFlags(mDisabledFlags1); mNavigationBarView.setOnVerticalChangedListener(this::onVerticalChanged); mNavigationBarView.setOnTouchListener(this::onNavigationTouch); Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +11 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import com.android.systemui.DockedStackExistsListener; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.assist.AssistManager; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.statusbar.phone.NavGesture; import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper; Loading Loading @@ -156,6 +157,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav private QuickStepAction mQuickStepAction; private NavigationBackAction mBackAction; private QuickSwitchAction mQuickSwitchAction; private NavigationAssistantAction mAssistantAction; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -366,8 +368,12 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mBarTransitions.getLightTransitionsController(); } public void setComponents(NotificationPanelView panel) { public void setComponents(NotificationPanelView panel, AssistManager assistManager) { mPanelView = panel; if (mAssistantAction == null) { mAssistantAction = new NavigationAssistantAction(this, mOverviewProxyService, assistManager); } if (mGestureHelper instanceof QuickStepController) { ((QuickStepController) mGestureHelper).setComponents(this); updateNavigationGestures(); Loading Loading @@ -398,6 +404,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mBackAction; case NavigationPrototypeController.ACTION_QUICKSWITCH: return mQuickSwitchAction; case NavigationPrototypeController.ACTION_ASSISTANT: return mAssistantAction; case NavigationPrototypeController.ACTION_NOTHING: return null; default: return defaultAction; } Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationGestureAction.java +23 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ import android.annotation.NonNull; import android.content.Context; import android.graphics.Canvas; import android.provider.Settings; import android.view.MotionEvent; import com.android.systemui.recents.OverviewProxyService; Loading @@ -32,6 +33,9 @@ import com.android.systemui.recents.OverviewProxyService; * A gesture action that would be triggered and reassigned by {@link QuickStepController} */ public abstract class NavigationGestureAction { private static final String ENABLE_TASK_STABILIZER_FLAG = "ENABLE_TASK_STABILIZER"; static private boolean sLastTaskStabilizationFlag; protected final NavigationBarView mNavigationBarView; protected final OverviewProxyService mProxySender; Loading @@ -45,6 +49,9 @@ public abstract class NavigationGestureAction { @NonNull OverviewProxyService service) { mNavigationBarView = navigationBarView; mProxySender = service; sLastTaskStabilizationFlag = Settings.Global.getInt( mNavigationBarView.getContext().getContentResolver(), ENABLE_TASK_STABILIZER_FLAG, 0) != 0; } /** Loading Loading @@ -74,6 +81,15 @@ public abstract class NavigationGestureAction { */ public void startGesture(MotionEvent event) { mIsActive = true; // Tell launcher that this action requires a stable task list or not boolean flag = requiresStableTaskList(); if (flag != sLastTaskStabilizationFlag) { Settings.Global.putInt(mNavigationBarView.getContext().getContentResolver(), ENABLE_TASK_STABILIZER_FLAG, flag ? 1 : 0); sLastTaskStabilizationFlag = flag; } onGestureStart(event); } Loading Loading @@ -146,6 +162,13 @@ public abstract class NavigationGestureAction { */ public abstract boolean isEnabled(); /** * @return action requires a stable task list from launcher */ protected boolean requiresStableTaskList() { return false; } protected void onDarkIntensityChange(float intensity) { } Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationAssistantAction.java 0 → 100644 +49 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.phone; import android.annotation.NonNull; import android.os.Bundle; import android.view.MotionEvent; import com.android.systemui.assist.AssistManager; import com.android.systemui.recents.OverviewProxyService; /** * Assistant is triggered with this action */ public class NavigationAssistantAction extends NavigationGestureAction { private static final String TAG = "NavigationAssistantActions"; private final AssistManager mAssistManager; public NavigationAssistantAction(@NonNull NavigationBarView navigationBarView, @NonNull OverviewProxyService service, AssistManager assistManager) { super(navigationBarView, service); mAssistManager = assistManager; } @Override public boolean isEnabled() { return true; } @Override public void onGestureStart(MotionEvent event) { mAssistManager.startAssist(new Bundle()); } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBackAction.java +2 −3 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class NavigationBackAction extends NavigationGestureAction { @Override public boolean isEnabled() { return !getGlobalBoolean(NavigationPrototypeController.NAVBAR_EXPERIMENTS_DISABLED); return true; } @Override Loading Loading @@ -102,8 +102,7 @@ public class NavigationBackAction extends NavigationGestureAction { } private boolean shouldExecuteBackOnUp() { return !getGlobalBoolean(NavigationPrototypeController.NAVBAR_EXPERIMENTS_DISABLED) && getGlobalBoolean(BACK_AFTER_END_PROP); return getGlobalBoolean(BACK_AFTER_END_PROP); } private void sendEvent(int action, int code) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarFragment.java +1 −1 Original line number Diff line number Diff line Loading @@ -269,7 +269,7 @@ public class NavigationBarFragment extends LifecycleFragment implements Callback mIsOnDefaultDisplay = mDisplayId == Display.DEFAULT_DISPLAY; } mNavigationBarView.setComponents(mStatusBar.getPanel()); mNavigationBarView.setComponents(mStatusBar.getPanel(), mAssistManager); mNavigationBarView.setDisabledFlags(mDisabledFlags1); mNavigationBarView.setOnVerticalChangedListener(this::onVerticalChanged); mNavigationBarView.setOnTouchListener(this::onNavigationTouch); Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +11 −1 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ import com.android.systemui.DockedStackExistsListener; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.SysUiServiceProvider; import com.android.systemui.assist.AssistManager; import com.android.systemui.plugins.PluginListener; import com.android.systemui.plugins.statusbar.phone.NavGesture; import com.android.systemui.plugins.statusbar.phone.NavGesture.GestureHelper; Loading Loading @@ -156,6 +157,7 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav private QuickStepAction mQuickStepAction; private NavigationBackAction mBackAction; private QuickSwitchAction mQuickSwitchAction; private NavigationAssistantAction mAssistantAction; /** * Helper that is responsible for showing the right toast when a disallowed activity operation Loading Loading @@ -366,8 +368,12 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mBarTransitions.getLightTransitionsController(); } public void setComponents(NotificationPanelView panel) { public void setComponents(NotificationPanelView panel, AssistManager assistManager) { mPanelView = panel; if (mAssistantAction == null) { mAssistantAction = new NavigationAssistantAction(this, mOverviewProxyService, assistManager); } if (mGestureHelper instanceof QuickStepController) { ((QuickStepController) mGestureHelper).setComponents(this); updateNavigationGestures(); Loading Loading @@ -398,6 +404,10 @@ public class NavigationBarView extends FrameLayout implements PluginListener<Nav return mBackAction; case NavigationPrototypeController.ACTION_QUICKSWITCH: return mQuickSwitchAction; case NavigationPrototypeController.ACTION_ASSISTANT: return mAssistantAction; case NavigationPrototypeController.ACTION_NOTHING: return null; default: return defaultAction; } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationGestureAction.java +23 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_ import android.annotation.NonNull; import android.content.Context; import android.graphics.Canvas; import android.provider.Settings; import android.view.MotionEvent; import com.android.systemui.recents.OverviewProxyService; Loading @@ -32,6 +33,9 @@ import com.android.systemui.recents.OverviewProxyService; * A gesture action that would be triggered and reassigned by {@link QuickStepController} */ public abstract class NavigationGestureAction { private static final String ENABLE_TASK_STABILIZER_FLAG = "ENABLE_TASK_STABILIZER"; static private boolean sLastTaskStabilizationFlag; protected final NavigationBarView mNavigationBarView; protected final OverviewProxyService mProxySender; Loading @@ -45,6 +49,9 @@ public abstract class NavigationGestureAction { @NonNull OverviewProxyService service) { mNavigationBarView = navigationBarView; mProxySender = service; sLastTaskStabilizationFlag = Settings.Global.getInt( mNavigationBarView.getContext().getContentResolver(), ENABLE_TASK_STABILIZER_FLAG, 0) != 0; } /** Loading Loading @@ -74,6 +81,15 @@ public abstract class NavigationGestureAction { */ public void startGesture(MotionEvent event) { mIsActive = true; // Tell launcher that this action requires a stable task list or not boolean flag = requiresStableTaskList(); if (flag != sLastTaskStabilizationFlag) { Settings.Global.putInt(mNavigationBarView.getContext().getContentResolver(), ENABLE_TASK_STABILIZER_FLAG, flag ? 1 : 0); sLastTaskStabilizationFlag = flag; } onGestureStart(event); } Loading Loading @@ -146,6 +162,13 @@ public abstract class NavigationGestureAction { */ public abstract boolean isEnabled(); /** * @return action requires a stable task list from launcher */ protected boolean requiresStableTaskList() { return false; } protected void onDarkIntensityChange(float intensity) { } Loading