Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull"

This commit is contained in:
TreeHugger Robot
2020-01-02 19:06:09 +00:00
committed by Android (Google) Code Review
4 changed files with 14 additions and 11 deletions

View File

@@ -59,7 +59,7 @@ public class AppCollector {
* @param volume Volume to check for apps.
*/
public AppCollector(Context context, @NonNull VolumeInfo volume) {
Preconditions.checkNotNull(volume);
Objects.requireNonNull(volume);
mBackgroundHandler = new BackgroundHandler(BackgroundThread.get().getLooper(),
volume,

View File

@@ -66,6 +66,7 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* CacheQuotaStrategy is a strategy for determining cache quotas using usage stats and foreground
@@ -95,10 +96,10 @@ public class CacheQuotaStrategy implements RemoteCallback.OnResultListener {
public CacheQuotaStrategy(
Context context, UsageStatsManagerInternal usageStatsManager, Installer installer,
ArrayMap<String, SparseLongArray> quotaMap) {
mContext = Preconditions.checkNotNull(context);
mUsageStats = Preconditions.checkNotNull(usageStatsManager);
mInstaller = Preconditions.checkNotNull(installer);
mQuotaMap = Preconditions.checkNotNull(quotaMap);
mContext = Objects.requireNonNull(context);
mUsageStats = Objects.requireNonNull(usageStatsManager);
mInstaller = Objects.requireNonNull(installer);
mQuotaMap = Objects.requireNonNull(quotaMap);
mPreviousValuesFile = new AtomicFile(new File(
new File(Environment.getDataDirectory(), "system"), "cachequota.xml"));
}

View File

@@ -43,6 +43,7 @@ import com.android.internal.annotations.GuardedBy;
import com.android.internal.util.Preconditions;
import java.io.FileDescriptor;
import java.util.Objects;
/**
* Controls storage sessions for users initiated by the {@link StorageManagerService}.
@@ -63,7 +64,7 @@ public final class StorageSessionController {
private volatile boolean mIsResetting;
public StorageSessionController(Context context, boolean isFuseEnabled) {
mContext = Preconditions.checkNotNull(context);
mContext = Objects.requireNonNull(context);
mIsFuseEnabled = isFuseEnabled;
}

View File

@@ -48,6 +48,7 @@ import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -69,7 +70,7 @@ public final class StorageUserConnection {
@GuardedBy("mLock") private final Map<String, Session> mSessions = new HashMap<>();
public StorageUserConnection(Context context, int userId, StorageSessionController controller) {
mContext = Preconditions.checkNotNull(context);
mContext = Objects.requireNonNull(context);
mUserId = Preconditions.checkArgumentNonnegative(userId);
mSessionController = controller;
}
@@ -83,10 +84,10 @@ public final class StorageUserConnection {
*/
public void startSession(String sessionId, ParcelFileDescriptor pfd, String upperPath,
String lowerPath) throws ExternalStorageServiceException {
Preconditions.checkNotNull(sessionId);
Preconditions.checkNotNull(pfd);
Preconditions.checkNotNull(upperPath);
Preconditions.checkNotNull(lowerPath);
Objects.requireNonNull(sessionId);
Objects.requireNonNull(pfd);
Objects.requireNonNull(upperPath);
Objects.requireNonNull(lowerPath);
prepareRemote();
synchronized (mLock) {