From 3638973a1703b85a2fbed07bc5f221436126540d Mon Sep 17 00:00:00 2001 From: Jeff Davidson Date: Fri, 29 Sep 2017 12:47:57 -0700 Subject: [PATCH] Explicitly set ENABLED state when a user enables an app. When a user explicitly clicks a button labeled "Enable" for an application in settings, the underlying package state should reflect this. Otherwise, it is impossible to distinguish between the default state of an app and an app which the user has explicitly requested to enable. This behavior is consistent with the Play Store's. This also fixes a metrics bug where enabling a DISABLED_UNTIL_USED app would be erroneously treated as disabling the app. Test: Flashed and verified enabling both DISABLED_UNTIL_USED and DISABLED apps. Fixes: 64223206 Change-Id: Ic18068e6047045d6f5333eaf10fcddd1e95a679d --- .../android/settings/applications/InstalledAppDetails.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/applications/InstalledAppDetails.java b/src/com/android/settings/applications/InstalledAppDetails.java index 2f44d3ec3f1..ccd91fdbcc7 100755 --- a/src/com/android/settings/applications/InstalledAppDetails.java +++ b/src/com/android/settings/applications/InstalledAppDetails.java @@ -982,11 +982,9 @@ public class InstalledAppDetails extends AppInfoBase } else { mMetricsFeatureProvider.action( getActivity(), - mAppEntry.info.enabled - ? MetricsEvent.ACTION_SETTINGS_DISABLE_APP - : MetricsEvent.ACTION_SETTINGS_ENABLE_APP); + MetricsEvent.ACTION_SETTINGS_ENABLE_APP); new DisableChanger(this, mAppEntry.info, - PackageManager.COMPONENT_ENABLED_STATE_DEFAULT) + PackageManager.COMPONENT_ENABLED_STATE_ENABLED) .execute((Object) null); } } else if ((mAppEntry.info.flags & ApplicationInfo.FLAG_INSTALLED) == 0) {