Add swapActiveStatsMap API for NetworkStatsFactory
This CL should be reverted before T sdk finalized. This API is temporary added for the NetworkStatsFactory which is platform code but will be moved into connectivity (tethering) mainline module. Bug: 209935649 Test: atest CtsHostsideNetworkTests Change-Id: I5894450f3089b2ea105722a18ddf8f1eed1c28a0
This commit is contained in:
@@ -26,6 +26,7 @@ package android.net {
|
|||||||
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void setRequireVpnForUids(boolean, @NonNull java.util.Collection<android.util.Range<java.lang.Integer>>);
|
method @RequiresPermission(anyOf={android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETTINGS}) public void setRequireVpnForUids(boolean, @NonNull java.util.Collection<android.util.Range<java.lang.Integer>>);
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_TEST_NETWORKS, android.Manifest.permission.NETWORK_STACK}) public void simulateDataStall(int, long, @NonNull android.net.Network, @NonNull android.os.PersistableBundle);
|
method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_TEST_NETWORKS, android.Manifest.permission.NETWORK_STACK}) public void simulateDataStall(int, long, @NonNull android.net.Network, @NonNull android.os.PersistableBundle);
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void startCaptivePortalApp(@NonNull android.net.Network);
|
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void startCaptivePortalApp(@NonNull android.net.Network);
|
||||||
|
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void swapActiveStatsMap();
|
||||||
method public void systemReady();
|
method public void systemReady();
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateFirewallRule(int, int, boolean);
|
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateFirewallRule(int, int, boolean);
|
||||||
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateMeteredNetworkAllowList(int, boolean);
|
method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK}) public void updateMeteredNetworkAllowList(int, boolean);
|
||||||
|
|||||||
@@ -5706,4 +5706,27 @@ public class ConnectivityManager {
|
|||||||
throw e.rethrowFromSystemServer();
|
throw e.rethrowFromSystemServer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request to change the current active network stats map.
|
||||||
|
* STOPSHIP: Remove this API before T sdk finalized, this API is temporary added for the
|
||||||
|
* NetworkStatsFactory which is platform code but will be moved into connectivity (tethering)
|
||||||
|
* mainline module.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if swap active stats map failed.
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
@SystemApi(client = MODULE_LIBRARIES)
|
||||||
|
@RequiresPermission(anyOf = {
|
||||||
|
android.Manifest.permission.NETWORK_SETTINGS,
|
||||||
|
android.Manifest.permission.NETWORK_STACK,
|
||||||
|
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK
|
||||||
|
})
|
||||||
|
public void swapActiveStatsMap() {
|
||||||
|
try {
|
||||||
|
mService.swapActiveStatsMap();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
throw e.rethrowFromSystemServer();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,4 +240,6 @@ interface IConnectivityManager
|
|||||||
void setFirewallChainEnabled(int chain, boolean enable);
|
void setFirewallChainEnabled(int chain, boolean enable);
|
||||||
|
|
||||||
void replaceFirewallChain(int chain, in int[] uids);
|
void replaceFirewallChain(int chain, in int[] uids);
|
||||||
|
|
||||||
|
void swapActiveStatsMap();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10660,4 +10660,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void swapActiveStatsMap() {
|
||||||
|
enforceNetworkStackOrSettingsPermission();
|
||||||
|
try {
|
||||||
|
mNetd.trafficSwapActiveStatsMap();
|
||||||
|
} catch (RemoteException | ServiceSpecificException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user