Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38d3867b authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN Committed by Automerger Merge Worker
Browse files

Merge "Add RequiresPermission to TestNetworkManager" am: 9641e340

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1669187

Change-Id: I3ea1379e439a1dfda99e9332275ea38efed86f4f
parents 4290766a 9641e340
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -158,10 +158,10 @@ package android.net {
  }

  public class TestNetworkManager {
    method @NonNull public android.net.TestNetworkInterface createTapInterface();
    method @NonNull public android.net.TestNetworkInterface createTunInterface(@NonNull java.util.Collection<android.net.LinkAddress>);
    method public void setupTestNetwork(@NonNull String, @NonNull android.os.IBinder);
    method public void teardownTestNetwork(@NonNull android.net.Network);
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_TEST_NETWORKS) public android.net.TestNetworkInterface createTapInterface();
    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_TEST_NETWORKS) public android.net.TestNetworkInterface createTunInterface(@NonNull java.util.Collection<android.net.LinkAddress>);
    method @RequiresPermission(android.Manifest.permission.MANAGE_TEST_NETWORKS) public void setupTestNetwork(@NonNull String, @NonNull android.os.IBinder);
    method @RequiresPermission(android.Manifest.permission.MANAGE_TEST_NETWORKS) public void teardownTestNetwork(@NonNull android.net.Network);
    field public static final String TEST_TAP_PREFIX = "testtap";
  }

+6 −0
Original line number Diff line number Diff line
@@ -15,8 +15,10 @@
 */
package android.net;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.RequiresPermission;
import android.annotation.SystemApi;
import android.os.IBinder;
import android.os.RemoteException;
@@ -58,6 +60,7 @@ public class TestNetworkManager {
     * @param network The test network that should be torn down
     * @hide
     */
    @RequiresPermission(Manifest.permission.MANAGE_TEST_NETWORKS)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public void teardownTestNetwork(@NonNull Network network) {
        try {
@@ -103,6 +106,7 @@ public class TestNetworkManager {
     * @param binder A binder object guarding the lifecycle of this test network.
     * @hide
     */
    @RequiresPermission(Manifest.permission.MANAGE_TEST_NETWORKS)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public void setupTestNetwork(@NonNull String iface, @NonNull IBinder binder) {
        setupTestNetwork(iface, null, true, new int[0], binder);
@@ -145,6 +149,7 @@ public class TestNetworkManager {
     *     TUN interface.
     * @hide
     */
    @RequiresPermission(Manifest.permission.MANAGE_TEST_NETWORKS)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    @NonNull
    public TestNetworkInterface createTunInterface(@NonNull Collection<LinkAddress> linkAddrs) {
@@ -163,6 +168,7 @@ public class TestNetworkManager {
     *     TAP interface.
     * @hide
     */
    @RequiresPermission(Manifest.permission.MANAGE_TEST_NETWORKS)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    @NonNull
    public TestNetworkInterface createTapInterface() {