Replace com.android.internal.util.Preconditions.checkNotNull with
java.util.Objects.requireNonNull Bug: 126528330 Test: Treehugger Exempt-From-Owner-Approval: Global refactoring. Change-Id: I4a122f5117100e402a81a55a889e99bdd55f19dd
This commit is contained in:
committed by
Tobias Thierer
parent
fbe8eca9ed
commit
50124a0fe5
@@ -22,8 +22,6 @@ import android.net.MacAddress;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.android.internal.util.Preconditions;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/** @hide */
|
||||
@@ -46,7 +44,7 @@ public final class WifiClient implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
public WifiClient(@NonNull MacAddress macAddress) {
|
||||
Preconditions.checkNotNull(macAddress, "mMacAddress must not be null.");
|
||||
Objects.requireNonNull(macAddress, "mMacAddress must not be null.");
|
||||
|
||||
this.mMacAddress = macAddress;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ import android.util.Log;
|
||||
import android.util.LruCache;
|
||||
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.util.Preconditions;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* {@link INetworkScoreCache} implementation for Wifi Networks.
|
||||
@@ -290,7 +290,7 @@ public class WifiNetworkScoreCache extends INetworkScoreCache.Stub {
|
||||
* This cannot be null.
|
||||
*/
|
||||
public CacheListener(@NonNull Handler handler) {
|
||||
Preconditions.checkNotNull(handler);
|
||||
Objects.requireNonNull(handler);
|
||||
mHandler = handler;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@ import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.internal.util.AsyncChannel;
|
||||
import com.android.internal.util.Preconditions;
|
||||
import com.android.internal.util.Protocol;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
@@ -48,6 +47,7 @@ import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/**
|
||||
@@ -840,8 +840,8 @@ public class WifiScanner {
|
||||
@RequiresPermission(Manifest.permission.NETWORK_STACK)
|
||||
public void registerScanListener(@NonNull @CallbackExecutor Executor executor,
|
||||
@NonNull ScanListener listener) {
|
||||
Preconditions.checkNotNull(executor, "executor cannot be null");
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(executor, "executor cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = addListener(listener, executor);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -864,7 +864,7 @@ public class WifiScanner {
|
||||
* #registerScanListener}
|
||||
*/
|
||||
public void unregisterScanListener(@NonNull ScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = removeListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -894,7 +894,7 @@ public class WifiScanner {
|
||||
@RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
public void startBackgroundScan(ScanSettings settings, ScanListener listener,
|
||||
WorkSource workSource) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = addListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -913,7 +913,7 @@ public class WifiScanner {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
public void stopBackgroundScan(ScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = removeListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -962,7 +962,7 @@ public class WifiScanner {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
public void startScan(ScanSettings settings, ScanListener listener, WorkSource workSource) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = addListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -981,7 +981,7 @@ public class WifiScanner {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.LOCATION_HARDWARE)
|
||||
public void stopScan(ScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = removeListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -1036,8 +1036,8 @@ public class WifiScanner {
|
||||
*/
|
||||
public void startConnectedPnoScan(ScanSettings scanSettings, PnoSettings pnoSettings,
|
||||
PnoScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Preconditions.checkNotNull(pnoSettings, "pnoSettings cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(pnoSettings, "pnoSettings cannot be null");
|
||||
int key = addListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -1058,8 +1058,8 @@ public class WifiScanner {
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_STACK)
|
||||
public void startDisconnectedPnoScan(ScanSettings scanSettings, PnoSettings pnoSettings,
|
||||
PnoScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Preconditions.checkNotNull(pnoSettings, "pnoSettings cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(pnoSettings, "pnoSettings cannot be null");
|
||||
int key = addListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
@@ -1074,7 +1074,7 @@ public class WifiScanner {
|
||||
*/
|
||||
@RequiresPermission(android.Manifest.permission.NETWORK_STACK)
|
||||
public void stopPnoScan(ScanListener listener) {
|
||||
Preconditions.checkNotNull(listener, "listener cannot be null");
|
||||
Objects.requireNonNull(listener, "listener cannot be null");
|
||||
int key = removeListener(listener);
|
||||
if (key == INVALID_KEY) return;
|
||||
validateChannel();
|
||||
|
||||
Reference in New Issue
Block a user