From 0c4ccff36930ff4f0292b94ad51e164c9fa060a3 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Wed, 19 Oct 2011 16:39:14 -0400 Subject: Add hasNavigationBar() to the window manager. It is no longer sufficient to check the value of internal.R.bool.config_showNavigationBar to determine if a navigation bar (separate from the status bar) is shown on a device, because the emulator needs to be able to override this value (now possible by setting qemu.hw.mainkeys to "1" or "0", for navbar or no navbar, respectively). This logic is now contained in PhoneWindowManager, and any clients wishing to know whether the system has a software nav bar should consult the new hasNavigationBar() method. Bug: 5404945 Change-Id: I119d32a8c84b88b2ef46f63244e7f11dc5de0359 --- .../android/systemui/statusbar/phone/PhoneStatusBar.java | 6 +++--- .../android/systemui/statusbar/tablet/TabletStatusBar.java | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index b724552..fa6f176 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -295,15 +295,15 @@ public class PhoneStatusBar extends StatusBar { mStatusBarView = sb; try { - boolean showNav = res.getBoolean(com.android.internal.R.bool.config_showNavigationBar); + boolean showNav = mWindowManager.hasNavigationBar(); if (showNav) { mNavigationBarView = (NavigationBarView) View.inflate(context, R.layout.navigation_bar, null); mNavigationBarView.setDisabledFlags(mDisabled); } - } catch (Resources.NotFoundException ex) { - // no nav bar for you + } catch (RemoteException ex) { + // no window manager? good luck with that } // figure out which pixel-format to use for the status bar. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java index f0a10f3..becd508 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java @@ -444,11 +444,14 @@ public class TabletStatusBar extends StatusBar implements sb.setHandler(mHandler); - // Sanity-check that someone hasn't set up the config wrong and asked for a navigation bar - // on a tablet that has only the system bar - if (mContext.getResources().getBoolean( - com.android.internal.R.bool.config_showNavigationBar)) { - throw new RuntimeException("Tablet device cannot show navigation bar and system bar"); + try { + // Sanity-check that someone hasn't set up the config wrong and asked for a navigation + // bar on a tablet that has only the system bar + if (mWindowManager.hasNavigationBar()) { + throw new RuntimeException( + "Tablet device cannot show navigation bar and system bar"); + } + } catch (RemoteException ex) { } mBarContents = (ViewGroup) sb.findViewById(R.id.bar_contents); -- cgit v1.1