From facfd9a453e8da97c4a2a6498c335a645c0350b3 Mon Sep 17 00:00:00 2001 From: Yan Yan Date: Fri, 25 Oct 2024 14:40:14 -0700 Subject: Add VcnLocation to reflect the VCN build system flag value This patch defines VcnLocation.IS_VCN_IN_MAINLINE to reflect the value of the build system flag RELEASE_MOVE_VCN_TO_MAINLINE. Specifically two versions of VcnLocation file are defined. The build system flag controls which VcnLocation file will be built in to the platform. As results, the platform can read the value of IS_VCN_IN_MAINLINE to know the value of the build system flag. Bug: 375213246 Test: build-flag set RELEASE_MOVE_VCN_TO_MAINLINE and verified IS_VCN_IN_MAINLINE value Flag: RELEASE_MOVE_VCN_TO_MAINLINE Change-Id: I550fe1cc8a582b672281fd816804726a56531ca4 --- packages/Vcn/service-b/Android.bp | 13 +++++++++ .../module/com/android/server/vcn/VcnLocation.java | 31 +++++++++++++++++++++ .../com/android/server/vcn/VcnLocation.java | 32 ++++++++++++++++++++++ 3 files changed, 76 insertions(+) create mode 100644 packages/Vcn/service-b/vcn-location-flag/module/com/android/server/vcn/VcnLocation.java create mode 100644 packages/Vcn/service-b/vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java diff --git a/packages/Vcn/service-b/Android.bp b/packages/Vcn/service-b/Android.bp index a462297c07af..03ef4e67af1c 100644 --- a/packages/Vcn/service-b/Android.bp +++ b/packages/Vcn/service-b/Android.bp @@ -19,6 +19,19 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } +filegroup { + name: "vcn-location-sources", + srcs: select(release_flag("RELEASE_MOVE_VCN_TO_MAINLINE"), { + true: [ + "vcn-location-flag/module/com/android/server/vcn/VcnLocation.java", + ], + default: [ + "vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java", + ], + }), + visibility: ["//frameworks/base/services/core"], +} + java_library { name: "service-connectivity-b-pre-jarjar", sdk_version: "system_server_current", diff --git a/packages/Vcn/service-b/vcn-location-flag/module/com/android/server/vcn/VcnLocation.java b/packages/Vcn/service-b/vcn-location-flag/module/com/android/server/vcn/VcnLocation.java new file mode 100644 index 000000000000..6c7d24db8bac --- /dev/null +++ b/packages/Vcn/service-b/vcn-location-flag/module/com/android/server/vcn/VcnLocation.java @@ -0,0 +1,31 @@ +/* + * 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.vcn; + +/** + * Class to represent that VCN is in a mainline module + * + *

This class is used to check whether VCN is in the non-updatable platform or in a mainline + * module. + */ +// When VCN is in a mainline module, this class (module/com/android/server/vcn/VcnLocation.java) +// will be built in to the vcn-location-sources filegroup. When VCN is in the non-updatable +// platform, platform/com/android/server/vcn/VcnLocation.java will be built in to the filegroup +public class VcnLocation { + /** Indicate that VCN is the platform */ + public static final boolean IS_VCN_IN_MAINLINE = true; +} diff --git a/packages/Vcn/service-b/vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java b/packages/Vcn/service-b/vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java new file mode 100644 index 000000000000..c6c82a55de0f --- /dev/null +++ b/packages/Vcn/service-b/vcn-location-flag/platform/com/android/server/vcn/VcnLocation.java @@ -0,0 +1,32 @@ +/* + * 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.vcn; + +/** + * Class to represent that VCN is in the platform + * + *

This class is used to check whether VCN is in the non-updatable platform or in a mainline + * module. + */ +// When VCN is in a mainline module, module/com/android/server/vcn/VcnLocation.java +// will be built in to the vcn-location-sources filegroup. When VCN is in the non-updatable +// platform, this class (platform/com/android/server/vcn/VcnLocation.java) will be built in to the +// filegroup +public class VcnLocation { + /** Indicate that VCN is the platform */ + public static final boolean IS_VCN_IN_MAINLINE = false; +} -- cgit v1.2.3-59-g8ed1b