Merge "Fix configuration changes in status bars." into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
026dc1432e
@@ -123,7 +123,7 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
|
|
||||||
protected int mCurrentUserId = 0;
|
protected int mCurrentUserId = 0;
|
||||||
|
|
||||||
protected int mLayoutDirection;
|
protected int mLayoutDirection = -1; // invalid
|
||||||
private Locale mLocale;
|
private Locale mLocale;
|
||||||
protected boolean mUseHeadsUp = false;
|
protected boolean mUseHeadsUp = false;
|
||||||
|
|
||||||
@@ -299,8 +299,6 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_USER_SWITCHED);
|
filter.addAction(Intent.ACTION_USER_SWITCHED);
|
||||||
mContext.registerReceiver(mBroadcastReceiver, filter);
|
mContext.registerReceiver(mBroadcastReceiver, filter);
|
||||||
|
|
||||||
mLocale = mContext.getResources().getConfiguration().locale;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void userSwitched(int newUserId) {
|
public void userSwitched(int newUserId) {
|
||||||
@@ -320,11 +318,17 @@ public abstract class BaseStatusBar extends SystemUI implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onConfigurationChanged(Configuration newConfig) {
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
final Locale newLocale = mContext.getResources().getConfiguration().locale;
|
final Locale locale = mContext.getResources().getConfiguration().locale;
|
||||||
if (! newLocale.equals(mLocale)) {
|
final int ld = TextUtils.getLayoutDirectionFromLocale(locale);
|
||||||
mLocale = newLocale;
|
if (! locale.equals(mLocale) || ld != mLayoutDirection) {
|
||||||
mLayoutDirection = TextUtils.getLayoutDirectionFromLocale(mLocale);
|
if (DEBUG) {
|
||||||
refreshLayout(mLayoutDirection);
|
Log.v(TAG, String.format(
|
||||||
|
"config changed locale/LD: %s (%d) -> %s (%d)", mLocale, mLayoutDirection,
|
||||||
|
locale, ld));
|
||||||
|
}
|
||||||
|
mLocale = locale;
|
||||||
|
mLayoutDirection = ld;
|
||||||
|
refreshLayout(ld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar;
|
package com.android.systemui.statusbar;
|
||||||
|
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -69,6 +70,13 @@ public class SystemBars extends SystemUI implements ServiceMonitor.Callbacks {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onConfigurationChanged(Configuration newConfig) {
|
||||||
|
if (mStatusBar != null) {
|
||||||
|
mStatusBar.onConfigurationChanged(newConfig);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
if (mStatusBar != null) {
|
if (mStatusBar != null) {
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
@@ -633,7 +634,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
|
|
||||||
// receive broadcasts
|
// receive broadcasts
|
||||||
IntentFilter filter = new IntentFilter();
|
IntentFilter filter = new IntentFilter();
|
||||||
filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED);
|
|
||||||
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||||
@@ -2433,17 +2433,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
|
|||||||
notifyNavigationBarScreenOn(false);
|
notifyNavigationBarScreenOn(false);
|
||||||
notifyHeadsUpScreenOn(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)) {
|
else if (Intent.ACTION_SCREEN_ON.equals(action)) {
|
||||||
mScreenOn = true;
|
mScreenOn = true;
|
||||||
// work around problem where mDisplay.getRotation() is not stable while screen is off (bug 7086018)
|
// 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
|
@Override
|
||||||
public void userSwitched(int newUserId) {
|
public void userSwitched(int newUserId) {
|
||||||
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
|
if (MULTIUSER_DEBUG) mNotificationPanelDebugText.setText("USER " + newUserId);
|
||||||
|
|||||||
Reference in New Issue
Block a user