summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java31
1 files changed, 18 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
index 5b0a4bb396a1..580facdda7d7 100644
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarController.java
@@ -226,6 +226,18 @@ public class NavigationBarController implements
}
}
+ private boolean shouldCreateNavBarAndTaskBar(int displayId) {
+ final IWindowManager wms = WindowManagerGlobal.getWindowManagerService();
+
+ try {
+ return wms.hasNavigationBar(displayId);
+ } catch (RemoteException e) {
+ // Cannot get wms, just return false with warning message.
+ Log.w(TAG, "Cannot get WindowManager.");
+ return false;
+ }
+ }
+
/** @see #initializeTaskbarIfNecessary() */
private boolean updateNavbarForTaskbar() {
boolean taskbarShown = initializeTaskbarIfNecessary();
@@ -238,8 +250,8 @@ public class NavigationBarController implements
/** @return {@code true} if taskbar is enabled, false otherwise */
private boolean initializeTaskbarIfNecessary() {
// Enable for large screens or (phone AND flag is set); assuming phone = !mIsLargeScreen
- boolean taskbarEnabled = mIsLargeScreen || mFeatureFlags.isEnabled(
- Flags.HIDE_NAVBAR_WINDOW);
+ boolean taskbarEnabled = (mIsLargeScreen || mFeatureFlags.isEnabled(
+ Flags.HIDE_NAVBAR_WINDOW)) && shouldCreateNavBarAndTaskBar(mContext.getDisplayId());
if (taskbarEnabled) {
Trace.beginSection("NavigationBarController#initializeTaskbarIfNecessary");
@@ -331,23 +343,16 @@ public class NavigationBarController implements
final int displayId = display.getDisplayId();
final boolean isOnDefaultDisplay = displayId == mDisplayTracker.getDefaultDisplayId();
+ if (!shouldCreateNavBarAndTaskBar(displayId)) {
+ return;
+ }
+
// We may show TaskBar on the default display for large screen device. Don't need to create
// navigation bar for this case.
if (isOnDefaultDisplay && initializeTaskbarIfNecessary()) {
return;
}
- final IWindowManager wms = WindowManagerGlobal.getWindowManagerService();
-
- try {
- if (!wms.hasNavigationBar(displayId)) {
- return;
- }
- } catch (RemoteException e) {
- // Cannot get wms, just return with warning message.
- Log.w(TAG, "Cannot get WindowManager.");
- return;
- }
final Context context = isOnDefaultDisplay
? mContext
: mContext.createDisplayContext(display);