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