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

Commit 75e2021a authored by Felipe Leme's avatar Felipe Leme Committed by Automerger Merge Worker
Browse files

Merge "Disabled some password-related APIs on automotive." into sc-v2-dev am:...

Merge "Disabled some password-related APIs on automotive." into sc-v2-dev am: ef61167c am: 32fb93ea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16150886

Change-Id: I37fd93c9f37569c7ea06ce67c1d4bcb88fb09017
parents 087aad75 32fb93ea
Loading
Loading
Loading
Loading
+24 −7
Original line number Original line Diff line number Diff line
@@ -3452,6 +3452,9 @@ public class DevicePolicyManager {
     * set on the primary {@link DevicePolicyManager} must be cleared first by calling
     * set on the primary {@link DevicePolicyManager} must be cleared first by calling
     * {@link #setRequiredPasswordComplexity} with {@link #PASSWORD_COMPLEXITY_NONE) first.
     * {@link #setRequiredPasswordComplexity} with {@link #PASSWORD_COMPLEXITY_NONE) first.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated Prefer using {@link #setRequiredPasswordComplexity(int)}, to require a password
     * @deprecated Prefer using {@link #setRequiredPasswordComplexity(int)}, to require a password
     * that satisfies a complexity level defined by the platform, rather than specifying custom
     * that satisfies a complexity level defined by the platform, rather than specifying custom
     * password requirement.
     * password requirement.
@@ -3542,12 +3545,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3625,12 +3630,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3715,12 +3722,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3805,12 +3814,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3894,12 +3905,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -3983,12 +3996,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
@@ -4071,12 +4086,14 @@ public class DevicePolicyManager {
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * {@link DeviceAdminInfo#USES_POLICY_LIMIT_PASSWORD} to be able to call this method; if it has
     * not, a security exception will be thrown.
     * not, a security exception will be thrown.
     * <p>
     * <p>
     *
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * Apps targeting {@link android.os.Build.VERSION_CODES#R} and below can call this method on the
     * {@link DevicePolicyManager} instance returned by
     * {@link DevicePolicyManager} instance returned by
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * {@link #getParentProfileInstance(ComponentName)} in order to set restrictions on the parent
     * profile.
     * profile.
     *
     *
     * <p><string>Note:</strong> this method is ignored on
     * {PackageManager#FEATURE_AUTOMOTIVE automotive builds}.
     *
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     * @deprecated see {@link #setPasswordQuality(ComponentName, int)} for details.
     *
     *
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
+18 −7
Original line number Original line Diff line number Diff line
@@ -3839,9 +3839,17 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
        }
    }
    }
    private boolean notSupportedOnAutomotive(String method) {
        if (mIsAutomotive) {
            Slogf.i(LOG_TAG, "%s is not supported on automotive builds", method);
            return true;
        }
        return false;
    }
    @Override
    @Override
    public void setPasswordQuality(ComponentName who, int quality, boolean parent) {
    public void setPasswordQuality(ComponentName who, int quality, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordQuality")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4076,7 +4084,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumLength(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumLength(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumLength")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4358,7 +4366,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumUpperCase(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumUpperCase(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumUpperCase")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4391,6 +4399,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumLowerCase(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumLowerCase(ComponentName who, int length, boolean parent) {
        if (notSupportedOnAutomotive("setPasswordMinimumLowerCase")) {
            return;
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
        final int userId = mInjector.userHandleGetCallingUserId();
        final int userId = mInjector.userHandleGetCallingUserId();
        synchronized (getLockObject()) {
        synchronized (getLockObject()) {
@@ -4421,7 +4432,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumLetters(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumLetters(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumLetters")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4453,7 +4464,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumNumeric(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumNumeric(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumNumeric")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4485,7 +4496,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumSymbols(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumSymbols(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumSymbols")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");
@@ -4517,7 +4528,7 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    @Override
    @Override
    public void setPasswordMinimumNonLetter(ComponentName who, int length, boolean parent) {
    public void setPasswordMinimumNonLetter(ComponentName who, int length, boolean parent) {
        if (!mHasFeature) {
        if (!mHasFeature || notSupportedOnAutomotive("setPasswordMinimumNonLetter")) {
            return;
            return;
        }
        }
        Objects.requireNonNull(who, "ComponentName is null");
        Objects.requireNonNull(who, "ComponentName is null");