Merge "Replace com.android.internal.util.Preconditions.checkNotNull with java.util.Objects.requireNonNull" am: f8098ddadf
Change-Id: I9f9ba24036e19f568942466c866c7be23112c10a
This commit is contained in:
@@ -54,7 +54,6 @@ import com.android.internal.app.IAppOpsCallback;
|
|||||||
import com.android.internal.app.IAppOpsService;
|
import com.android.internal.app.IAppOpsService;
|
||||||
import com.android.internal.util.ArrayUtils;
|
import com.android.internal.util.ArrayUtils;
|
||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
import com.android.internal.util.Preconditions;
|
|
||||||
import com.android.internal.util.StatLogger;
|
import com.android.internal.util.StatLogger;
|
||||||
import com.android.server.ForceAppStandbyTrackerProto.ExemptedPackage;
|
import com.android.server.ForceAppStandbyTrackerProto.ExemptedPackage;
|
||||||
import com.android.server.ForceAppStandbyTrackerProto.RunAnyInBackgroundRestrictedPackages;
|
import com.android.server.ForceAppStandbyTrackerProto.RunAnyInBackgroundRestrictedPackages;
|
||||||
@@ -62,6 +61,7 @@ import com.android.server.ForceAppStandbyTrackerProto.RunAnyInBackgroundRestrict
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to keep track of the information related to "force app standby", which includes:
|
* Class to keep track of the information related to "force app standby", which includes:
|
||||||
@@ -416,12 +416,12 @@ public class AppStateTracker {
|
|||||||
}
|
}
|
||||||
mStarted = true;
|
mStarted = true;
|
||||||
|
|
||||||
mIActivityManager = Preconditions.checkNotNull(injectIActivityManager());
|
mIActivityManager = Objects.requireNonNull(injectIActivityManager());
|
||||||
mActivityManagerInternal = Preconditions.checkNotNull(injectActivityManagerInternal());
|
mActivityManagerInternal = Objects.requireNonNull(injectActivityManagerInternal());
|
||||||
mAppOpsManager = Preconditions.checkNotNull(injectAppOpsManager());
|
mAppOpsManager = Objects.requireNonNull(injectAppOpsManager());
|
||||||
mAppOpsService = Preconditions.checkNotNull(injectIAppOpsService());
|
mAppOpsService = Objects.requireNonNull(injectIAppOpsService());
|
||||||
mPowerManagerInternal = Preconditions.checkNotNull(injectPowerManagerInternal());
|
mPowerManagerInternal = Objects.requireNonNull(injectPowerManagerInternal());
|
||||||
mUsageStatsManagerInternal = Preconditions.checkNotNull(
|
mUsageStatsManagerInternal = Objects.requireNonNull(
|
||||||
injectUsageStatsManagerInternal());
|
injectUsageStatsManagerInternal());
|
||||||
|
|
||||||
mFlagsObserver = new FeatureFlagsObserver();
|
mFlagsObserver = new FeatureFlagsObserver();
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ import static android.os.Process.INVALID_UID;
|
|||||||
import static android.system.OsConstants.IPPROTO_TCP;
|
import static android.system.OsConstants.IPPROTO_TCP;
|
||||||
import static android.system.OsConstants.IPPROTO_UDP;
|
import static android.system.OsConstants.IPPROTO_UDP;
|
||||||
|
|
||||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import static java.util.Map.Entry;
|
import static java.util.Map.Entry;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
@@ -929,7 +927,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
* @see IpConnectivityMetrics.Logger
|
* @see IpConnectivityMetrics.Logger
|
||||||
*/
|
*/
|
||||||
public IpConnectivityMetrics.Logger getMetricsLogger() {
|
public IpConnectivityMetrics.Logger getMetricsLogger() {
|
||||||
return checkNotNull(LocalServices.getService(IpConnectivityMetrics.Logger.class),
|
return Objects.requireNonNull(LocalServices.getService(IpConnectivityMetrics.Logger.class),
|
||||||
"no IpConnectivityMetrics service");
|
"no IpConnectivityMetrics service");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -958,10 +956,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
IDnsResolver dnsresolver, IpConnectivityLog logger, INetd netd, Dependencies deps) {
|
IDnsResolver dnsresolver, IpConnectivityLog logger, INetd netd, Dependencies deps) {
|
||||||
if (DBG) log("ConnectivityService starting up");
|
if (DBG) log("ConnectivityService starting up");
|
||||||
|
|
||||||
mDeps = checkNotNull(deps, "missing Dependencies");
|
mDeps = Objects.requireNonNull(deps, "missing Dependencies");
|
||||||
mSystemProperties = mDeps.getSystemProperties();
|
mSystemProperties = mDeps.getSystemProperties();
|
||||||
mNetIdManager = mDeps.makeNetIdManager();
|
mNetIdManager = mDeps.makeNetIdManager();
|
||||||
mContext = checkNotNull(context, "missing Context");
|
mContext = Objects.requireNonNull(context, "missing Context");
|
||||||
|
|
||||||
mMetricsLog = logger;
|
mMetricsLog = logger;
|
||||||
mDefaultRequest = createDefaultInternetRequestForTransport(-1, NetworkRequest.Type.REQUEST);
|
mDefaultRequest = createDefaultInternetRequestForTransport(-1, NetworkRequest.Type.REQUEST);
|
||||||
@@ -991,13 +989,13 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
mLingerDelayMs = mSystemProperties.getInt(LINGER_DELAY_PROPERTY, DEFAULT_LINGER_DELAY_MS);
|
mLingerDelayMs = mSystemProperties.getInt(LINGER_DELAY_PROPERTY, DEFAULT_LINGER_DELAY_MS);
|
||||||
|
|
||||||
mNMS = checkNotNull(netManager, "missing INetworkManagementService");
|
mNMS = Objects.requireNonNull(netManager, "missing INetworkManagementService");
|
||||||
mStatsService = checkNotNull(statsService, "missing INetworkStatsService");
|
mStatsService = Objects.requireNonNull(statsService, "missing INetworkStatsService");
|
||||||
mPolicyManager = checkNotNull(policyManager, "missing INetworkPolicyManager");
|
mPolicyManager = Objects.requireNonNull(policyManager, "missing INetworkPolicyManager");
|
||||||
mPolicyManagerInternal = checkNotNull(
|
mPolicyManagerInternal = Objects.requireNonNull(
|
||||||
LocalServices.getService(NetworkPolicyManagerInternal.class),
|
LocalServices.getService(NetworkPolicyManagerInternal.class),
|
||||||
"missing NetworkPolicyManagerInternal");
|
"missing NetworkPolicyManagerInternal");
|
||||||
mDnsResolver = checkNotNull(dnsresolver, "missing IDnsResolver");
|
mDnsResolver = Objects.requireNonNull(dnsresolver, "missing IDnsResolver");
|
||||||
mProxyTracker = mDeps.makeProxyTracker(mContext, mHandler);
|
mProxyTracker = mDeps.makeProxyTracker(mContext, mHandler);
|
||||||
|
|
||||||
mNetd = netd;
|
mNetd = netd;
|
||||||
@@ -5508,7 +5506,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public NetworkRequest pendingRequestForNetwork(NetworkCapabilities networkCapabilities,
|
public NetworkRequest pendingRequestForNetwork(NetworkCapabilities networkCapabilities,
|
||||||
PendingIntent operation, @NonNull String callingPackageName) {
|
PendingIntent operation, @NonNull String callingPackageName) {
|
||||||
checkNotNull(operation, "PendingIntent cannot be null.");
|
Objects.requireNonNull(operation, "PendingIntent cannot be null.");
|
||||||
final int callingUid = Binder.getCallingUid();
|
final int callingUid = Binder.getCallingUid();
|
||||||
networkCapabilities = new NetworkCapabilities(networkCapabilities);
|
networkCapabilities = new NetworkCapabilities(networkCapabilities);
|
||||||
enforceNetworkRequestPermissions(networkCapabilities);
|
enforceNetworkRequestPermissions(networkCapabilities);
|
||||||
@@ -5537,7 +5535,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void releasePendingNetworkRequest(PendingIntent operation) {
|
public void releasePendingNetworkRequest(PendingIntent operation) {
|
||||||
checkNotNull(operation, "PendingIntent cannot be null.");
|
Objects.requireNonNull(operation, "PendingIntent cannot be null.");
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(EVENT_RELEASE_NETWORK_REQUEST_WITH_INTENT,
|
mHandler.sendMessage(mHandler.obtainMessage(EVENT_RELEASE_NETWORK_REQUEST_WITH_INTENT,
|
||||||
getCallingUid(), 0, operation));
|
getCallingUid(), 0, operation));
|
||||||
}
|
}
|
||||||
@@ -5596,7 +5594,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public void pendingListenForNetwork(NetworkCapabilities networkCapabilities,
|
public void pendingListenForNetwork(NetworkCapabilities networkCapabilities,
|
||||||
PendingIntent operation, @NonNull String callingPackageName) {
|
PendingIntent operation, @NonNull String callingPackageName) {
|
||||||
checkNotNull(operation, "PendingIntent cannot be null.");
|
Objects.requireNonNull(operation, "PendingIntent cannot be null.");
|
||||||
final int callingUid = Binder.getCallingUid();
|
final int callingUid = Binder.getCallingUid();
|
||||||
if (!hasWifiNetworkListenPermission(networkCapabilities)) {
|
if (!hasWifiNetworkListenPermission(networkCapabilities)) {
|
||||||
enforceAccessPermission();
|
enforceAccessPermission();
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ import java.util.Collection;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@@ -113,9 +114,9 @@ class ExplicitHealthCheckController {
|
|||||||
Slog.wtf(TAG, "Resetting health check controller callbacks");
|
Slog.wtf(TAG, "Resetting health check controller callbacks");
|
||||||
}
|
}
|
||||||
|
|
||||||
mPassedConsumer = Preconditions.checkNotNull(passedConsumer);
|
mPassedConsumer = Objects.requireNonNull(passedConsumer);
|
||||||
mSupportedConsumer = Preconditions.checkNotNull(supportedConsumer);
|
mSupportedConsumer = Objects.requireNonNull(supportedConsumer);
|
||||||
mNotifySyncRunnable = Preconditions.checkNotNull(notifySyncRunnable);
|
mNotifySyncRunnable = Objects.requireNonNull(notifySyncRunnable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,6 @@ import static android.system.OsConstants.EINVAL;
|
|||||||
import static android.system.OsConstants.IPPROTO_UDP;
|
import static android.system.OsConstants.IPPROTO_UDP;
|
||||||
import static android.system.OsConstants.SOCK_DGRAM;
|
import static android.system.OsConstants.SOCK_DGRAM;
|
||||||
|
|
||||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -575,7 +573,7 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void put(int key, RefcountedResource<T> obj) {
|
void put(int key, RefcountedResource<T> obj) {
|
||||||
checkNotNull(obj, "Null resources cannot be added");
|
Objects.requireNonNull(obj, "Null resources cannot be added");
|
||||||
mArray.put(key, obj);
|
mArray.put(key, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1114,7 +1112,7 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
if (requestedSpi > 0 && requestedSpi < 256) {
|
if (requestedSpi > 0 && requestedSpi < 256) {
|
||||||
throw new IllegalArgumentException("ESP SPI must not be in the range of 0-255.");
|
throw new IllegalArgumentException("ESP SPI must not be in the range of 0-255.");
|
||||||
}
|
}
|
||||||
checkNotNull(binder, "Null Binder passed to allocateSecurityParameterIndex");
|
Objects.requireNonNull(binder, "Null Binder passed to allocateSecurityParameterIndex");
|
||||||
|
|
||||||
int callingUid = Binder.getCallingUid();
|
int callingUid = Binder.getCallingUid();
|
||||||
UserRecord userRecord = mUserResourceTracker.getUserRecord(callingUid);
|
UserRecord userRecord = mUserResourceTracker.getUserRecord(callingUid);
|
||||||
@@ -1231,7 +1229,7 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Specified port number must be a valid non-reserved UDP port");
|
"Specified port number must be a valid non-reserved UDP port");
|
||||||
}
|
}
|
||||||
checkNotNull(binder, "Null Binder passed to openUdpEncapsulationSocket");
|
Objects.requireNonNull(binder, "Null Binder passed to openUdpEncapsulationSocket");
|
||||||
|
|
||||||
int callingUid = Binder.getCallingUid();
|
int callingUid = Binder.getCallingUid();
|
||||||
UserRecord userRecord = mUserResourceTracker.getUserRecord(callingUid);
|
UserRecord userRecord = mUserResourceTracker.getUserRecord(callingUid);
|
||||||
@@ -1291,8 +1289,8 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
String localAddr, String remoteAddr, Network underlyingNetwork, IBinder binder,
|
String localAddr, String remoteAddr, Network underlyingNetwork, IBinder binder,
|
||||||
String callingPackage) {
|
String callingPackage) {
|
||||||
enforceTunnelFeatureAndPermissions(callingPackage);
|
enforceTunnelFeatureAndPermissions(callingPackage);
|
||||||
checkNotNull(binder, "Null Binder passed to createTunnelInterface");
|
Objects.requireNonNull(binder, "Null Binder passed to createTunnelInterface");
|
||||||
checkNotNull(underlyingNetwork, "No underlying network was specified");
|
Objects.requireNonNull(underlyingNetwork, "No underlying network was specified");
|
||||||
checkInetAddress(localAddr);
|
checkInetAddress(localAddr);
|
||||||
checkInetAddress(remoteAddr);
|
checkInetAddress(remoteAddr);
|
||||||
|
|
||||||
@@ -1573,7 +1571,7 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
"IPsec Tunnel Mode requires PackageManager.FEATURE_IPSEC_TUNNELS");
|
"IPsec Tunnel Mode requires PackageManager.FEATURE_IPSEC_TUNNELS");
|
||||||
}
|
}
|
||||||
|
|
||||||
checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels");
|
Objects.requireNonNull(callingPackage, "Null calling package cannot create IpSec tunnels");
|
||||||
|
|
||||||
// OP_MANAGE_IPSEC_TUNNELS will return MODE_ERRORED by default, including for the system
|
// OP_MANAGE_IPSEC_TUNNELS will return MODE_ERRORED by default, including for the system
|
||||||
// server. If the appop is not granted, require that the caller has the MANAGE_IPSEC_TUNNELS
|
// server. If the appop is not granted, require that the caller has the MANAGE_IPSEC_TUNNELS
|
||||||
@@ -1642,12 +1640,12 @@ public class IpSecService extends IIpSecService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public synchronized IpSecTransformResponse createTransform(
|
public synchronized IpSecTransformResponse createTransform(
|
||||||
IpSecConfig c, IBinder binder, String callingPackage) throws RemoteException {
|
IpSecConfig c, IBinder binder, String callingPackage) throws RemoteException {
|
||||||
checkNotNull(c);
|
Objects.requireNonNull(c);
|
||||||
if (c.getMode() == IpSecTransform.MODE_TUNNEL) {
|
if (c.getMode() == IpSecTransform.MODE_TUNNEL) {
|
||||||
enforceTunnelFeatureAndPermissions(callingPackage);
|
enforceTunnelFeatureAndPermissions(callingPackage);
|
||||||
}
|
}
|
||||||
checkIpSecConfig(c);
|
checkIpSecConfig(c);
|
||||||
checkNotNull(binder, "Null Binder passed to createTransform");
|
Objects.requireNonNull(binder, "Null Binder passed to createTransform");
|
||||||
final int resourceId = mNextResourceId++;
|
final int resourceId = mNextResourceId++;
|
||||||
|
|
||||||
UserRecord userRecord = mUserResourceTracker.getUserRecord(Binder.getCallingUid());
|
UserRecord userRecord = mUserResourceTracker.getUserRecord(Binder.getCallingUid());
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import static android.location.LocationProvider.AVAILABLE;
|
|||||||
import static android.os.PowerManager.locationPowerSaveModeToString;
|
import static android.os.PowerManager.locationPowerSaveModeToString;
|
||||||
import static android.provider.Settings.Global.LOCATION_DISABLE_STATUS_CALLBACKS;
|
import static android.provider.Settings.Global.LOCATION_DISABLE_STATUS_CALLBACKS;
|
||||||
|
|
||||||
import static com.android.internal.util.Preconditions.checkNotNull;
|
|
||||||
import static com.android.internal.util.Preconditions.checkState;
|
import static com.android.internal.util.Preconditions.checkState;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
@@ -133,6 +132,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -986,7 +986,7 @@ public class LocationManagerService extends ILocationManager.Stub {
|
|||||||
|
|
||||||
@GuardedBy("mLock")
|
@GuardedBy("mLock")
|
||||||
public void attachLocked(AbstractLocationProvider provider) {
|
public void attachLocked(AbstractLocationProvider provider) {
|
||||||
checkNotNull(provider);
|
Objects.requireNonNull(provider);
|
||||||
checkState(mProvider == null);
|
checkState(mProvider == null);
|
||||||
|
|
||||||
if (D) {
|
if (D) {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import java.util.concurrent.BlockingQueue;
|
|||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic connector class for interfacing with a native daemon which uses the
|
* Generic connector class for interfacing with a native daemon which uses the
|
||||||
@@ -126,7 +127,7 @@ final class NativeDaemonConnector implements Runnable, Handler.Callback, Watchdo
|
|||||||
*/
|
*/
|
||||||
public void setWarnIfHeld(Object warnIfHeld) {
|
public void setWarnIfHeld(Object warnIfHeld) {
|
||||||
Preconditions.checkState(mWarnIfHeld == null);
|
Preconditions.checkState(mWarnIfHeld == null);
|
||||||
mWarnIfHeld = Preconditions.checkNotNull(warnIfHeld);
|
mWarnIfHeld = Objects.requireNonNull(warnIfHeld);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ import java.util.Arrays;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
@@ -458,7 +459,7 @@ public class NetworkManagementService extends INetworkManagementService.Stub {
|
|||||||
@Override
|
@Override
|
||||||
public void registerTetheringStatsProvider(ITetheringStatsProvider provider, String name) {
|
public void registerTetheringStatsProvider(ITetheringStatsProvider provider, String name) {
|
||||||
NetworkStack.checkNetworkStackPermission(mContext);
|
NetworkStack.checkNetworkStackPermission(mContext);
|
||||||
Preconditions.checkNotNull(provider);
|
Objects.requireNonNull(provider);
|
||||||
synchronized(mTetheringStatsProviders) {
|
synchronized(mTetheringStatsProviders) {
|
||||||
mTetheringStatsProviders.put(provider, name);
|
mTetheringStatsProviders.put(provider, name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1934,7 +1934,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
public void setVolumeNickname(String fsUuid, String nickname) {
|
public void setVolumeNickname(String fsUuid, String nickname) {
|
||||||
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
||||||
|
|
||||||
Preconditions.checkNotNull(fsUuid);
|
Objects.requireNonNull(fsUuid);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final VolumeRecord rec = mRecords.get(fsUuid);
|
final VolumeRecord rec = mRecords.get(fsUuid);
|
||||||
rec.nickname = nickname;
|
rec.nickname = nickname;
|
||||||
@@ -1947,7 +1947,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
public void setVolumeUserFlags(String fsUuid, int flags, int mask) {
|
public void setVolumeUserFlags(String fsUuid, int flags, int mask) {
|
||||||
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
||||||
|
|
||||||
Preconditions.checkNotNull(fsUuid);
|
Objects.requireNonNull(fsUuid);
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final VolumeRecord rec = mRecords.get(fsUuid);
|
final VolumeRecord rec = mRecords.get(fsUuid);
|
||||||
rec.userFlags = (rec.userFlags & ~mask) | (flags & mask);
|
rec.userFlags = (rec.userFlags & ~mask) | (flags & mask);
|
||||||
@@ -1960,7 +1960,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
public void forgetVolume(String fsUuid) {
|
public void forgetVolume(String fsUuid) {
|
||||||
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
enforcePermission(android.Manifest.permission.MOUNT_UNMOUNT_FILESYSTEMS);
|
||||||
|
|
||||||
Preconditions.checkNotNull(fsUuid);
|
Objects.requireNonNull(fsUuid);
|
||||||
|
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
final VolumeRecord rec = mRecords.remove(fsUuid);
|
final VolumeRecord rec = mRecords.remove(fsUuid);
|
||||||
@@ -2361,7 +2361,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMountedObbPath(String rawPath) {
|
public String getMountedObbPath(String rawPath) {
|
||||||
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
|
Objects.requireNonNull(rawPath, "rawPath cannot be null");
|
||||||
|
|
||||||
warnOnNotMounted();
|
warnOnNotMounted();
|
||||||
|
|
||||||
@@ -2379,7 +2379,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isObbMounted(String rawPath) {
|
public boolean isObbMounted(String rawPath) {
|
||||||
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
|
Objects.requireNonNull(rawPath, "rawPath cannot be null");
|
||||||
synchronized (mObbMounts) {
|
synchronized (mObbMounts) {
|
||||||
return mObbPathToStateMap.containsKey(rawPath);
|
return mObbPathToStateMap.containsKey(rawPath);
|
||||||
}
|
}
|
||||||
@@ -2388,10 +2388,10 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
public void mountObb(String rawPath, String canonicalPath, String key,
|
public void mountObb(String rawPath, String canonicalPath, String key,
|
||||||
IObbActionListener token, int nonce, ObbInfo obbInfo) {
|
IObbActionListener token, int nonce, ObbInfo obbInfo) {
|
||||||
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
|
Objects.requireNonNull(rawPath, "rawPath cannot be null");
|
||||||
Preconditions.checkNotNull(canonicalPath, "canonicalPath cannot be null");
|
Objects.requireNonNull(canonicalPath, "canonicalPath cannot be null");
|
||||||
Preconditions.checkNotNull(token, "token cannot be null");
|
Objects.requireNonNull(token, "token cannot be null");
|
||||||
Preconditions.checkNotNull(obbInfo, "obbIfno cannot be null");
|
Objects.requireNonNull(obbInfo, "obbIfno cannot be null");
|
||||||
|
|
||||||
final int callingUid = Binder.getCallingUid();
|
final int callingUid = Binder.getCallingUid();
|
||||||
final ObbState obbState = new ObbState(rawPath, canonicalPath,
|
final ObbState obbState = new ObbState(rawPath, canonicalPath,
|
||||||
@@ -2405,7 +2405,7 @@ class StorageManagerService extends IStorageManager.Stub
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void unmountObb(String rawPath, boolean force, IObbActionListener token, int nonce) {
|
public void unmountObb(String rawPath, boolean force, IObbActionListener token, int nonce) {
|
||||||
Preconditions.checkNotNull(rawPath, "rawPath cannot be null");
|
Objects.requireNonNull(rawPath, "rawPath cannot be null");
|
||||||
|
|
||||||
final ObbState existingState;
|
final ObbState existingState;
|
||||||
synchronized (mObbMounts) {
|
synchronized (mObbMounts) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import com.android.server.am.ActivityManagerService;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|||||||
Reference in New Issue
Block a user