Merge "Defeat @Nullable String[] with empty list." into oc-dev
This commit is contained in:
@@ -583,4 +583,8 @@ public class ArrayUtils {
|
||||
}
|
||||
return size - leftIdx;
|
||||
}
|
||||
|
||||
public static @NonNull String[] defeatNullable(@Nullable String[] val) {
|
||||
return (val != null) ? val : EmptyArray.STRING;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user