Unrestrict SMS/PHONE app if it been set active

If an app been set default SMS/PHONE app, we need to unrestrict this
app. This CL extract a common function and invoke it when necessary.

Change-Id: Id29c5138438aa6f6f22cdd9c4ecf336de8481782
Fixes: 80305978
Test: robotests
This commit is contained in:
jackqdyulei
2018-07-13 14:50:04 -07:00
parent d3e18dcf0a
commit f1213365fc
9 changed files with 79 additions and 5 deletions

View File

@@ -407,6 +407,16 @@ public class BatteryUtils {
packageName) == AppOpsManager.MODE_IGNORED;
}
public boolean clearForceAppStandby(String packageName) {
final int uid = getPackageUid(packageName);
if (uid != UID_NULL && isForceAppStandbyEnabled(uid, packageName)) {
setForceAppStandby(uid, packageName, AppOpsManager.MODE_ALLOWED);
return true;
} else {
return false;
}
}
public void initBatteryStatsHelper(BatteryStatsHelper statsHelper, Bundle bundle,
UserManager userManager) {
statsHelper.create(bundle);