From 861c04fbd4841253a02299b7498a8cf609e8874d Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Tue, 1 Mar 2011 19:16:38 -0800 Subject: [PATCH] Show force stop button if package is not fully stopped. Change-Id: I88ccb0907352e082ccb538da77aeccc5ab309a49 --- .../applications/InstalledAppDetails.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 8edf2064ec8..aafd3a1745d 100644 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -742,18 +742,28 @@ public class InstalledAppDetails extends Fragment private final BroadcastReceiver mCheckKillProcessesReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { - mForceStopButton.setEnabled(getResultCode() != Activity.RESULT_CANCELED); - mForceStopButton.setOnClickListener(InstalledAppDetails.this); + updateForceStopButton(getResultCode() != Activity.RESULT_CANCELED); } }; + + private void updateForceStopButton(boolean enabled) { + mForceStopButton.setEnabled(enabled); + mForceStopButton.setOnClickListener(InstalledAppDetails.this); + } private void checkForceStop() { Intent intent = new Intent(Intent.ACTION_QUERY_PACKAGE_RESTART, Uri.fromParts("package", mAppEntry.info.packageName, null)); intent.putExtra(Intent.EXTRA_PACKAGES, new String[] { mAppEntry.info.packageName }); intent.putExtra(Intent.EXTRA_UID, mAppEntry.info.uid); - getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null, - Activity.RESULT_CANCELED, null, null); + if ((mAppEntry.info.flags&ApplicationInfo.FLAG_STOPPED) == 0) { + // If the app isn't explicitly stopped, then always show the + // force stop button. + updateForceStopButton(true); + } else { + getActivity().sendOrderedBroadcast(intent, null, mCheckKillProcessesReceiver, null, + Activity.RESULT_CANCELED, null, null); + } } static class DisableChanger extends AsyncTask {