diff --git a/framework-t/Android.bp b/framework-t/Android.bp index dacdaf2b30a48eb7366cc2bc87983ed772bc2d56..5ae1ef9836fd2030055f19fd3c44860228844d64 100644 --- a/framework-t/Android.bp +++ b/framework-t/Android.bp @@ -19,6 +19,14 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } +framework_remoteauth_srcs = [":framework-remoteauth-java-sources"] +framework_remoteauth_api_srcs = [] + +java_defaults { + name: "enable-remoteauth-targets", + enabled: true, +} + // Include build rules from Sources.bp build = ["Sources.bp"] @@ -43,8 +51,7 @@ java_defaults { ":framework-connectivity-tiramisu-updatable-sources", ":framework-nearby-java-sources", ":framework-thread-sources", - ":framework-remoteauth-java-sources", - ], + ] + framework_remoteauth_srcs, libs: [ "unsupportedappusage", "app-compat-annotations", @@ -115,6 +122,7 @@ java_sdk_library { "framework-connectivity-t-defaults", "enable-framework-connectivity-t-targets", ], + api_srcs: framework_remoteauth_api_srcs, // Do not add static_libs to this library: put them in framework-connectivity instead. // The jarjar rules are only so that references to jarjared utils in // framework-connectivity-pre-jarjar match at runtime. diff --git a/remoteauth/service/Android.bp b/remoteauth/service/Android.bp index 2ba59da73cad6def274e4d6bdc562f3264cc4b77..a40dc1518c7220a44749218f35cc189488795884 100644 --- a/remoteauth/service/Android.bp +++ b/remoteauth/service/Android.bp @@ -27,6 +27,7 @@ java_library { srcs: [":remoteauth-service-srcs"], required: ["libremoteauth_jni_rust_defaults"], defaults: [ + "enable-remoteauth-targets", "framework-system-server-module-defaults", ], libs: [ diff --git a/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java b/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java index 41ce89aaf9aab258f21ceb5c2961cec14248bb87..9374ace3776c3887c815bc0843e26362bd4db671 100644 --- a/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java +++ b/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java @@ -27,6 +27,7 @@ import com.android.internal.util.Preconditions; /** Service implementing remoteauth functionality. */ public class RemoteAuthService extends IRemoteAuthService.Stub { public static final String TAG = "RemoteAuthService"; + public static final String SERVICE_NAME = Context.REMOTE_AUTH_SERVICE; public RemoteAuthService(Context context) { Preconditions.checkNotNull(context); diff --git a/remoteauth/tests/unit/Android.bp b/remoteauth/tests/unit/Android.bp index 4b92d847eb88dc9fcec72af2232904b1ae00ab7c..27e5418c1e186fc390e0bdb3515fbf5f7910a552 100644 --- a/remoteauth/tests/unit/Android.bp +++ b/remoteauth/tests/unit/Android.bp @@ -18,7 +18,10 @@ package { android_test { name: "RemoteAuthUnitTests", - defaults: ["mts-target-sdk-version-current"], + defaults: [ + "enable-remoteauth-targets", + "mts-target-sdk-version-current" + ], sdk_version: "test_current", min_sdk_version: "31", diff --git a/service-t/Android.bp b/service-t/Android.bp index 83caf35538eabe8dd938a66f7911f51d190ecac2..08527a35d2617ce10ae18d5191cf6788ad9d8d74 100644 --- a/service-t/Android.bp +++ b/service-t/Android.bp @@ -19,6 +19,8 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } +service_remoteauth_pre_jarjar_lib = "service-remoteauth-pre-jarjar" + // Include build rules from Sources.bp build = ["Sources.bp"] @@ -56,7 +58,7 @@ java_library { "service-connectivity-pre-jarjar", "service-nearby-pre-jarjar", "service-thread-pre-jarjar", - "service-remoteauth-pre-jarjar", + service_remoteauth_pre_jarjar_lib, "ServiceConnectivityResources", "unsupportedappusage", ], diff --git a/service-t/src/com/android/server/ConnectivityServiceInitializer.java b/service-t/src/com/android/server/ConnectivityServiceInitializer.java index 2da067a93ac11eb55411aa06b12ca1f84a50bc36..624c5df2b4f85a29e8700950414d5b0a2d3d2cc8 100644 --- a/service-t/src/com/android/server/ConnectivityServiceInitializer.java +++ b/service-t/src/com/android/server/ConnectivityServiceInitializer.java @@ -17,7 +17,6 @@ package com.android.server; import android.content.Context; -import android.remoteauth.RemoteAuthManager; import android.util.Log; import com.android.modules.utils.build.SdkLevel; @@ -90,8 +89,8 @@ public final class ConnectivityServiceInitializer extends SystemService { } if (mRemoteAuthService != null) { - Log.i(TAG, "Registering " + RemoteAuthManager.REMOTE_AUTH_SERVICE); - publishBinderService(RemoteAuthManager.REMOTE_AUTH_SERVICE, mRemoteAuthService, + Log.i(TAG, "Registering " + RemoteAuthService.SERVICE_NAME); + publishBinderService(RemoteAuthService.SERVICE_NAME, mRemoteAuthService, /* allowIsolated= */ false); } } @@ -157,8 +156,7 @@ public final class ConnectivityServiceInitializer extends SystemService { } catch (UnsupportedOperationException e) { // RemoteAuth is not yet supported in all branches // TODO: remove catch clause when it is available. - Log.i(TAG, "Skipping unsupported service " - + RemoteAuthManager.REMOTE_AUTH_SERVICE); + Log.i(TAG, "Skipping unsupported service " + RemoteAuthService.SERVICE_NAME); return null; } } diff --git a/service/Android.bp b/service/Android.bp index 9ae3d6c2a34d8d24a78c4a91e6cfdaf74deed5a5..8e59e8615e6e1f60b7bf216f27a83f402efe79ad 100644 --- a/service/Android.bp +++ b/service/Android.bp @@ -19,6 +19,12 @@ package { default_applicable_licenses: ["Android-Apache-2.0"], } +service_remoteauth_pre_jarjar_lib = "service-remoteauth-pre-jarjar" + +// The above variables may have different values +// depending on the branch, and this comment helps +// separate them from the rest of the file to avoid merge conflicts + aidl_interface { name: "connectivity_native_aidl_interface", local_include_dir: "binder", @@ -236,7 +242,7 @@ java_defaults { "service-connectivity-pre-jarjar", "service-connectivity-tiramisu-pre-jarjar", "service-nearby-pre-jarjar", - "service-remoteauth-pre-jarjar", + service_remoteauth_pre_jarjar_lib, "service-thread-pre-jarjar", ], // The below libraries are not actually needed to build since no source is compiled @@ -361,7 +367,7 @@ java_genrule { java_genrule { name: "service-remoteauth-jarjar-gen", tool_files: [ - ":service-remoteauth-pre-jarjar{.jar}", + ":" + service_remoteauth_pre_jarjar_lib + "{.jar}", "jarjar-excludes.txt", ], tools: [ @@ -369,7 +375,7 @@ java_genrule { ], out: ["service_remoteauth_jarjar_rules.txt"], cmd: "$(location jarjar-rules-generator) " + - "$(location :service-remoteauth-pre-jarjar{.jar}) " + + "$(location :" + service_remoteauth_pre_jarjar_lib + "{.jar}) " + "--prefix com.android.server.remoteauth " + "--excludes $(location jarjar-excludes.txt) " + "--output $(out)",