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

Commit 5a421ad0 authored by Jeff Sharkey's avatar Jeff Sharkey Committed by Android (Google) Code Review
Browse files

Merge "Defeat @Nullable String[] with empty list." into oc-dev

parents 4566cb57 2abd66c4
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -583,4 +583,8 @@ public class ArrayUtils {
        }
        return size - leftIdx;
    }

    public static @NonNull String[] defeatNullable(@Nullable String[] val) {
        return (val != null) ? val : EmptyArray.STRING;
    }
}
+4 −2
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.server.usage;

import static com.android.internal.util.ArrayUtils.defeatNullable;

import android.app.AppOpsManager;
import android.app.usage.ExternalStorageStats;
import android.app.usage.IStorageStatsManager;
@@ -237,7 +239,7 @@ public class StorageStatsService extends IStorageStatsManager.Stub {
            enforcePermission(Binder.getCallingUid(), callingPackage);
        }

        if (mPackage.getPackagesForUid(appInfo.uid).length == 1) {
        if (defeatNullable(mPackage.getPackagesForUid(appInfo.uid)).length == 1) {
            // Only one package inside UID means we can fast-path
            return queryStatsForUid(volumeUuid, appInfo.uid, callingPackage);
        } else {
@@ -281,7 +283,7 @@ public class StorageStatsService extends IStorageStatsManager.Stub {
            enforcePermission(Binder.getCallingUid(), callingPackage);
        }

        final String[] packageNames = mPackage.getPackagesForUid(uid);
        final String[] packageNames = defeatNullable(mPackage.getPackagesForUid(uid));
        final long[] ceDataInodes = new long[packageNames.length];
        String[] codePaths = new String[0];