summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Cerqueira <cyanogenmod@cerqueira.org>2012-05-04 15:40:50 +0100
committerDanny Baumann <dannybaumann@web.de>2012-05-20 13:43:53 +0200
commit29aa7d1a1fd42157aaebf9eb157ed4d7e9f3cd7e (patch)
treee220760cec7ac7580da90b7aab05d734f98090ef
parent3a2db9f02978f2119b31641a52cc257204d53ca7 (diff)
downloadframeworks_base-29aa7d1a1fd42157aaebf9eb157ed4d7e9f3cd7e.zip
frameworks_base-29aa7d1a1fd42157aaebf9eb157ed4d7e9f3cd7e.tar.gz
frameworks_base-29aa7d1a1fd42157aaebf9eb157ed4d7e9f3cd7e.tar.bz2
Fix for disappearing status bar power widgets after changing theme
Backported from CM9: Clean up existing widgets before creating new ones to prevent dangling references to the previous dialog's context, which broke the insertion of a new widget set into recently created ExpandedDialog views. Change-Id: I16a3bab85bcc07dcdb3b189809f5dae528eff66a
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java9
2 files changed, 14 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
index fd4107a..8783a85 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/StatusBarService.java
@@ -400,6 +400,12 @@ public class StatusBarService extends Service implements CommandQueue.Callbacks
mDateView = (DateView)sb.findViewById(R.id.date);
mCmBatteryMiniIcon = (CmBatteryMiniIcon)sb.findViewById(R.id.CmBatteryMiniIcon);
+ /* Destroy any existing widgets before recreating the expanded dialog
+ * to ensure there are no lost context issues */
+ if (mPowerWidget != null) {
+ mPowerWidget.destroyWidget();
+ }
+
mExpandedDialog = new ExpandedDialog(context);
mExpandedView = expanded;
mExpandedContents = expanded.findViewById(R.id.notificationLinearLayout);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
index 438541a..b51ff3d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/powerwidget/PowerWidget.java
@@ -84,7 +84,7 @@ public class PowerWidget extends FrameLayout {
updateVisibility();
}
- public void setupWidget() {
+ public void destroyWidget() {
Log.i(TAG, "Clearing any old widget stuffs");
// remove all views from the layout
removeAllViews();
@@ -92,14 +92,21 @@ public class PowerWidget extends FrameLayout {
// unregister our content receiver
if(mBroadcastReceiver != null) {
mContext.unregisterReceiver(mBroadcastReceiver);
+ mBroadcastReceiver = null;
}
// unobserve our content
if(mObserver != null) {
mObserver.unobserve();
+ mObserver = null;
}
// clear the button instances
PowerButton.unloadAllButtons();
+ }
+
+
+ public void setupWidget() {
+ destroyWidget();
Log.i(TAG, "Setting up widget");