diff --git a/api/Android.bp b/api/Android.bp index 9306671d758c3533f47a4953309f4fcc1430f5ba..a3e64a565422f6aeb58e06992a8bc9c1842bbf3e 100644 --- a/api/Android.bp +++ b/api/Android.bp @@ -98,6 +98,7 @@ combined_apis { "framework-configinfrastructure", "framework-connectivity", "framework-connectivity-t", + "framework-devicelock", "framework-federatedcompute", "framework-graphics", "framework-healthconnect", diff --git a/boot/Android.bp b/boot/Android.bp index 9fdb9bc6506a106a02760e5c71215326a44f0871..7839918d6a54ab5885b355cc462d601836bb8661 100644 --- a/boot/Android.bp +++ b/boot/Android.bp @@ -71,6 +71,10 @@ platform_bootclasspath { apex: "com.android.conscrypt", module: "com.android.conscrypt-bootclasspath-fragment", }, + { + apex: "com.android.devicelock", + module: "com.android.devicelock-bootclasspath-fragment", + }, { apex: "com.android.federatedcompute", module: "com.android.federatedcompute-bootclasspath-fragment", diff --git a/core/api/current.txt b/core/api/current.txt index 8d032fea24ec38e840034e24bb2be3e222b802a1..8059a86b6b0419a27e8c6face7f9b262f2229bd8 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -107,6 +107,7 @@ package android { field public static final String LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK = "android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK"; field public static final String LOADER_USAGE_STATS = "android.permission.LOADER_USAGE_STATS"; field public static final String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE"; + field public static final String MANAGE_DEVICE_LOCK_STATE = "android.permission.MANAGE_DEVICE_LOCK_STATE"; field public static final String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS"; field public static final String MANAGE_EXTERNAL_STORAGE = "android.permission.MANAGE_EXTERNAL_STORAGE"; field public static final String MANAGE_MEDIA = "android.permission.MANAGE_MEDIA"; @@ -9845,6 +9846,7 @@ package android.content { field public static final int CONTEXT_RESTRICTED = 4; // 0x4 field public static final String CREDENTIAL_SERVICE = "credential"; field public static final String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps"; + field public static final String DEVICE_LOCK_SERVICE = "device_lock"; field public static final String DEVICE_POLICY_SERVICE = "device_policy"; field public static final String DISPLAY_HASH_SERVICE = "display_hash"; field public static final String DISPLAY_SERVICE = "display"; @@ -11991,6 +11993,7 @@ package android.content.pm { field public static final String FEATURE_CONTROLS = "android.software.controls"; field public static final String FEATURE_CREDENTIALS = "android.software.credentials"; field public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin"; + field public static final String FEATURE_DEVICE_LOCK = "android.software.device_lock"; field public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded"; field public static final String FEATURE_ETHERNET = "android.hardware.ethernet"; field public static final String FEATURE_EXPANDED_PICTURE_IN_PICTURE = "android.software.expanded_picture_in_picture"; diff --git a/core/java/android/app/SystemServiceRegistry.java b/core/java/android/app/SystemServiceRegistry.java index 4ddfdb603e73dff41999f51719e7004bfacaf0db..08a6b8c4e135bf8b642554d9889e2797308372c5 100644 --- a/core/java/android/app/SystemServiceRegistry.java +++ b/core/java/android/app/SystemServiceRegistry.java @@ -85,6 +85,7 @@ import android.credentials.CredentialManager; import android.credentials.ICredentialManager; import android.debug.AdbManager; import android.debug.IAdbManager; +import android.devicelock.DeviceLockFrameworkInitializer; import android.graphics.fonts.FontManager; import android.hardware.ConsumerIrManager; import android.hardware.ISerialManager; @@ -1555,6 +1556,7 @@ public final class SystemServiceRegistry { ConnectivityFrameworkInitializerTiramisu.registerServiceWrappers(); NearbyFrameworkInitializer.registerServiceWrappers(); OnDevicePersonalizationFrameworkInitializer.registerServiceWrappers(); + DeviceLockFrameworkInitializer.registerServiceWrappers(); } finally { // If any of the above code throws, we're in a pretty bad shape and the process // will likely crash, but we'll reset it just in case there's an exception handler... diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java index 753c93612f4059e92422d95817293efc8240f43d..d65210b8a0bc9ad9c2c96d5266e01ff3cbcbb080 100644 --- a/core/java/android/content/Context.java +++ b/core/java/android/content/Context.java @@ -3938,6 +3938,7 @@ public abstract class Context { //@hide: SAFETY_CENTER_SERVICE, DISPLAY_HASH_SERVICE, CREDENTIAL_SERVICE, + DEVICE_LOCK_SERVICE, }) @Retention(RetentionPolicy.SOURCE) public @interface ServiceName {} @@ -6072,6 +6073,14 @@ public abstract class Context { */ public static final String CREDENTIAL_SERVICE = "credential"; + /** + * Use with {@link #getSystemService(String)} to retrieve a + * {@link android.devicelock.DeviceLockManager}. + * + * @see #getSystemService(String) + */ + public static final String DEVICE_LOCK_SERVICE = "device_lock"; + /** * Determine whether the given permission is allowed for a particular * process and user ID running in the system. diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java index db991dcd3afcc4fad8e84f64b986912564b61a15..823c142818184b9c444535c4fa2ac98770d7cef3 100644 --- a/core/java/android/content/pm/PackageManager.java +++ b/core/java/android/content/pm/PackageManager.java @@ -4194,6 +4194,14 @@ public abstract class PackageManager { @SdkConstant(SdkConstantType.FEATURE) public static final String FEATURE_CREDENTIALS = "android.software.credentials"; + /** + * Feature for {@link #getSystemAvailableFeatures} and {@link #hasSystemFeature}: + * The device supports locking (for example, by a financing provider in case of a missed + * payment). + */ + @SdkConstant(SdkConstantType.FEATURE) + public static final String FEATURE_DEVICE_LOCK = "android.software.device_lock"; + /** @hide */ public static final boolean APP_ENUMERATION_ENABLED_BY_DEFAULT = true; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index de1a7f9eaaa506da3fb4e1a7ca41969266e994f8..eb54abfbbcbeda27afb9d95c16b89fd7458a2797 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -6577,6 +6577,13 @@ android:protectionLevel="signature" /> <uses-permission android:name="android.permission.HANDLE_QUERY_PACKAGE_RESTART" /> + <!-- Allows financed device kiosk apps to perform actions on the Device Lock service + <p>Protection level: internal|role + <p>Intended for use by the FINANCED_DEVICE_KIOSK role only. + --> + <permission android:name="android.permission.MANAGE_DEVICE_LOCK_STATE" + android:protectionLevel="internal|role" /> + <!-- Attribution for Geofencing service. --> <attribution android:tag="GeofencingService" android:label="@string/geofencing_service"/> <!-- Attribution for Country Detector. --> diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index fecf1241acf8c084f238a51ecbb608a9a1c40239..8acc3e7a1a9aae9ff062aa1b90dd6a857b3ed845 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -715,6 +715,9 @@ <!-- Permission required for CTS test - ActivityPermissionRationaleTest --> <uses-permission android:name="android.permission.ADJUST_RUNTIME_PERMISSIONS_POLICY" /> + <!-- Permission required for CTS test - CtsDeviceLockTestCases --> + <uses-permission android:name="android.permission.MANAGE_DEVICE_LOCK_STATE" /> + <application android:label="@string/app_label" android:theme="@android:style/Theme.DeviceDefault.DayNight" android:defaultToDeviceProtectedStorage="true"