Add RemoteAuthService
Add RemoteAuthService APIs and Stubs (hide) for Settings of D2DA
This CL introduces new SystemApi allow user to discover remote devices
compatible to be registered as remote authenticators via RemoteAuthManager
Design doc: go/remote-auth-manager-fishfood-design
Test: built successfully.
Bug: 290092977
API-Coverage-Bug: 294934095
Change-Id: Iaaae1126065fdc3db469eeb8d85ac654b8199a12
diff --git a/remoteauth/service/Android.bp b/remoteauth/service/Android.bp
index 5c5a2fb..c3a9fb3 100644
--- a/remoteauth/service/Android.bp
+++ b/remoteauth/service/Android.bp
@@ -29,8 +29,24 @@
defaults: [
"framework-system-server-module-defaults"
],
- libs: [],
- static_libs: [],
+ libs: [
+ "androidx.annotation_annotation",
+ "framework-bluetooth",
+ "error_prone_annotations",
+ "framework-configinfrastructure",
+ "framework-connectivity-pre-jarjar",
+ "framework-connectivity-t-pre-jarjar",
+ "framework-statsd",
+ ],
+ static_libs: [
+ "libprotobuf-java-lite",
+ "fast-pair-lite-protos",
+ "modules-utils-build",
+ "modules-utils-handlerexecutor",
+ "modules-utils-preconditions",
+ "modules-utils-backgroundthread",
+ "presence-lite-protos",
+ ],
sdk_version: "system_server_current",
// This is included in service-connectivity which is 30+
// TODO (b/293613362): allow APEXes to have service jars with higher min_sdk than the APEX
diff --git a/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java b/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java
new file mode 100644
index 0000000..41ce89a
--- /dev/null
+++ b/remoteauth/service/java/com/android/server/remoteauth/RemoteAuthService.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2023 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.remoteauth;
+
+import android.annotation.Nullable;
+import android.annotation.UserIdInt;
+import android.content.Context;
+import android.remoteauth.IDeviceDiscoveryListener;
+import android.remoteauth.IRemoteAuthService;
+
+import com.android.internal.util.Preconditions;
+
+/** Service implementing remoteauth functionality. */
+public class RemoteAuthService extends IRemoteAuthService.Stub {
+ public static final String TAG = "RemoteAuthService";
+
+ public RemoteAuthService(Context context) {
+ Preconditions.checkNotNull(context);
+ // TODO(b/290280702): Create here RemoteConnectivityManager and RangingManager
+ }
+
+ @Override
+ public boolean isRemoteAuthSupported() {
+ // TODO(b/297301535): checkPermission(mContext, MANAGE_REMOTE_AUTH);
+ // TODO(b/290676192): integrate with RangingManager
+ // (check if UWB is supported by this device)
+ return true;
+ }
+
+ @Override
+ public boolean registerDiscoveryListener(
+ IDeviceDiscoveryListener deviceDiscoveryListener,
+ @UserIdInt int userId,
+ int timeoutMs,
+ String packageName,
+ @Nullable String attributionTag) {
+ // TODO(b/297301535): checkPermission(mContext, MANAGE_REMOTE_AUTH);
+ // TODO(b/290280702): implement register discovery logic
+ return true;
+ }
+
+ @Override
+ public void unregisterDiscoveryListener(
+ IDeviceDiscoveryListener deviceDiscoveryListener,
+ @UserIdInt int userId,
+ String packageName,
+ @Nullable String attributionTag) {
+ // TODO(b/297301535): checkPermission(mContext, MANAGE_REMOTE_AUTH);
+ // TODO(b/290094221): implement unregister logic
+ }
+
+ private static void checkPermission(Context context, String permission) {
+ context.enforceCallingOrSelfPermission(permission,
+ "Must have " + permission + " permission.");
+ }
+}