summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorBenedict Wong <benedictwong@google.com>2020-10-29 23:20:36 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-10-29 23:20:36 +0000
commit76062fa471bb64d285ef8e1487fc68c3383d3d73 (patch)
treebd63518a067552592530f394c99db9741fdb0cd6 /core/java
parenta401308ab76fb706dafcd33bc41ed1747004add3 (diff)
parent3eda5ec4f9bc8c7a17992e3fe0181ce4b8cc4670 (diff)
Merge "Add shell VcnManagementService" am: fa2c588ab5 am: 1ee8f22e8a am: e0eb89cf66 am: 3eda5ec4f9
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1456942 Change-Id: Ib6d081351c2440945d094e7e97433f1e91e1fa8b
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/app/SystemServiceRegistry.java10
-rw-r--r--core/java/android/content/Context.java11
-rw-r--r--core/java/android/net/vcn/IVcnManagementService.aidl23
-rw-r--r--core/java/android/net/vcn/VcnManager.java48
4 files changed, 92 insertions, 0 deletions
diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java
index 4b3bebe36c29..73777909d417 100644
--- a/core/java/android/app/SystemServiceRegistry.java
+++ b/core/java/android/app/SystemServiceRegistry.java
@@ -136,6 +136,8 @@ import android.net.lowpan.ILowpanManager;
import android.net.lowpan.LowpanManager;
import android.net.nsd.INsdManager;
import android.net.nsd.NsdManager;
+import android.net.vcn.IVcnManagementService;
+import android.net.vcn.VcnManager;
import android.net.wifi.WifiFrameworkInitializer;
import android.net.wifi.nl80211.WifiNl80211Manager;
import android.nfc.NfcManager;
@@ -385,6 +387,14 @@ public final class SystemServiceRegistry {
ctx, () -> ServiceManager.getService(Context.TETHERING_SERVICE));
}});
+ registerService(Context.VCN_MANAGEMENT_SERVICE, VcnManager.class,
+ new CachedServiceFetcher<VcnManager>() {
+ @Override
+ public VcnManager createService(ContextImpl ctx) throws ServiceNotFoundException {
+ IBinder b = ServiceManager.getService(Context.VCN_MANAGEMENT_SERVICE);
+ IVcnManagementService service = IVcnManagementService.Stub.asInterface(b);
+ return new VcnManager(ctx, service);
+ }});
registerService(Context.IPSEC_SERVICE, IpSecManager.class,
new CachedServiceFetcher<IpSecManager>() {
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 1d7a54c3021c..46d4f222a6b4 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -3416,6 +3416,7 @@ public abstract class Context {
VIBRATOR_SERVICE,
//@hide: STATUS_BAR_SERVICE,
CONNECTIVITY_SERVICE,
+ VCN_MANAGEMENT_SERVICE,
//@hide: IP_MEMORY_STORE_SERVICE,
IPSEC_SERVICE,
VPN_MANAGEMENT_SERVICE,
@@ -3995,6 +3996,16 @@ public abstract class Context {
public static final String CONNECTIVITY_SERVICE = "connectivity";
/**
+ * Use with {@link #getSystemService(String)} to retrieve a {@link android.net.vcn.VcnManager}
+ * for managing Virtual Carrier Networks
+ *
+ * @see #getSystemService(String)
+ * @see android.net.vcn.VcnManager
+ * @hide
+ */
+ public static final String VCN_MANAGEMENT_SERVICE = "vcn_management";
+
+ /**
* Use with {@link #getSystemService(String)} to retrieve a
* {@link android.net.INetd} for communicating with the network stack
* @hide
diff --git a/core/java/android/net/vcn/IVcnManagementService.aidl b/core/java/android/net/vcn/IVcnManagementService.aidl
new file mode 100644
index 000000000000..af06906ca2e9
--- /dev/null
+++ b/core/java/android/net/vcn/IVcnManagementService.aidl
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2020, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.vcn;
+
+/**
+ * @hide
+ */
+interface IVcnManagementService {
+}
diff --git a/core/java/android/net/vcn/VcnManager.java b/core/java/android/net/vcn/VcnManager.java
new file mode 100644
index 000000000000..d563b0350187
--- /dev/null
+++ b/core/java/android/net/vcn/VcnManager.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.net.vcn;
+
+import static java.util.Objects.requireNonNull;
+
+import android.annotation.NonNull;
+import android.annotation.SystemService;
+import android.content.Context;
+
+/**
+ * VcnManager publishes APIs for applications to configure and manage Virtual Carrier Networks
+ *
+ * @hide
+ */
+@SystemService(Context.VCN_MANAGEMENT_SERVICE)
+public final class VcnManager {
+ @NonNull private static final String TAG = VcnManager.class.getSimpleName();
+
+ @NonNull private final Context mContext;
+ @NonNull private final IVcnManagementService mService;
+
+ /**
+ * Construct an instance of VcnManager within an application context.
+ *
+ * @param ctx the application context for this manager
+ * @param service the VcnManagementService binder backing this manager
+ *
+ * @hide
+ */
+ public VcnManager(@NonNull Context ctx, @NonNull IVcnManagementService service) {
+ mContext = requireNonNull(ctx, "missing context");
+ mService = requireNonNull(service, "missing service");
+ }
+}