Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ac9a718 authored by bernardchau's avatar bernardchau
Browse files

Update screen lock complexity permission to password complexity

This is to match the method name "getPasswordComplexity" as requested by API review feedback

Bug: 128030136
Test: N/A
Change-Id: I999657f88ed425333adbe97b9ecc33da3769ba90
parent 8e97c359
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ package android {
    field public static final String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
    field public static final String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
    field public static final String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES";
    field public static final String REQUEST_SCREEN_LOCK_COMPLEXITY = "android.permission.REQUEST_SCREEN_LOCK_COMPLEXITY";
    field public static final String REQUEST_PASSWORD_COMPLEXITY = "android.permission.REQUEST_PASSWORD_COMPLEXITY";
    field @Deprecated public static final String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
    field public static final String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
    field public static final String SEND_SMS = "android.permission.SEND_SMS";
@@ -6656,7 +6656,7 @@ package android.app.admin {
    method @Nullable public CharSequence getOrganizationName(@NonNull android.content.ComponentName);
    method public java.util.List<android.telephony.data.ApnSetting> getOverrideApns(@NonNull android.content.ComponentName);
    method @NonNull public android.app.admin.DevicePolicyManager getParentProfileInstance(@NonNull android.content.ComponentName);
    method @RequiresPermission(android.Manifest.permission.REQUEST_SCREEN_LOCK_COMPLEXITY) public int getPasswordComplexity();
    method @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY) public int getPasswordComplexity();
    method public long getPasswordExpiration(@Nullable android.content.ComponentName);
    method public long getPasswordExpirationTimeout(@Nullable android.content.ComponentName);
    method public int getPasswordHistoryLength(@Nullable android.content.ComponentName);
@@ -6850,7 +6850,7 @@ package android.app.admin {
    field public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
    field public static final String EXTRA_DELEGATION_SCOPES = "android.app.extra.DELEGATION_SCOPES";
    field public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
    field @RequiresPermission(android.Manifest.permission.REQUEST_SCREEN_LOCK_COMPLEXITY) public static final String EXTRA_PASSWORD_COMPLEXITY = "android.app.extra.PASSWORD_COMPLEXITY";
    field @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY) public static final String EXTRA_PASSWORD_COMPLEXITY = "android.app.extra.PASSWORD_COMPLEXITY";
    field public static final String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE = "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";
    field public static final String EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE = "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE";
    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME = "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";
+4 −4
Original line number Diff line number Diff line
@@ -1378,7 +1378,7 @@ public class DevicePolicyManager {
     * complexity, and use this activity with extra {@link #EXTRA_PASSWORD_COMPLEXITY} to suggest
     * to users how complex the app wants the new screen lock to be. Note that both {@link
     * #getPasswordComplexity()} and the extra {@link #EXTRA_PASSWORD_COMPLEXITY} require the
     * calling app to have the permission {@link permission#REQUEST_SCREEN_LOCK_COMPLEXITY}.
     * calling app to have the permission {@link permission#REQUEST_PASSWORD_COMPLEXITY}.
     *
     * <p>If the intent is launched from within a managed profile with a profile
     * owner built against {@link android.os.Build.VERSION_CODES#M} or before,
@@ -1406,7 +1406,7 @@ public class DevicePolicyManager {
     *
     * <p>If an invalid value is used, it will be treated as {@link #PASSWORD_COMPLEXITY_NONE}.
     */
    @RequiresPermission(android.Manifest.permission.REQUEST_SCREEN_LOCK_COMPLEXITY)
    @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY)
    public static final String EXTRA_PASSWORD_COMPLEXITY =
            "android.app.extra.PASSWORD_COMPLEXITY";

@@ -3378,10 +3378,10 @@ public class DevicePolicyManager {
     *
     * @throws IllegalStateException if the user is not unlocked.
     * @throws SecurityException if the calling application does not have the permission
     *                           {@link permission#REQUEST_SCREEN_LOCK_COMPLEXITY}
     *                           {@link permission#REQUEST_PASSWORD_COMPLEXITY}
     */
    @PasswordComplexity
    @RequiresPermission(android.Manifest.permission.REQUEST_SCREEN_LOCK_COMPLEXITY)
    @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY)
    public int getPasswordComplexity() {
        throwIfParentInstance("getPasswordComplexity");
        if (mService == null) {
+3 −3
Original line number Diff line number Diff line
@@ -2152,9 +2152,9 @@
     screen lock to a certain complexity level.
     <p>Protection level: normal
    -->
    <permission android:name="android.permission.REQUEST_SCREEN_LOCK_COMPLEXITY"
                android:label="@string/permlab_requestScreenLockComplexity"
                android:description="@string/permdesc_requestScreenLockComplexity"
    <permission android:name="android.permission.REQUEST_PASSWORD_COMPLEXITY"
                android:label="@string/permlab_requestPasswordComplexity"
                android:description="@string/permdesc_requestPasswordComplexity"
                android:protectionLevel="normal" />

    <!-- ================================== -->
+2 −2
Original line number Diff line number Diff line
@@ -1406,9 +1406,9 @@
      re-enables the keylock when the call is finished.</string>

    <!-- Title of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=NONE] -->
    <string name="permlab_requestScreenLockComplexity">request screen lock complexity</string>
    <string name="permlab_requestPasswordComplexity">request screen lock complexity</string>
    <!-- Description of an application permission, listed so the user can choose whether they want to allow the application to do this. [CHAR_LIMIT=NONE] -->
    <string name="permdesc_requestScreenLockComplexity">Allows the app to learn the screen
    <string name="permdesc_requestPasswordComplexity">Allows the app to learn the screen
        lock complexity level (high, medium, low or none), which indicates the possible range of
        length and type of the screen lock. The app can also suggest to users that they update the
        screen lock to a certain level but users can freely ignore and navigate away. Note that the
+3 −3
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.server.devicepolicy;
import static android.Manifest.permission.BIND_DEVICE_ADMIN;
import static android.Manifest.permission.MANAGE_CA_CERTIFICATES;
import static android.Manifest.permission.REQUEST_SCREEN_LOCK_COMPLEXITY;
import static android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY;
import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
import static android.app.admin.DeviceAdminReceiver.EXTRA_TRANSFER_OWNERSHIP_ADMIN_EXTRAS_BUNDLE;
import static android.app.admin.DevicePolicyManager.ACTION_PROVISION_MANAGED_USER;
@@ -4795,8 +4795,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        final int callingUserId = mInjector.userHandleGetCallingUserId();
        enforceUserUnlocked(callingUserId);
        mContext.enforceCallingOrSelfPermission(
                REQUEST_SCREEN_LOCK_COMPLEXITY,
                "Must have " + REQUEST_SCREEN_LOCK_COMPLEXITY + " permission.");
                REQUEST_PASSWORD_COMPLEXITY,
                "Must have " + REQUEST_PASSWORD_COMPLEXITY + " permission.");
        synchronized (getLockObject()) {
            int targetUserId = getCredentialOwner(callingUserId, /* parent= */ false);
Loading