Allow using config to disable creation of navBar and taskBar
Some platforms, like ARC, has their own implementation of navBar and taskBar, and do not require the creation of these instances. Previously, config_showNavigationBar was implemented to control the creation of navBar. Now, with this CL, we are also using the same config to guard the creation of taskBar. This provides a platform-wide configuration option to disable the creation of both navBar and taskBar without introducing any divergence from the upstream code. Bug: 271960221 Test: Build Change-Id: Ieb86c0f1ed99075ba2417f9ba1c3fa7a603718ae
This commit is contained in:
@@ -224,6 +224,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();
|
||||
@@ -236,8 +248,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");
|
||||
@@ -324,23 +336,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);
|
||||
|
||||
Reference in New Issue
Block a user