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

Commit 35e9a39e authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Exempt sync requests by active UIDs too

As if they were made by IMPORTANT_FOREGROUND apps

Fixes: 112363508
Test: Manual test with subscribedfeeds with the
"procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND" check
removed. (gms-core UID is active, so removing this won't change the behavior)

Change-Id: I86a88636d118889190ae470db7ced6efaaf8ce4d
parent 02360205
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1305,14 +1305,16 @@ public final class ContentService extends IContentService.Stub {
        }
        final ActivityManagerInternal ami =
                LocalServices.getService(ActivityManagerInternal.class);
        final int procState = (ami != null)
                ? ami.getUidProcessState(callingUid)
                : ActivityManager.PROCESS_STATE_NONEXISTENT;
        if (ami == null) {
            return ContentResolver.SYNC_EXEMPTION_NONE;
        }
        final int procState = ami.getUidProcessState(callingUid);
        final boolean isUidActive = ami.isUidActive(callingUid);

        if (procState <= ActivityManager.PROCESS_STATE_TOP) {
            return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET_WITH_TEMP;
        }
        if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND) {
        if (procState <= ActivityManager.PROCESS_STATE_IMPORTANT_FOREGROUND || isUidActive) {
            return ContentResolver.SYNC_EXEMPTION_PROMOTE_BUCKET;
        }
        return ContentResolver.SYNC_EXEMPTION_NONE;