Merge "Support to show lock task toast on taskbar" into sc-v2-dev am: a5f83144a3 am: ebe7362c99
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16324230 Change-Id: I7fe1d5d66ccb755893114de6b4d64ddce8a8e667
This commit is contained in:
@@ -395,6 +395,24 @@ public class NavigationBarController implements
|
||||
return (navBar == null) ? null : navBar.getView();
|
||||
}
|
||||
|
||||
public void showPinningEnterExitToast(int displayId, boolean entering) {
|
||||
final NavigationBarView navBarView = getNavigationBarView(displayId);
|
||||
if (navBarView != null) {
|
||||
navBarView.showPinningEnterExitToast(entering);
|
||||
} else if (displayId == DEFAULT_DISPLAY && mTaskbarDelegate.isInitialized()) {
|
||||
mTaskbarDelegate.showPinningEnterExitToast(entering);
|
||||
}
|
||||
}
|
||||
|
||||
public void showPinningEscapeToast(int displayId) {
|
||||
final NavigationBarView navBarView = getNavigationBarView(displayId);
|
||||
if (navBarView != null) {
|
||||
navBarView.showPinningEscapeToast();
|
||||
} else if (displayId == DEFAULT_DISPLAY && mTaskbarDelegate.isInitialized()) {
|
||||
mTaskbarDelegate.showPinningEscapeToast();
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {@link NavigationBar} on the default display. */
|
||||
@Nullable
|
||||
public NavigationBar getDefaultNavigationBar() {
|
||||
|
||||
@@ -60,6 +60,7 @@ import com.android.systemui.navigationbar.gestural.EdgeBackGestureHandler;
|
||||
import com.android.systemui.recents.OverviewProxyService;
|
||||
import com.android.systemui.shared.recents.utilities.Utilities;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
import com.android.systemui.statusbar.AutoHideUiElement;
|
||||
import com.android.systemui.statusbar.CommandQueue;
|
||||
import com.android.systemui.statusbar.phone.AutoHideController;
|
||||
@@ -109,6 +110,9 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
private final Context mContext;
|
||||
private final DisplayManager mDisplayManager;
|
||||
private Context mWindowContext;
|
||||
private ScreenPinningNotify mScreenPinningNotify;
|
||||
private int mNavigationMode;
|
||||
|
||||
/**
|
||||
* Tracks the system calls for when taskbar should transiently show or hide so we can return
|
||||
* this value in {@link AutoHideUiElement#isVisible()} below.
|
||||
@@ -197,6 +201,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
Display display = mDisplayManager.getDisplay(displayId);
|
||||
mWindowContext = mContext.createWindowContext(display, TYPE_APPLICATION, null);
|
||||
mWindowContext.registerComponentCallbacks(this);
|
||||
mScreenPinningNotify = new ScreenPinningNotify(mWindowContext);
|
||||
// Set initial state for any listeners
|
||||
updateSysuiFlags();
|
||||
mAutoHideController.setNavigationBar(mAutoHideUiElement);
|
||||
@@ -214,6 +219,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
mNavBarHelper.removeNavTaskStateUpdater(mNavbarTaskbarStateUpdater);
|
||||
mNavBarHelper.destroy();
|
||||
mEdgeBackGestureHandler.onNavBarDetached();
|
||||
mScreenPinningNotify = null;
|
||||
if (mWindowContext != null) {
|
||||
mWindowContext.unregisterComponentCallbacks(this);
|
||||
mWindowContext = null;
|
||||
@@ -224,6 +230,14 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
mInitialized = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if this taskBar is {@link #init(int)}. Returns {@code false} if this
|
||||
* taskbar has not yet been {@link #init(int)} or has been {@link #destroy()}.
|
||||
*/
|
||||
public boolean isInitialized() {
|
||||
return mInitialized;
|
||||
}
|
||||
|
||||
private void updateSysuiFlags() {
|
||||
int a11yFlags = mNavBarHelper.getA11yButtonState();
|
||||
boolean clickable = (a11yFlags & SYSUI_STATE_A11Y_BUTTON_CLICKABLE) != 0;
|
||||
@@ -345,6 +359,7 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
|
||||
@Override
|
||||
public void onNavigationModeChanged(int mode) {
|
||||
mNavigationMode = mode;
|
||||
mEdgeBackGestureHandler.onNavigationModeChanged(mode);
|
||||
}
|
||||
|
||||
@@ -364,10 +379,34 @@ public class TaskbarDelegate implements CommandQueue.Callbacks,
|
||||
@Override
|
||||
public void onLowMemory() {}
|
||||
|
||||
@Override
|
||||
public void showPinningEnterExitToast(boolean entering) {
|
||||
updateSysuiFlags();
|
||||
if (mScreenPinningNotify == null) {
|
||||
return;
|
||||
}
|
||||
if (entering) {
|
||||
mScreenPinningNotify.showPinningStartToast();
|
||||
} else {
|
||||
mScreenPinningNotify.showPinningExitToast();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPinningEscapeToast() {
|
||||
updateSysuiFlags();
|
||||
if (mScreenPinningNotify == null) {
|
||||
return;
|
||||
}
|
||||
mScreenPinningNotify.showEscapeToast(QuickStepContract.isGesturalMode(mNavigationMode),
|
||||
!QuickStepContract.isGesturalMode(mNavigationMode));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter pw, @NonNull String[] args) {
|
||||
pw.println("TaskbarDelegate (displayId=" + mDisplayId + "):");
|
||||
pw.println(" mNavigationIconHints=" + mNavigationIconHints);
|
||||
pw.println(" mNavigationMode=" + mNavigationMode);
|
||||
pw.println(" mDisabledFlags=" + mDisabledFlags);
|
||||
pw.println(" mTaskBarWindowState=" + mTaskBarWindowState);
|
||||
pw.println(" mBehavior=" + mBehavior);
|
||||
|
||||
@@ -3435,6 +3435,14 @@ public class StatusBar extends CoreStartable implements
|
||||
return mNavigationBarController.getNavigationBarView(mDisplayId);
|
||||
}
|
||||
|
||||
public void showPinningEnterExitToast(boolean entering) {
|
||||
mNavigationBarController.showPinningEnterExitToast(mDisplayId, entering);
|
||||
}
|
||||
|
||||
public void showPinningEscapeToast() {
|
||||
mNavigationBarController.showPinningEscapeToast(mDisplayId);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: Remove this method. Views should not be passed forward. Will cause theme issues.
|
||||
* @return bottom area view
|
||||
|
||||
@@ -547,16 +547,12 @@ public class StatusBarCommandQueueCallbacks implements CommandQueue.Callbacks {
|
||||
|
||||
@Override
|
||||
public void showPinningEnterExitToast(boolean entering) {
|
||||
if (mStatusBar.getNavigationBarView() != null) {
|
||||
mStatusBar.getNavigationBarView().showPinningEnterExitToast(entering);
|
||||
}
|
||||
mStatusBar.showPinningEnterExitToast(entering);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showPinningEscapeToast() {
|
||||
if (mStatusBar.getNavigationBarView() != null) {
|
||||
mStatusBar.getNavigationBarView().showPinningEscapeToast();
|
||||
}
|
||||
mStatusBar.showPinningEscapeToast();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user