Set up framework and service for Nearby module.
Files under framework/api are updated using
`build/soong/scripts/gen-java-current-api-files.sh
"packages/modules/Nearby/framework/api" system- module-lib- && m
update-api`. They are essentially empty as nearby platform APIs do not
exist yet.
Bug: 189355156
Test: mmm -j packages/modules/Nearby
Change-Id: I8df0e459a962b54cbd1a891f1fe2a1474f4cbc75
diff --git a/nearby/service/Android.bp b/nearby/service/Android.bp
new file mode 100644
index 0000000..5b026fa
--- /dev/null
+++ b/nearby/service/Android.bp
@@ -0,0 +1,57 @@
+// Copyright (C) 2021 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 {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+filegroup {
+ name: "nearby-service-srcs",
+ srcs: [
+ "java/**/*.java",
+ ],
+}
+
+// Main lib for nearby services.
+java_library {
+ name: "service-nearby",
+ srcs: [":nearby-service-srcs"],
+
+ defaults: [
+ "nearby-module-sdk-version-defaults",
+ "framework-system-server-module-defaults"
+ ],
+ libs: [
+ // pre-jarjar symbols are needed so that nearby-service can reference the original class
+ // names at compile time
+ "framework-nearby-pre-jarjar",
+ ],
+ sdk_version: "system_server_current",
+
+ installable: true,
+ optimize: {
+ enabled: true,
+ shrink: true,
+ },
+ dex_preopt: {
+ enabled: false,
+ app_image: false,
+ },
+ visibility: [
+ "//packages/modules/Nearby/apex",
+ ],
+ apex_available: [
+ "com.android.nearby",
+ ],
+}
\ No newline at end of file
diff --git a/nearby/service/java/com/android/server/nearby/NearbyService.java b/nearby/service/java/com/android/server/nearby/NearbyService.java
new file mode 100644
index 0000000..5647a4d
--- /dev/null
+++ b/nearby/service/java/com/android/server/nearby/NearbyService.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2021 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.nearby;
+
+import android.content.Context;
+
+import com.android.server.SystemService;
+
+/**
+ * Service implementing nearby functionality. The actual implementation is delegated to
+ * {@link NearbyDeviceScanServiceImpl}.
+ */
+// TODO(189954300): Implement nearby service.
+public class NearbyService extends SystemService {
+ private final NearbyServiceImpl mImpl;
+
+ public NearbyService(Context contextBase) {
+ super(contextBase);
+ mImpl = new NearbyServiceImpl(contextBase);
+ }
+
+ @Override
+ public void onStart() {
+ }
+
+ @Override
+ public void onBootPhase(int phase) {
+ }
+}
diff --git a/nearby/service/java/com/android/server/nearby/NearbyServiceImpl.java b/nearby/service/java/com/android/server/nearby/NearbyServiceImpl.java
new file mode 100644
index 0000000..959d12d
--- /dev/null
+++ b/nearby/service/java/com/android/server/nearby/NearbyServiceImpl.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2021 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.nearby;
+
+import android.content.Context;
+import android.nearby.INearbyManager;
+
+/**
+ * Implementation of {@link NearbyService}.
+ */
+public class NearbyServiceImpl extends INearbyManager.Stub {
+
+ public NearbyServiceImpl(Context context) {
+ }
+}