Loading packages/Vcn/service-b/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ java_library { "framework-connectivity-t-pre-jarjar", "framework-connectivity-b-pre-jarjar", "framework-wifi.stubs.module_lib", "keepanno-annotations", "modules-utils-statemachine", "unsupportedappusage", ], Loading packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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 com.android.server; import android.content.Context; import android.util.Log; import com.android.tools.r8.keepanno.annotations.KeepItemKind; import com.android.tools.r8.keepanno.annotations.UsedByReflection; /** * Service initializer for VCN. This is called by system server to create a new instance of * VcnManagementService. */ // This class is reflectively invoked from SystemServer and ConnectivityServiceInitializer. // Without this annotation, this class will be treated as unused class and be removed during build // time. @UsedByReflection(kind = KeepItemKind.CLASS_AND_METHODS) public final class ConnectivityServiceInitializerB extends SystemService { private static final String TAG = ConnectivityServiceInitializerB.class.getSimpleName(); private final VcnManagementService mVcnManagementService; public ConnectivityServiceInitializerB(Context context) { super(context); mVcnManagementService = VcnManagementService.create(context); } @Override public void onStart() { if (mVcnManagementService != null) { Log.i(TAG, "Registering " + Context.VCN_MANAGEMENT_SERVICE); publishBinderService( Context.VCN_MANAGEMENT_SERVICE, mVcnManagementService, /* allowIsolated= */ false); } } @Override public void onBootPhase(int phase) { if (mVcnManagementService != null && phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { Log.i(TAG, "Starting " + Context.VCN_MANAGEMENT_SERVICE); mVcnManagementService.systemReady(); } } } services/Android.bp +0 −4 Original line number Diff line number Diff line Loading @@ -294,10 +294,6 @@ system_java_library { "service-permission.stubs.system_server", "service-rkp.stubs.system_server", "service-sdksandbox.stubs.system_server", // TODO: b/30242953 This is for accessing IVcnManagementService and // can be removed VCN is in mainline "framework-connectivity-b-pre-jarjar", ], soong_config_variables: { Loading services/java/com/android/server/SystemServer.java +6 −13 Original line number Diff line number Diff line Loading @@ -429,6 +429,8 @@ public final class SystemServer implements Dumpable { "/apex/com.android.tethering/javalib/service-connectivity.jar"; private static final String CONNECTIVITY_SERVICE_INITIALIZER_CLASS = "com.android.server.ConnectivityServiceInitializer"; private static final String CONNECTIVITY_SERVICE_INITIALIZER_B_CLASS = "com.android.server.ConnectivityServiceInitializerB"; private static final String NETWORK_STATS_SERVICE_INITIALIZER_CLASS = "com.android.server.NetworkStatsServiceInitializer"; private static final String UWB_APEX_SERVICE_JAR_PATH = Loading Loading @@ -1486,7 +1488,6 @@ public final class SystemServer implements Dumpable { IStorageManager storageManager = null; NetworkManagementService networkManagement = null; VpnManagerService vpnManager = null; VcnManagementService vcnManagement = null; NetworkPolicyManagerService networkPolicy = null; WindowManagerService wm = null; NetworkTimeUpdateService networkTimeUpdater = null; Loading Loading @@ -2232,8 +2233,10 @@ public final class SystemServer implements Dumpable { t.traceBegin("StartVcnManagementService"); try { vcnManagement = VcnManagementService.create(context); ServiceManager.addService(Context.VCN_MANAGEMENT_SERVICE, vcnManagement); // TODO: b/375213246 When VCN is in mainline module, load it from the apex path. // Whether VCN will be in apex or in the platform will be gated by a build system // flag. mSystemServiceManager.startService(CONNECTIVITY_SERVICE_INITIALIZER_B_CLASS); } catch (Throwable e) { reportWtf("starting VCN Management Service", e); } Loading Loading @@ -3159,7 +3162,6 @@ public final class SystemServer implements Dumpable { final MediaRouterService mediaRouterF = mediaRouter; final MmsServiceBroker mmsServiceF = mmsService; final VpnManagerService vpnManagerF = vpnManager; final VcnManagementService vcnManagementF = vcnManagement; final WindowManagerService windowManagerF = wm; final ConnectivityManager connectivityF = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); Loading Loading @@ -3286,15 +3288,6 @@ public final class SystemServer implements Dumpable { reportWtf("making VpnManagerService ready", e); } t.traceEnd(); t.traceBegin("MakeVcnManagementServiceReady"); try { if (vcnManagementF != null) { vcnManagementF.systemReady(); } } catch (Throwable e) { reportWtf("making VcnManagementService ready", e); } t.traceEnd(); t.traceBegin("MakeNetworkPolicyServiceReady"); try { if (networkPolicyF != null) { Loading Loading
packages/Vcn/service-b/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,7 @@ java_library { "framework-connectivity-t-pre-jarjar", "framework-connectivity-b-pre-jarjar", "framework-wifi.stubs.module_lib", "keepanno-annotations", "modules-utils-statemachine", "unsupportedappusage", ], Loading
packages/Vcn/service-b/src/com/android/server/ConnectivityServiceInitializerB.java 0 → 100644 +60 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 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 com.android.server; import android.content.Context; import android.util.Log; import com.android.tools.r8.keepanno.annotations.KeepItemKind; import com.android.tools.r8.keepanno.annotations.UsedByReflection; /** * Service initializer for VCN. This is called by system server to create a new instance of * VcnManagementService. */ // This class is reflectively invoked from SystemServer and ConnectivityServiceInitializer. // Without this annotation, this class will be treated as unused class and be removed during build // time. @UsedByReflection(kind = KeepItemKind.CLASS_AND_METHODS) public final class ConnectivityServiceInitializerB extends SystemService { private static final String TAG = ConnectivityServiceInitializerB.class.getSimpleName(); private final VcnManagementService mVcnManagementService; public ConnectivityServiceInitializerB(Context context) { super(context); mVcnManagementService = VcnManagementService.create(context); } @Override public void onStart() { if (mVcnManagementService != null) { Log.i(TAG, "Registering " + Context.VCN_MANAGEMENT_SERVICE); publishBinderService( Context.VCN_MANAGEMENT_SERVICE, mVcnManagementService, /* allowIsolated= */ false); } } @Override public void onBootPhase(int phase) { if (mVcnManagementService != null && phase == SystemService.PHASE_ACTIVITY_MANAGER_READY) { Log.i(TAG, "Starting " + Context.VCN_MANAGEMENT_SERVICE); mVcnManagementService.systemReady(); } } }
services/Android.bp +0 −4 Original line number Diff line number Diff line Loading @@ -294,10 +294,6 @@ system_java_library { "service-permission.stubs.system_server", "service-rkp.stubs.system_server", "service-sdksandbox.stubs.system_server", // TODO: b/30242953 This is for accessing IVcnManagementService and // can be removed VCN is in mainline "framework-connectivity-b-pre-jarjar", ], soong_config_variables: { Loading
services/java/com/android/server/SystemServer.java +6 −13 Original line number Diff line number Diff line Loading @@ -429,6 +429,8 @@ public final class SystemServer implements Dumpable { "/apex/com.android.tethering/javalib/service-connectivity.jar"; private static final String CONNECTIVITY_SERVICE_INITIALIZER_CLASS = "com.android.server.ConnectivityServiceInitializer"; private static final String CONNECTIVITY_SERVICE_INITIALIZER_B_CLASS = "com.android.server.ConnectivityServiceInitializerB"; private static final String NETWORK_STATS_SERVICE_INITIALIZER_CLASS = "com.android.server.NetworkStatsServiceInitializer"; private static final String UWB_APEX_SERVICE_JAR_PATH = Loading Loading @@ -1486,7 +1488,6 @@ public final class SystemServer implements Dumpable { IStorageManager storageManager = null; NetworkManagementService networkManagement = null; VpnManagerService vpnManager = null; VcnManagementService vcnManagement = null; NetworkPolicyManagerService networkPolicy = null; WindowManagerService wm = null; NetworkTimeUpdateService networkTimeUpdater = null; Loading Loading @@ -2232,8 +2233,10 @@ public final class SystemServer implements Dumpable { t.traceBegin("StartVcnManagementService"); try { vcnManagement = VcnManagementService.create(context); ServiceManager.addService(Context.VCN_MANAGEMENT_SERVICE, vcnManagement); // TODO: b/375213246 When VCN is in mainline module, load it from the apex path. // Whether VCN will be in apex or in the platform will be gated by a build system // flag. mSystemServiceManager.startService(CONNECTIVITY_SERVICE_INITIALIZER_B_CLASS); } catch (Throwable e) { reportWtf("starting VCN Management Service", e); } Loading Loading @@ -3159,7 +3162,6 @@ public final class SystemServer implements Dumpable { final MediaRouterService mediaRouterF = mediaRouter; final MmsServiceBroker mmsServiceF = mmsService; final VpnManagerService vpnManagerF = vpnManager; final VcnManagementService vcnManagementF = vcnManagement; final WindowManagerService windowManagerF = wm; final ConnectivityManager connectivityF = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); Loading Loading @@ -3286,15 +3288,6 @@ public final class SystemServer implements Dumpable { reportWtf("making VpnManagerService ready", e); } t.traceEnd(); t.traceBegin("MakeVcnManagementServiceReady"); try { if (vcnManagementF != null) { vcnManagementF.systemReady(); } } catch (Throwable e) { reportWtf("making VcnManagementService ready", e); } t.traceEnd(); t.traceBegin("MakeNetworkPolicyServiceReady"); try { if (networkPolicyF != null) { Loading