Merge "Rename getAllNetworkStateSnapshot which should be pluralized"

This commit is contained in:
Treehugger Robot
2021-04-29 04:40:51 +00:00
committed by Gerrit Code Review
7 changed files with 20 additions and 20 deletions

View File

@@ -7,7 +7,7 @@ package android.net {
public class ConnectivityManager {
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void factoryReset();
method @NonNull @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public java.util.List<android.net.NetworkStateSnapshot> getAllNetworkStateSnapshot();
method @NonNull @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public java.util.List<android.net.NetworkStateSnapshot> getAllNetworkStateSnapshots();
method @Nullable public android.net.ProxyInfo getGlobalProxy();
method @NonNull public static android.util.Range<java.lang.Integer> getIpSecNetIdRange();
method @NonNull public static String getPrivateDnsMode(@NonNull android.content.Context);

View File

@@ -1435,9 +1435,9 @@ public class ConnectivityManager {
android.Manifest.permission.NETWORK_STACK,
android.Manifest.permission.NETWORK_SETTINGS})
@NonNull
public List<NetworkStateSnapshot> getAllNetworkStateSnapshot() {
public List<NetworkStateSnapshot> getAllNetworkStateSnapshots() {
try {
return mService.getAllNetworkStateSnapshot();
return mService.getAllNetworkStateSnapshots();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}

View File

@@ -81,7 +81,7 @@ interface IConnectivityManager
@UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553)
NetworkState[] getAllNetworkState();
List<NetworkStateSnapshot> getAllNetworkStateSnapshot();
List<NetworkStateSnapshot> getAllNetworkStateSnapshots();
boolean isActiveNetworkMetered();

View File

@@ -2176,7 +2176,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
PermissionUtils.enforceNetworkStackPermission(mContext);
final ArrayList<NetworkState> result = new ArrayList<>();
for (NetworkStateSnapshot snapshot : getAllNetworkStateSnapshot()) {
for (NetworkStateSnapshot snapshot : getAllNetworkStateSnapshots()) {
// NetworkStateSnapshot doesn't contain NetworkInfo, so need to fetch it from the
// NetworkAgentInfo.
final NetworkAgentInfo nai = getNetworkAgentInfoForNetwork(snapshot.network);
@@ -2191,7 +2191,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
@Override
@NonNull
public List<NetworkStateSnapshot> getAllNetworkStateSnapshot() {
public List<NetworkStateSnapshot> getAllNetworkStateSnapshots() {
// This contains IMSI details, so make sure the caller is privileged.
PermissionUtils.enforceNetworkStackPermission(mContext);

View File

@@ -1995,7 +1995,7 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub {
if (LOGV) Slog.v(TAG, "updateNetworkRulesNL()");
Trace.traceBegin(TRACE_TAG_NETWORK, "updateNetworkRulesNL");
final List<NetworkStateSnapshot> snapshots = mConnManager.getAllNetworkStateSnapshot();
final List<NetworkStateSnapshot> snapshots = mConnManager.getAllNetworkStateSnapshots();
// First, generate identities of all connected networks so we can
// quickly compare them against all defined policies below.

View File

@@ -1091,7 +1091,7 @@ public class NetworkPolicyManagerServiceTest {
// first, pretend that wifi network comes online. no policy active,
// which means we shouldn't push limit to interface.
snapshots = List.of(buildWifi());
when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
mPolicyListener.expect().onMeteredIfacesChanged(any());
mServiceContext.sendBroadcast(new Intent(CONNECTIVITY_ACTION));
@@ -1099,7 +1099,7 @@ public class NetworkPolicyManagerServiceTest {
// now change cycle to be on 15th, and test in early march, to verify we
// pick cycle day in previous month.
when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
// pretend that 512 bytes total have happened
stats = new NetworkStats(getElapsedRealtime(), 1)
@@ -1360,7 +1360,7 @@ public class NetworkPolicyManagerServiceTest {
.insertEntry(TEST_IFACE, 0L, 0L, 0L, 0L);
{
when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
when(mStatsService.getNetworkTotalBytes(sTemplateWifi, TIME_FEB_15,
currentTimeMillis())).thenReturn(stats.getTotalBytes());
@@ -1483,7 +1483,7 @@ public class NetworkPolicyManagerServiceTest {
}
private PersistableBundle setupUpdateMobilePolicyCycleTests() throws RemoteException {
when(mConnManager.getAllNetworkStateSnapshot())
when(mConnManager.getAllNetworkStateSnapshots())
.thenReturn(new ArrayList<NetworkStateSnapshot>());
setupTelephonySubscriptionManagers(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
@@ -1496,7 +1496,7 @@ public class NetworkPolicyManagerServiceTest {
@Test
public void testUpdateMobilePolicyCycleWithNullConfig() throws RemoteException {
when(mConnManager.getAllNetworkStateSnapshot())
when(mConnManager.getAllNetworkStateSnapshots())
.thenReturn(new ArrayList<NetworkStateSnapshot>());
setupTelephonySubscriptionManagers(FAKE_SUB_ID, FAKE_SUBSCRIBER_ID);
@@ -2089,7 +2089,7 @@ public class NetworkPolicyManagerServiceTest {
new Network(TEST_NET_ID),
buildNetworkCapabilities(TEST_SUB_ID, roaming),
buildLinkProperties(TEST_IFACE), TEST_IMSI, TYPE_MOBILE));
when(mConnManager.getAllNetworkStateSnapshot()).thenReturn(snapshots);
when(mConnManager.getAllNetworkStateSnapshots()).thenReturn(snapshots);
}
private void expectDefaultCarrierConfig() throws Exception {

View File

@@ -1804,7 +1804,7 @@ public class ConnectivityServiceTest {
assertNull(mCm.getActiveNetworkForUid(Process.myUid()));
// Test getAllNetworks()
assertEmpty(mCm.getAllNetworks());
assertEmpty(mCm.getAllNetworkStateSnapshot());
assertEmpty(mCm.getAllNetworkStateSnapshots());
}
/**
@@ -11742,7 +11742,7 @@ public class ConnectivityServiceTest {
}
@Test
public void testGetAllNetworkStateSnapshot() throws Exception {
public void testGetAllNetworkStateSnapshots() throws Exception {
verifyNoNetwork();
// Setup test cellular network with specified LinkProperties and NetworkCapabilities,
@@ -11766,7 +11766,7 @@ public class ConnectivityServiceTest {
mCellNetworkAgent = new TestNetworkAgentWrapper(TRANSPORT_CELLULAR, cellLp, cellNcTemplate);
mCellNetworkAgent.connect(true);
cellCb.expectAvailableCallbacksUnvalidated(mCellNetworkAgent);
List<NetworkStateSnapshot> snapshots = mCm.getAllNetworkStateSnapshot();
List<NetworkStateSnapshot> snapshots = mCm.getAllNetworkStateSnapshots();
assertLength(1, snapshots);
// Compose the expected cellular snapshot for verification.
@@ -11788,7 +11788,7 @@ public class ConnectivityServiceTest {
mWiFiNetworkAgent.getNetwork(), wifiNc, new LinkProperties(), null,
ConnectivityManager.TYPE_WIFI);
snapshots = mCm.getAllNetworkStateSnapshot();
snapshots = mCm.getAllNetworkStateSnapshots();
assertLength(2, snapshots);
assertContainsAll(snapshots, cellSnapshot, wifiSnapshot);
@@ -11797,20 +11797,20 @@ public class ConnectivityServiceTest {
// temporary shortage of connectivity of a connected network.
mCellNetworkAgent.suspend();
waitForIdle();
snapshots = mCm.getAllNetworkStateSnapshot();
snapshots = mCm.getAllNetworkStateSnapshots();
assertLength(1, snapshots);
assertEquals(wifiSnapshot, snapshots.get(0));
// Disconnect wifi, verify the snapshots contain nothing.
mWiFiNetworkAgent.disconnect();
waitForIdle();
snapshots = mCm.getAllNetworkStateSnapshot();
snapshots = mCm.getAllNetworkStateSnapshots();
assertEquals(mCellNetworkAgent.getNetwork(), mCm.getActiveNetwork());
assertLength(0, snapshots);
mCellNetworkAgent.resume();
waitForIdle();
snapshots = mCm.getAllNetworkStateSnapshot();
snapshots = mCm.getAllNetworkStateSnapshots();
assertLength(1, snapshots);
assertEquals(cellSnapshot, snapshots.get(0));