OSDN Git Service

Fix system server crash when uninstalling paid LS widget that has been added (issue...
authorAdam Cohen <adamcohen@google.com>
Thu, 18 Apr 2013 20:37:05 +0000 (13:37 -0700)
committerAdam Cohen <adamcohen@google.com>
Thu, 18 Apr 2013 20:55:25 +0000 (13:55 -0700)
Change-Id: I4acf02dad6bd8347727ca4322d19e15b130a6621

policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java

index 7fcf1d5..fbeca4f 100644 (file)
@@ -1589,7 +1589,13 @@ public class KeyguardHostView extends KeyguardViewBase {
 
     @Override
     public void cleanUp() {
-
+        // Make sure we let go of all widgets and their package contexts promptly. If we don't do
+        // this, and the associated application is uninstalled, it can cause a soft reboot.
+        int count = mAppWidgetContainer.getChildCount();
+        for (int i = 0; i < count; i++) {
+            KeyguardWidgetFrame frame = mAppWidgetContainer.getWidgetPageAt(i);
+            frame.removeAllViews();
+        }
     }
 
     /**
@@ -1609,8 +1615,6 @@ public class KeyguardHostView extends KeyguardViewBase {
         return !configDisabled || isTestHarness || fileOverride;
     }
 
-
-
     public void goToUserSwitcher() {
         mAppWidgetContainer.setCurrentPage(getWidgetPosition(R.id.keyguard_multi_user_selector));
     }