Call noteAppRestrictionChanged when toggling restrictions/exemptions
This is to log the reasons for restriction level change and force stop
Bug: 333882527
Test: statsd_testdrive 863
Toggle battery restrictions manually for an app and verify logging
of reason
atest BatteryOptimizeUtilsTest
Change-Id: Ifcc99efc1b6acc5a992f7d952967210b07319f2e
This commit is contained in:
@@ -558,6 +558,11 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
|
||||
ActivityManager am = (ActivityManager) mActivity.getSystemService(
|
||||
Context.ACTIVITY_SERVICE);
|
||||
Log.d(TAG, "Stopping package " + pkgName);
|
||||
if (android.app.Flags.appRestrictionsApi()) {
|
||||
am.noteAppRestrictionEnabled(pkgName, mAppEntry.info.uid,
|
||||
ActivityManager.RESTRICTION_LEVEL_FORCE_STOPPED, true,
|
||||
ActivityManager.RESTRICTION_REASON_USER, "settings", 0L);
|
||||
}
|
||||
am.forceStopPackage(pkgName);
|
||||
int userId = UserHandle.getUserId(mAppEntry.info.uid);
|
||||
mState.invalidatePackage(pkgName, userId);
|
||||
|
||||
Reference in New Issue
Block a user