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

Commit 0596a5b0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove duplicate impl of CollectionUtils.emptyIfNull"

parents bfda3a93 04d021ce
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -327,10 +327,6 @@ public class CollectionUtils {
        }
    }

    public static @NonNull <T> List<T> defeatNullable(@Nullable List<T> val) {
        return (val != null) ? val : Collections.emptyList();
    }

    /**
     * @return the first element if not empty/null, null otherwise
     */
+2 −2
Original line number Diff line number Diff line
@@ -1706,8 +1706,8 @@ class StorageManagerService extends IStorageManager.Stub
            int uid, String packageName, int[] ops) {
        long maxTime = 0;
        final List<AppOpsManager.PackageOps> pkgs = manager.getOpsForPackage(uid, packageName, ops);
        for (AppOpsManager.PackageOps pkg : CollectionUtils.defeatNullable(pkgs)) {
            for (AppOpsManager.OpEntry op : CollectionUtils.defeatNullable(pkg.getOps())) {
        for (AppOpsManager.PackageOps pkg : CollectionUtils.emptyIfNull(pkgs)) {
            for (AppOpsManager.OpEntry op : CollectionUtils.emptyIfNull(pkg.getOps())) {
                maxTime = Math.max(maxTime, op.getLastAccessTime());
            }
        }