summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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");