Create a stub for SupervisionService.

Test: adb shell dumpsys supervision
Change-Id: I63ee5b4fa46fac4ac285ea053fb168c24a43063c
Flag: android.app.supervision.flags.supervision_api
Bug: 336297680
Bug: 356895431
Bug: 356895439
diff --git a/services/Android.bp b/services/Android.bp
index 0006455..653cd3c3 100644
--- a/services/Android.bp
+++ b/services/Android.bp
@@ -136,6 +136,7 @@
         ":services.searchui-sources",
         ":services.smartspace-sources",
         ":services.soundtrigger-sources",
+        ":services.supervision-sources",
         ":services.systemcaptions-sources",
         ":services.translation-sources",
         ":services.texttospeech-sources",
@@ -237,6 +238,7 @@
         "services.searchui",
         "services.smartspace",
         "services.soundtrigger",
+        "services.supervision",
         "services.systemcaptions",
         "services.translation",
         "services.texttospeech",
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 09c54cb..7d90dda 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -256,6 +256,7 @@
 import com.android.server.stats.pull.StatsPullAtomService;
 import com.android.server.statusbar.StatusBarManagerService;
 import com.android.server.storage.DeviceStorageMonitorService;
+import com.android.server.supervision.SupervisionService;
 import com.android.server.systemcaptions.SystemCaptionsManagerService;
 import com.android.server.telecom.TelecomLoaderService;
 import com.android.server.testharness.TestHarnessModeService;
@@ -1597,6 +1598,12 @@
             mSystemServiceManager.startService(ROLE_SERVICE_CLASS);
             t.traceEnd();
 
+            if (android.app.supervision.flags.Flags.supervisionApi()) {
+                t.traceBegin("StartSupervisionService");
+                mSystemServiceManager.startService(SupervisionService.Lifecycle.class);
+                t.traceEnd();
+            }
+
             if (!isTv) {
                 t.traceBegin("StartVibratorManagerService");
                 mSystemServiceManager.startService(VibratorManagerService.Lifecycle.class);
diff --git a/services/supervision/Android.bp b/services/supervision/Android.bp
new file mode 100644
index 0000000..93a0c4a
--- /dev/null
+++ b/services/supervision/Android.bp
@@ -0,0 +1,22 @@
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "frameworks_base_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["frameworks_base_license"],
+}
+
+filegroup {
+    name: "services.supervision-sources",
+    srcs: ["java/**/*.java"],
+    path: "java",
+    visibility: ["//frameworks/base/services"],
+}
+
+java_library_static {
+    name: "services.supervision",
+    defaults: ["platform_service_defaults"],
+    srcs: [":services.supervision-sources"],
+    libs: ["services.core"],
+}
diff --git a/services/supervision/java/com/android/server/supervision/SupervisionService.java b/services/supervision/java/com/android/server/supervision/SupervisionService.java
new file mode 100644
index 0000000..a4ef629
--- /dev/null
+++ b/services/supervision/java/com/android/server/supervision/SupervisionService.java
@@ -0,0 +1,67 @@
+/*
+ * 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.supervision;
+
+import android.annotation.NonNull;
+import android.annotation.Nullable;
+import android.app.supervision.ISupervisionManager;
+import android.content.Context;
+
+
+import com.android.internal.util.DumpUtils;
+import com.android.server.SystemService;
+
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
+/** Service for handling system supervision. */
+public class SupervisionService extends ISupervisionManager.Stub {
+    private static final String LOG_TAG = "SupervisionService";
+
+    private final Context mContext;
+
+    public SupervisionService(Context context) {
+        mContext = context.createAttributionContext("SupervisionService");
+    }
+
+    @Override
+    public boolean isSupervisionEnabled() {
+        return false;
+    }
+
+    @Override
+    protected void dump(@NonNull FileDescriptor fd,
+            @NonNull PrintWriter fout, @Nullable String[] args) {
+        if (!DumpUtils.checkDumpPermission(mContext, LOG_TAG, fout)) return;
+
+        fout.println("Supervision enabled: " + isSupervisionEnabled());
+    }
+
+    public static class Lifecycle extends SystemService {
+        private final SupervisionService mSupervisionService;
+
+        public Lifecycle(@NonNull Context context) {
+            super(context);
+            mSupervisionService = new SupervisionService(context);
+        }
+
+        @Override
+        public void onStart() {
+            publishBinderService(Context.SUPERVISION_SERVICE, mSupervisionService);
+        }
+    }
+}