Fix parantheses in conditional
((A or B) and C) was written as (A or B and C), leading to unnecessary code execution and clearing distracting restrictions whenever any app is disabled by the user. Also, adding distraction flags to the package dump. Test: Set distraction flags on any app via Digital Wellbeing Disable any app and confirm that restrictions don't get cleared via: adb shell dumpsys package <package-name> Bug: 145735990 Change-Id: I096fe8e8f13c8b83c86041b993b1faf0cc1582b0
This commit is contained in:
@@ -13061,7 +13061,7 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
synchronized (mLock) {
|
||||
allPackages = mPackages.keySet().toArray(new String[mPackages.size()]);
|
||||
}
|
||||
PackageManagerService.this.removeDistractingPackageRestrictions(allPackages, userId);
|
||||
removeDistractingPackageRestrictions(allPackages, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20105,13 +20105,13 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
synchronized (mLock) {
|
||||
pkgSetting.setEnabled(newState, userId, callingPackage);
|
||||
if (newState == COMPONENT_ENABLED_STATE_DISABLED_USER
|
||||
|| newState == COMPONENT_ENABLED_STATE_DISABLED
|
||||
if ((newState == COMPONENT_ENABLED_STATE_DISABLED_USER
|
||||
|| newState == COMPONENT_ENABLED_STATE_DISABLED)
|
||||
&& pkgSetting.getPermissionsState().hasPermission(
|
||||
Manifest.permission.SUSPEND_APPS, userId)) {
|
||||
// This app should not generally be allowed to get disabled by the UI, but if it
|
||||
// ever does, we don't want to end up with some of the user's apps permanently
|
||||
// blocked
|
||||
// suspended.
|
||||
unsuspendForSuspendingPackage(packageName, userId);
|
||||
removeAllDistractingPackageRestrictions(userId);
|
||||
}
|
||||
|
||||
@@ -4835,6 +4835,8 @@ public final class Settings {
|
||||
pw.print(ps.getHidden(user.id));
|
||||
pw.print(" suspended=");
|
||||
pw.print(ps.getSuspended(user.id));
|
||||
pw.print(" distractionFlags=");
|
||||
pw.print(ps.getDistractionFlags(user.id));
|
||||
pw.print(" stopped=");
|
||||
pw.print(ps.getStopped(user.id));
|
||||
pw.print(" notLaunched=");
|
||||
|
||||
Reference in New Issue
Block a user