Merge "tempAllowList duration can be updated if an UID is already temp allowlisted." into sc-qpr1-dev am: add3a2e361
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15851148 Change-Id: I98beccce014373f5ccb43e76c7e6acfc76407301
This commit is contained in:
@@ -2918,6 +2918,13 @@ public class DeviceIdleController extends SystemService
|
|||||||
reasonCode, reason).sendToTarget();
|
reasonCode, reason).sendToTarget();
|
||||||
}
|
}
|
||||||
reportTempWhitelistChangedLocked(uid, true);
|
reportTempWhitelistChangedLocked(uid, true);
|
||||||
|
} else {
|
||||||
|
// The uid is already temp allowlisted, only need to update AMS for temp allowlist
|
||||||
|
// duration.
|
||||||
|
if (mLocalActivityManager != null) {
|
||||||
|
mLocalActivityManager.updateDeviceIdleTempAllowlist(null, uid, true,
|
||||||
|
duration, tempAllowListType, reasonCode, reason, callingUid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (informWhitelistChanged) {
|
if (informWhitelistChanged) {
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ public abstract class ActivityManagerInternal {
|
|||||||
/**
|
/**
|
||||||
* Update information about which app IDs are on the temp allowlist.
|
* Update information about which app IDs are on the temp allowlist.
|
||||||
* @param appids the updated list of appIds in temp allowlist.
|
* @param appids the updated list of appIds in temp allowlist.
|
||||||
|
* If null, it is to update only changingUid.
|
||||||
* @param changingUid uid to add or remove to temp allowlist.
|
* @param changingUid uid to add or remove to temp allowlist.
|
||||||
* @param adding true to add to temp allowlist, false to remove from temp allowlist.
|
* @param adding true to add to temp allowlist, false to remove from temp allowlist.
|
||||||
* @param durationMs when adding is true, the duration to be in temp allowlist.
|
* @param durationMs when adding is true, the duration to be in temp allowlist.
|
||||||
@@ -165,7 +166,7 @@ public abstract class ActivityManagerInternal {
|
|||||||
* @param callingUid the callingUid that setup this temp allowlist, only valid when param adding
|
* @param callingUid the callingUid that setup this temp allowlist, only valid when param adding
|
||||||
* is true.
|
* is true.
|
||||||
*/
|
*/
|
||||||
public abstract void updateDeviceIdleTempAllowlist(int[] appids, int changingUid,
|
public abstract void updateDeviceIdleTempAllowlist(@Nullable int[] appids, int changingUid,
|
||||||
boolean adding, long durationMs, @TempAllowListType int type,
|
boolean adding, long durationMs, @TempAllowListType int type,
|
||||||
@ReasonCode int reasonCode,
|
@ReasonCode int reasonCode,
|
||||||
@Nullable String reason, int callingUid);
|
@Nullable String reason, int callingUid);
|
||||||
|
|||||||
@@ -15404,12 +15404,14 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateDeviceIdleTempAllowlist(int[] appids, int changingUid, boolean adding,
|
public void updateDeviceIdleTempAllowlist(@Nullable int[] appids, int changingUid,
|
||||||
long durationMs, @TempAllowListType int type, @ReasonCode int reasonCode,
|
boolean adding, long durationMs, @TempAllowListType int type,
|
||||||
@Nullable String reason, int callingUid) {
|
@ReasonCode int reasonCode, @Nullable String reason, int callingUid) {
|
||||||
synchronized (ActivityManagerService.this) {
|
synchronized (ActivityManagerService.this) {
|
||||||
synchronized (mProcLock) {
|
synchronized (mProcLock) {
|
||||||
mDeviceIdleTempAllowlist = appids;
|
if (appids != null) {
|
||||||
|
mDeviceIdleTempAllowlist = appids;
|
||||||
|
}
|
||||||
if (adding) {
|
if (adding) {
|
||||||
if (type == TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED) {
|
if (type == TEMPORARY_ALLOW_LIST_TYPE_FOREGROUND_SERVICE_ALLOWED) {
|
||||||
// Note, the device idle temp-allowlist are by app-ids, but here
|
// Note, the device idle temp-allowlist are by app-ids, but here
|
||||||
@@ -15419,12 +15421,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
|||||||
callingUid));
|
callingUid));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Note in the removing case, we need to remove all the UIDs matching
|
mFgsStartTempAllowList.removeUid(changingUid);
|
||||||
// the appId, because DeviceIdle's temp-allowlist are based on AppIds,
|
|
||||||
// not UIDs.
|
|
||||||
// For eacmple, "cmd deviceidle tempallowlist -r PACKAGE" will
|
|
||||||
// not only remove this app for user 0, but for all users.
|
|
||||||
mFgsStartTempAllowList.removeAppId(UserHandle.getAppId(changingUid));
|
|
||||||
}
|
}
|
||||||
setAppIdTempAllowlistStateLSP(changingUid, adding);
|
setAppIdTempAllowlistStateLSP(changingUid, adding);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user