Fix issue #4021524 HMI63B: "Force stop" button not disabled after app is stopped
There should probably be a broadcast from PM about this. Later.
Change-Id: I713197ed458f8f6a914efb3800cd1b192f741613
diff --git a/src/com/android/settings/applications/ApplicationsState.java b/src/com/android/settings/applications/ApplicationsState.java
index e56db74..11e4aae 100644
--- a/src/com/android/settings/applications/ApplicationsState.java
+++ b/src/com/android/settings/applications/ApplicationsState.java
@@ -248,8 +248,7 @@
} else if (Intent.ACTION_PACKAGE_CHANGED.equals(actionStr)) {
Uri data = intent.getData();
String pkgName = data.getEncodedSchemeSpecificPart();
- removePackage(pkgName);
- addPackage(pkgName);
+ invalidatePackage(pkgName);
} else if (Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr) ||
Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE.equals(actionStr)) {
// When applications become available or unavailable (perhaps because
@@ -266,8 +265,7 @@
boolean avail = Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE.equals(actionStr);
if (avail) {
for (String pkgName : pkgList) {
- removePackage(pkgName);
- addPackage(pkgName);
+ invalidatePackage(pkgName);
}
}
}
@@ -624,6 +622,11 @@
}
}
+ void invalidatePackage(String pkgName) {
+ removePackage(pkgName);
+ addPackage(pkgName);
+ }
+
AppEntry getEntryLocked(ApplicationInfo info) {
AppEntry entry = mEntriesMap.get(info.packageName);
if (DEBUG) Log.i(TAG, "Looking up entry of pkg " + info.packageName + ": " + entry);
diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java
index aafd3a1..94eda93 100644
--- a/src/com/android/settings/applications/InstalledAppDetails.java
+++ b/src/com/android/settings/applications/InstalledAppDetails.java
@@ -736,6 +736,11 @@
ActivityManager am = (ActivityManager)getActivity().getSystemService(
Context.ACTIVITY_SERVICE);
am.forceStopPackage(pkgName);
+ mState.invalidatePackage(pkgName);
+ ApplicationsState.AppEntry newEnt = mState.getEntry(pkgName);
+ if (newEnt != null) {
+ mAppEntry = newEnt;
+ }
checkForceStop();
}