From 7f3cf9586ef51d6a870d941e56a0f12471cbbad2 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Fri, 31 Aug 2012 14:57:09 -0400 Subject: [PATCH] Work around instability of Display.getRotation(). Ensures that the navigation buttons are properly oriented each time the screen comes on. Bug: 7086018 Change-Id: Iac6243792a8c64001ff7409108fb892bd470e4c4 --- .../systemui/statusbar/phone/PhoneStatusBar.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 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 9b4ee38f9e381..31bc8a0e68093 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -451,6 +451,7 @@ public class PhoneStatusBar extends BaseStatusBar { filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); filter.addAction(Intent.ACTION_SCREEN_OFF); + filter.addAction(Intent.ACTION_SCREEN_ON); context.registerReceiver(mBroadcastReceiver, filter); return mStatusBarView; @@ -788,11 +789,6 @@ public class PhoneStatusBar extends BaseStatusBar { setAreThereNotifications(); } - @Override - protected void onConfigurationChanged(Configuration newConfig) { - updateShowSearchHoldoff(); - } - private void updateShowSearchHoldoff() { mShowSearchHoldoff = mContext.getResources().getInteger( R.integer.config_show_search_delay); @@ -1804,9 +1800,17 @@ public class PhoneStatusBar extends BaseStatusBar { makeExpandedInvisible(); } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) { + if (DEBUG) { + Slog.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration()); + } updateResources(); repositionNavigationBar(); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); + updateShowSearchHoldoff(); + } + else if (Intent.ACTION_SCREEN_ON.equals(action)) { + // work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018) + repositionNavigationBar(); } } };