Loading AconfigFlags.bp +16 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ aconfig_declarations_group { "android.app.flags-aconfig-java", "android.app.ondeviceintelligence-aconfig-java", "android.app.smartspace.flags-aconfig-java", "android.app.supervision.flags-aconfig-java", "android.app.usage.flags-aconfig-java", "android.app.wearable.flags-aconfig-java", "android.appwidget.flags-aconfig-java", Loading Loading @@ -1212,6 +1213,21 @@ java_aconfig_library { defaults: ["framework-minus-apex-aconfig-java-defaults"], } // Supervision aconfig_declarations { name: "android.app.supervision.flags-aconfig", exportable: true, package: "android.app.supervision.flags", container: "system", srcs: ["core/java/android/app/supervision/flags.aconfig"], } java_aconfig_library { name: "android.app.supervision.flags-aconfig-java", aconfig_declarations: "android.app.supervision.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], } // SurfaceFlinger java_aconfig_library { name: "surfaceflinger_flags_java_lib", Loading core/java/android/app/SystemServiceRegistry.java +17 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ import android.app.sdksandbox.SdkSandboxManagerFrameworkInitializer; import android.app.search.SearchUiManager; import android.app.slice.SliceManager; import android.app.smartspace.SmartspaceManager; import android.app.supervision.ISupervisionManager; import android.app.supervision.SupervisionManager; import android.app.time.TimeManager; import android.app.timedetector.TimeDetector; import android.app.timedetector.TimeDetectorImpl; Loading Loading @@ -1703,6 +1705,21 @@ public final class SystemServiceRegistry { return new E2eeContactKeysManager(ctx); }}); registerService(Context.SUPERVISION_SERVICE, SupervisionManager.class, new CachedServiceFetcher<>() { @Override public SupervisionManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!android.app.supervision.flags.Flags.supervisionApi()) { throw new ServiceNotFoundException( "SupervisionManager is not supported"); } IBinder iBinder = ServiceManager.getServiceOrThrow( Context.SUPERVISION_SERVICE); ISupervisionManager service = ISupervisionManager.Stub.asInterface(iBinder); return new SupervisionManager(ctx, service); } }); // DO NOT do a flag check like this unless the flag is read-only. // (because this code is executed during preload in zygote.) // If the flag is mutable, the check should be inside CachedServiceFetcher. Loading core/java/android/app/supervision/ISupervisionManager.aidl 0 → 100644 +25 −0 Original line number Diff line number Diff line /** * 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 android.app.supervision; /** * Internal IPC interface to the supervision service. * {@hide} */ interface ISupervisionManager { boolean isSupervisionEnabled(); } core/java/android/app/supervision/SupervisionManager.java 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * 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 android.app.supervision; import android.annotation.SystemService; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.os.RemoteException; /** * Service for handling parental supervision. * * @hide */ @SystemService(Context.SUPERVISION_SERVICE) public class SupervisionManager { private final Context mContext; private final ISupervisionManager mService; /** * @hide */ @UnsupportedAppUsage public SupervisionManager(Context context, ISupervisionManager service) { mContext = context; mService = service; } /** * Returns whether the device is supervised. * * @hide */ public boolean isSupervisionEnabled() { try { return mService.isSupervisionEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } } core/java/android/app/supervision/flags.aconfig 0 → 100644 +10 −0 Original line number Diff line number Diff line package: "android.app.supervision.flags" container: "system" flag { name: "supervision_api" is_exported: true namespace: "supervision" description: "Flag to enable the SupervisionService" bug: "340351729" } No newline at end of file Loading
AconfigFlags.bp +16 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ aconfig_declarations_group { "android.app.flags-aconfig-java", "android.app.ondeviceintelligence-aconfig-java", "android.app.smartspace.flags-aconfig-java", "android.app.supervision.flags-aconfig-java", "android.app.usage.flags-aconfig-java", "android.app.wearable.flags-aconfig-java", "android.appwidget.flags-aconfig-java", Loading Loading @@ -1212,6 +1213,21 @@ java_aconfig_library { defaults: ["framework-minus-apex-aconfig-java-defaults"], } // Supervision aconfig_declarations { name: "android.app.supervision.flags-aconfig", exportable: true, package: "android.app.supervision.flags", container: "system", srcs: ["core/java/android/app/supervision/flags.aconfig"], } java_aconfig_library { name: "android.app.supervision.flags-aconfig-java", aconfig_declarations: "android.app.supervision.flags-aconfig", defaults: ["framework-minus-apex-aconfig-java-defaults"], } // SurfaceFlinger java_aconfig_library { name: "surfaceflinger_flags_java_lib", Loading
core/java/android/app/SystemServiceRegistry.java +17 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,8 @@ import android.app.sdksandbox.SdkSandboxManagerFrameworkInitializer; import android.app.search.SearchUiManager; import android.app.slice.SliceManager; import android.app.smartspace.SmartspaceManager; import android.app.supervision.ISupervisionManager; import android.app.supervision.SupervisionManager; import android.app.time.TimeManager; import android.app.timedetector.TimeDetector; import android.app.timedetector.TimeDetectorImpl; Loading Loading @@ -1703,6 +1705,21 @@ public final class SystemServiceRegistry { return new E2eeContactKeysManager(ctx); }}); registerService(Context.SUPERVISION_SERVICE, SupervisionManager.class, new CachedServiceFetcher<>() { @Override public SupervisionManager createService(ContextImpl ctx) throws ServiceNotFoundException { if (!android.app.supervision.flags.Flags.supervisionApi()) { throw new ServiceNotFoundException( "SupervisionManager is not supported"); } IBinder iBinder = ServiceManager.getServiceOrThrow( Context.SUPERVISION_SERVICE); ISupervisionManager service = ISupervisionManager.Stub.asInterface(iBinder); return new SupervisionManager(ctx, service); } }); // DO NOT do a flag check like this unless the flag is read-only. // (because this code is executed during preload in zygote.) // If the flag is mutable, the check should be inside CachedServiceFetcher. Loading
core/java/android/app/supervision/ISupervisionManager.aidl 0 → 100644 +25 −0 Original line number Diff line number Diff line /** * 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 android.app.supervision; /** * Internal IPC interface to the supervision service. * {@hide} */ interface ISupervisionManager { boolean isSupervisionEnabled(); }
core/java/android/app/supervision/SupervisionManager.java 0 → 100644 +57 −0 Original line number Diff line number Diff line /* * 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 android.app.supervision; import android.annotation.SystemService; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; import android.os.RemoteException; /** * Service for handling parental supervision. * * @hide */ @SystemService(Context.SUPERVISION_SERVICE) public class SupervisionManager { private final Context mContext; private final ISupervisionManager mService; /** * @hide */ @UnsupportedAppUsage public SupervisionManager(Context context, ISupervisionManager service) { mContext = context; mService = service; } /** * Returns whether the device is supervised. * * @hide */ public boolean isSupervisionEnabled() { try { return mService.isSupervisionEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } }
core/java/android/app/supervision/flags.aconfig 0 → 100644 +10 −0 Original line number Diff line number Diff line package: "android.app.supervision.flags" container: "system" flag { name: "supervision_api" is_exported: true namespace: "supervision" description: "Flag to enable the SupervisionService" bug: "340351729" } No newline at end of file