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

Commit 5566ea41 authored by Ethan Chen's avatar Ethan Chen Committed by Gerrit Code Review
Browse files

NetworkPolicyManager: Null check list of packages belonging to UID

* getPackagesForUid can return null instead of an empty collection.

REF: CYNGNOS-1967
Change-Id: I53b1903a0f037d9fb9165c2294106867e9a639e7
parent 5fba9abb
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -2227,13 +2227,15 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {

    private boolean isUidIdle(int uid) {
        final String[] packages = mContext.getPackageManager().getPackagesForUid(uid);
        final int userId = UserHandle.getUserId(uid);

        if (packages != null) {
            final int userId = UserHandle.getUserId(uid);
            for (String packageName : packages) {
                if (!mUsageStats.isAppIdle(packageName, uid, userId)) {
                    return false;
                }
            }
        }
        return true;
    }