diff options
author | Daniel Sandler <dsandler@android.com> | 2011-10-19 16:39:14 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2011-10-19 16:39:14 -0400 |
commit | 0c4ccff36930ff4f0292b94ad51e164c9fa060a3 (patch) | |
tree | 062b194978f180d67b352cc64b552a485bdead62 /packages | |
parent | 70ac412b2fe7be2507189a9fdfb30c43b36d56ac (diff) | |
download | frameworks_base-0c4ccff36930ff4f0292b94ad51e164c9fa060a3.zip frameworks_base-0c4ccff36930ff4f0292b94ad51e164c9fa060a3.tar.gz frameworks_base-0c4ccff36930ff4f0292b94ad51e164c9fa060a3.tar.bz2 |
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
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 6 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java | 13 |
2 files changed, 11 insertions, 8 deletions
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); |