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

Commit ed4f59e2 authored by Benedict Wong's avatar Benedict Wong Committed by android-build-merger
Browse files

Merge changes I98573a5c,Ic7394f24

am: c6ce6fc8

Change-Id: I2ffeb6ef1a19f7b2982c3631fe2c040024fb53cb
parents bd952711 c6ce6fc8
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -324,7 +324,7 @@ final class SystemServiceRegistry {
                            throw new ServiceNotFoundException(Context.TEST_NETWORK_SERVICE);
                            throw new ServiceNotFoundException(Context.TEST_NETWORK_SERVICE);
                        }
                        }
                        ITestNetworkManager tnMgr = ITestNetworkManager.Stub.asInterface(tnBinder);
                        ITestNetworkManager tnMgr = ITestNetworkManager.Stub.asInterface(tnBinder);
                        return new TestNetworkManager(context, tnMgr);
                        return new TestNetworkManager(tnMgr);
                    }
                    }
                });
                });


+0 −2
Original line number Original line Diff line number Diff line
@@ -27,8 +27,6 @@ import android.os.Parcelable;
 */
 */
@TestApi
@TestApi
public final class TestNetworkInterface implements Parcelable {
public final class TestNetworkInterface implements Parcelable {
    private static final String TAG = "TestNetworkInterface";

    private final ParcelFileDescriptor mFileDescriptor;
    private final ParcelFileDescriptor mFileDescriptor;
    private final String mInterfaceName;
    private final String mInterfaceName;


+1 −4
Original line number Original line Diff line number Diff line
@@ -17,7 +17,6 @@ package android.net;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.TestApi;
import android.annotation.TestApi;
import android.content.Context;
import android.os.IBinder;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.RemoteException;


@@ -33,11 +32,9 @@ public class TestNetworkManager {
    @NonNull private static final String TAG = TestNetworkManager.class.getSimpleName();
    @NonNull private static final String TAG = TestNetworkManager.class.getSimpleName();


    @NonNull private final ITestNetworkManager mService;
    @NonNull private final ITestNetworkManager mService;
    @NonNull private final Context mContext;


    /** @hide */
    /** @hide */
    public TestNetworkManager(@NonNull Context context, @NonNull ITestNetworkManager service) {
    public TestNetworkManager(@NonNull ITestNetworkManager service) {
        mContext = Preconditions.checkNotNull(context, "missing Context");
        mService = Preconditions.checkNotNull(service, "missing ITestNetworkManager");
        mService = Preconditions.checkNotNull(service, "missing ITestNetworkManager");
    }
    }


+4 −8
Original line number Original line Diff line number Diff line
@@ -310,7 +310,7 @@ class TestNetworkService extends ITestNetworkManager.Stub {
    public void teardownTestNetwork(int netId) {
    public void teardownTestNetwork(int netId) {
        enforceTestNetworkPermissions(mContext);
        enforceTestNetworkPermissions(mContext);


        TestNetworkAgent agent;
        final TestNetworkAgent agent;
        synchronized (mTestNetworkTracker) {
        synchronized (mTestNetworkTracker) {
            agent = mTestNetworkTracker.get(netId);
            agent = mTestNetworkTracker.get(netId);
        }
        }
@@ -325,14 +325,10 @@ class TestNetworkService extends ITestNetworkManager.Stub {
        agent.teardown();
        agent.teardown();
    }
    }


    // STOPSHIP: Change this back to android.Manifest.permission.MANAGE_TEST_NETWORKS
    private static final String PERMISSION_NAME =
    private static final String PERMISSION_NAME = "dummy";
            android.Manifest.permission.MANAGE_TEST_NETWORKS;


    public static void enforceTestNetworkPermissions(@NonNull Context context) {
    public static void enforceTestNetworkPermissions(@NonNull Context context) {
        // STOPSHIP: Re-enable these checks. Disabled until adoptShellPermissionIdentity() can be
        //           called from CTS test code.
        if (false) {
        context.enforceCallingOrSelfPermission(PERMISSION_NAME, "TestNetworkService");
        context.enforceCallingOrSelfPermission(PERMISSION_NAME, "TestNetworkService");
    }
    }
}
}
}