Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b37c093 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Add a source parameter for resrictions logging

Modify existing callers to use the new parameter

Bug: 341112680
Test: statsd_testdrive 866
      Manually change battery restriction level for an app
Flag: android.app.app_restrictions_api
Change-Id: I66f23341b90f96eb3091b94ab6db512570988643
parent 504ac0cf
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -559,7 +559,8 @@ public class AppButtonsPreferenceController extends BasePreferenceController imp
        if (android.app.Flags.appRestrictionsApi()) {
            am.noteAppRestrictionEnabled(pkgName, mAppEntry.info.uid,
                    ActivityManager.RESTRICTION_LEVEL_FORCE_STOPPED, true,
                    ActivityManager.RESTRICTION_REASON_USER, "settings", 0L);
                    ActivityManager.RESTRICTION_REASON_USER,
                    "settings", ActivityManager.RESTRICTION_SOURCE_USER, 0L);
        }
        am.forceStopPackage(pkgName);
        int userId = UserHandle.getUserId(mAppEntry.info.uid);
+1 −1
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ public class BatteryUtils {
                    packageName, uid, ActivityManager.RESTRICTION_LEVEL_BACKGROUND_RESTRICTED,
                    mode == AppOpsManager.MODE_IGNORED,
                    ActivityManager.RESTRICTION_REASON_USER,
                    "settings", 0);
                    "settings", ActivityManager.RESTRICTION_SOURCE_USER, 0L);
        }
        // Control whether app could run jobs in the background
        mAppOpsManager.setMode(AppOpsManager.OP_RUN_ANY_IN_BACKGROUND, uid, packageName, mode);
+2 −1
Original line number Diff line number Diff line
@@ -160,7 +160,8 @@ class PackageInfoPresenter(
                context.activityManager.noteAppRestrictionEnabled(
                    packageName, uid,
                    ActivityManager.RESTRICTION_LEVEL_FORCE_STOPPED, true,
                    ActivityManager.RESTRICTION_REASON_USER, "settings", 0)
                    ActivityManager.RESTRICTION_REASON_USER, "settings",
                    ActivityManager.RESTRICTION_SOURCE_USER, 0)
            }
            context.activityManager.forceStopPackageAsUser(packageName, userId)
        }