summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java20
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SystemBars.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java29
3 files changed, 37 insertions, 20 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 49777d4..932fe20 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -123,7 +123,7 @@ public abstract class BaseStatusBar extends SystemUI implements
protected int mCurrentUserId = 0;
- protected int mLayoutDirection;
+ protected int mLayoutDirection = -1; // invalid
private Locale mLocale;
protected boolean mUseHeadsUp = false;
@@ -299,8 +299,6 @@ public abstract class BaseStatusBar extends SystemUI implements
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_USER_SWITCHED);
mContext.registerReceiver(mBroadcastReceiver, filter);
-
- mLocale = mContext.getResources().getConfiguration().locale;
}
public void userSwitched(int newUserId) {
@@ -320,11 +318,17 @@ public abstract class BaseStatusBar extends SystemUI implements
@Override
protected void onConfigurationChanged(Configuration newConfig) {
- final Locale newLocale = mContext.getResources().getConfiguration().locale;
- if (! newLocale.equals(mLocale)) {
- mLocale = newLocale;
- mLayoutDirection = TextUtils.getLayoutDirectionFromLocale(mLocale);
- refreshLayout(mLayoutDirection);
+ final Locale locale = mContext.getResources().getConfiguration().locale;
+ final int ld = TextUtils.getLayoutDirectionFromLocale(locale);
+ if (! locale.equals(mLocale) || ld != mLayoutDirection) {
+ if (DEBUG) {
+ Log.v(TAG, String.format(
+ "config changed locale/LD: %s (%d) -> %s (%d)", mLocale, mLayoutDirection,
+ locale, ld));
+ }
+ mLocale = locale;
+ mLayoutDirection = ld;
+ refreshLayout(ld);
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SystemBars.java b/packages/SystemUI/src/com/android/systemui/statusbar/SystemBars.java
index ecf7b35..16fe1aa 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SystemBars.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SystemBars.java
@@ -16,6 +16,7 @@
package com.android.systemui.statusbar;
+import android.content.res.Configuration;
import android.provider.Settings;
import android.util.Log;
@@ -70,6 +71,13 @@ public class SystemBars extends SystemUI implements ServiceMonitor.Callbacks {
}
@Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ if (mStatusBar != null) {
+ mStatusBar.onConfigurationChanged(newConfig);
+ }
+ }
+
+ @Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
if (mStatusBar != null) {
mStatusBar.dump(fd, pw, args);
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 fbc94b1..c47d0eb 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -38,6 +38,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Canvas;
@@ -633,7 +634,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
// receive broadcasts
IntentFilter filter = new IntentFilter();
- 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);
@@ -2433,17 +2433,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
notifyNavigationBarScreenOn(false);
notifyHeadsUpScreenOn(false);
}
- else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
- if (DEBUG) {
- Log.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration());
- }
- mDisplay.getSize(mCurrentDisplaySize);
-
- updateResources();
- repositionNavigationBar();
- updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
- updateShowSearchHoldoff();
- }
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
mScreenOn = true;
// work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
@@ -2466,6 +2455,22 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
};
+ // SystemUIService notifies SystemBars of configuration changes, which then calls down here
+ @Override
+ protected void onConfigurationChanged(Configuration newConfig) {
+ super.onConfigurationChanged(newConfig); // calls refreshLayout
+
+ if (DEBUG) {
+ Log.v(TAG, "configuration changed: " + mContext.getResources().getConfiguration());
+ }
+ mDisplay.getSize(mCurrentDisplaySize);
+
+ updateResources();
+ repositionNavigationBar();
+ updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
+ updateShowSearchHoldoff();
+ }
+
@Override
public void userSwitched(int newUserId) {
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);