diff options
| author | 2024-10-23 19:29:39 +0000 | |
|---|---|---|
| committer | 2024-11-12 17:14:06 +0000 | |
| commit | e50a448b15844597f81a06bd973d411fa69e3da7 (patch) | |
| tree | 90f0beb531a6b9047c8412255f4d4f779ac3eabd | |
| parent | 7fb089df34c36c5ca6d15d715fa124d1bec9fbe8 (diff) | |
Make the new setSecondaryLockscreen a SystemApi
Removed the ComponentName parameter since this can only be used by the
SYSTEM_SUPERVISION role holder.
Test: m
Bug: 356895431
Bug: 361098832
Flag: android.app.admin.flags.secondary_lockscreen_api_enabled
Change-Id: I9a11eaf053dd5ecff28c0add6b282472bb91b168
| -rw-r--r-- | core/api/system-current.txt | 3 | ||||
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 28 | ||||
| -rw-r--r-- | core/java/android/app/admin/flags/flags.aconfig | 8 |
3 files changed, 32 insertions, 7 deletions
diff --git a/core/api/system-current.txt b/core/api/system-current.txt index f9ef62f6b2e8..2024c0d8e7d8 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -1378,7 +1378,8 @@ package android.app.admin { method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public void setDpcDownloaded(boolean); method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public void setMaxPolicyStorageLimit(int); method @Deprecated @RequiresPermission(value=android.Manifest.permission.GRANT_PROFILE_OWNER_DEVICE_IDS_ACCESS, conditional=true) public void setProfileOwnerCanAccessDeviceIds(@NonNull android.content.ComponentName); - method public void setSecondaryLockscreenEnabled(@NonNull android.content.ComponentName, boolean); + method @Deprecated @FlaggedApi("android.app.admin.flags.secondary_lockscreen_api_enabled") public void setSecondaryLockscreenEnabled(@NonNull android.content.ComponentName, boolean); + method @FlaggedApi("android.app.admin.flags.secondary_lockscreen_api_enabled") public void setSecondaryLockscreenEnabled(boolean, @Nullable android.os.PersistableBundle); method @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS) public void setUserProvisioningState(int, @NonNull android.os.UserHandle); method @RequiresPermission(android.Manifest.permission.MANAGE_ROLE_HOLDERS) public boolean shouldAllowBypassingDevicePolicyManagementRoleQualification(); field public static final String ACCOUNT_FEATURE_DEVICE_OR_PROFILE_OWNER_ALLOWED = "android.account.DEVICE_OR_PROFILE_OWNER_ALLOWED"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 707ba347faab..557b45770d8b 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -58,6 +58,7 @@ import static android.app.admin.flags.Flags.FLAG_DEVICE_THEFT_API_ENABLED; import static android.app.admin.flags.Flags.FLAG_REMOVE_MANAGED_PROFILE_ENABLED; import static android.app.admin.flags.Flags.onboardingBugreportV2Enabled; import static android.app.admin.flags.Flags.onboardingConsentlessBugreports; +import static android.app.admin.flags.Flags.FLAG_SECONDARY_LOCKSCREEN_API_ENABLED; import static android.content.Intent.LOCAL_FLAG_FROM_SYSTEM; import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1; import static android.os.Build.VERSION_CODES.UPSIDE_DOWN_CAKE; @@ -12551,28 +12552,43 @@ public class DevicePolicyManager { * @param enabled Whether or not the lockscreen needs to be shown. * @throws SecurityException if {@code admin} is not a device or profile owner. * @see #isSecondaryLockscreenEnabled + * @deprecated Use {@link #setSecondaryLockscreenEnabled(boolean,PersistableBundle)} instead. * @hide - **/ + */ + @Deprecated @SystemApi + @FlaggedApi(FLAG_SECONDARY_LOCKSCREEN_API_ENABLED) public void setSecondaryLockscreenEnabled(@NonNull ComponentName admin, boolean enabled) { - setSecondaryLockscreenEnabled(admin, enabled, null); + throwIfParentInstance("setSecondaryLockscreenEnabled"); + if (mService != null) { + try { + mService.setSecondaryLockscreenEnabled(admin, enabled, null); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } } /** * Called by the system supervision app to set whether a secondary lockscreen needs to be shown. * - * @param admin Which {@link DeviceAdminReceiver} this request is associated with. Null if the - * caller is not a device admin. + * <p>The secondary lockscreen will by displayed after the primary keyguard security screen + * requirements are met. + * + * <p>This API, and associated APIs, can only be called by the default supervision app. + * * @param enabled Whether or not the lockscreen needs to be shown. * @param options A {@link PersistableBundle} to supply options to the lock screen. * @hide */ - public void setSecondaryLockscreenEnabled(@Nullable ComponentName admin, boolean enabled, + @SystemApi + @FlaggedApi(FLAG_SECONDARY_LOCKSCREEN_API_ENABLED) + public void setSecondaryLockscreenEnabled(boolean enabled, @Nullable PersistableBundle options) { throwIfParentInstance("setSecondaryLockscreenEnabled"); if (mService != null) { try { - mService.setSecondaryLockscreenEnabled(admin, enabled, options); + mService.setSecondaryLockscreenEnabled(null, enabled, options); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig index 5f868befa368..404471e266d2 100644 --- a/core/java/android/app/admin/flags/flags.aconfig +++ b/core/java/android/app/admin/flags/flags.aconfig @@ -381,3 +381,11 @@ flag { description: "Split up existing create and provision managed profile API." bug: "375382324" } + +flag { + name: "secondary_lockscreen_api_enabled" + is_exported: true + namespace: "enterprise" + description: "Add new API for secondary lockscreen" + bug: "336297680" +} |