Merge "Prevent VCN service from being registered twice" into main am: 8c9ae9dbdc am: 37b0be00ba
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/3511351 Change-Id: I39ac77c2b34f465aecdf461db96c239fa4aa415b Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
e6ee9546b4
2 changed files with 23 additions and 2 deletions
|
|
@ -29,7 +29,10 @@ filegroup {
|
|||
"vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java",
|
||||
],
|
||||
}),
|
||||
visibility: ["//frameworks/base/services/core"],
|
||||
visibility: [
|
||||
"//frameworks/base/services/core",
|
||||
"//packages/modules/Connectivity/service-t",
|
||||
],
|
||||
}
|
||||
|
||||
// TODO: b/374174952 This library is only used in "service-connectivity-b-platform"
|
||||
|
|
|
|||
|
|
@ -37,9 +37,27 @@ public final class ConnectivityServiceInitializerB extends SystemService {
|
|||
private static final String TAG = ConnectivityServiceInitializerB.class.getSimpleName();
|
||||
private final VcnManagementService mVcnManagementService;
|
||||
|
||||
// STOPSHIP: b/385203616 This static flag is for handling a temporary case when the mainline
|
||||
// module prebuilt has updated to register the VCN but the platform change to remove
|
||||
// registration is not merged. After mainline prebuilt is updated, we should merge the platform
|
||||
// ASAP and remove this static check. This check is safe because both mainline and platform
|
||||
// registration are triggered from the same method on the same thread.
|
||||
private static boolean sIsRegistered = false;
|
||||
|
||||
public ConnectivityServiceInitializerB(Context context) {
|
||||
super(context);
|
||||
mVcnManagementService = VcnManagementService.create(context);
|
||||
|
||||
if (!sIsRegistered) {
|
||||
mVcnManagementService = VcnManagementService.create(context);
|
||||
sIsRegistered = true;
|
||||
} else {
|
||||
mVcnManagementService = null;
|
||||
Log.e(
|
||||
TAG,
|
||||
"Ignore this registration since VCN is already registered. It will happen when"
|
||||
+ " the mainline module prebuilt has updated to register the VCN but the"
|
||||
+ " platform change to remove registration is not merged.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Reference in a new issue