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

Commit 8903f666 authored by Bartosz Fabianowski's avatar Bartosz Fabianowski
Browse files

Add wipe on login failure to Privacy Settings page

This CL adds information to the Enterprise Privacy Setting page that
tells the user how many times the password can be mistyped before
the device (or the work profile) is forcefully wiped.

Test: make RunSettingsRoboTests
Bug: 32692748

Change-Id: I4ae316802dbf5853ab4eacb0787647372d5e26c2
parent c1a7723c
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -8153,6 +8153,16 @@
    <string name="enterprise_privacy_lock_device">Admin can lock device and reset password</string>
    <!-- Label explaining that the admin can wipe the device remotely. [CHAR LIMIT=NONE] -->
    <string name="enterprise_privacy_wipe_device">Admin can delete all device data</string>
    <!-- Label explaining that the admin configured the device to wipe itself when the password is mistyped this many times. [CHAR LIMIT=NONE] -->
    <plurals name="enterprise_privacy_failed_password_wipe_device">
        <item quantity="one">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting all device data</item>
        <item quantity="other">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting all device data</item>
    </plurals>
    <!-- Label explaining that the admin configured the work profile to wipe itself when the password is mistyped this many times. [CHAR LIMIT=NONE] -->
    <plurals name="enterprise_privacy_failed_password_wipe_work">
        <item quantity="one">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting work profile data</item>
        <item quantity="other">Admin set maximum password attempts to <xliff:g id="count">%d</xliff:g> before deleting work profile data</item>
    </plurals>
    <!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
    <string name="do_disclosure_generic">This device is managed.</string>
    <!-- Message indicating that the device is enterprise-managed by a Device Owner [CHAR LIMIT=NONE] -->
+8 −0
Original line number Diff line number Diff line
@@ -106,5 +106,13 @@
                android:title="@string/enterprise_privacy_wipe_device"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="failed_password_wipe_primary_user"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
        <com.android.settings.DividerPreference
                android:key="failed_password_wipe_managed_profile"
                settings:allowDividerBelow="true"
                settings:multiLine="true"/>
    </PreferenceCategory>
</PreferenceScreen>
+0 −2
Original line number Diff line number Diff line
@@ -26,12 +26,10 @@ import java.util.Date;

public abstract class AdminActionPreferenceControllerBase extends PreferenceController {

    private final Context mContext;
    protected final EnterprisePrivacyFeatureProvider mFeatureProvider;

    public AdminActionPreferenceControllerBase(Context context) {
        super(context);
        mContext = context;
        mFeatureProvider = FeatureFactory.getFactory(context)
                .getEnterprisePrivacyFeatureProvider(context);
    }
+25 −4
Original line number Diff line number Diff line
@@ -26,6 +26,13 @@ import android.support.annotation.Nullable;
 * newer than the API version supported by Robolectric.
 */
public interface DevicePolicyManagerWrapper {
    /**
     * Calls {@code DevicePolicyManager.getMaximumFailedPasswordsForWipe()}.
     *
     * @see android.app.admin.DevicePolicyManager#getMaximumFailedPasswordsForWipe
     */
    int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle);

    /**
     * Calls {@code DevicePolicyManager.getDeviceOwnerComponentOnAnyUser()}.
     *
@@ -33,12 +40,26 @@ public interface DevicePolicyManagerWrapper {
     */
    ComponentName getDeviceOwnerComponentOnAnyUser();

    /**
     * Calls {@code DevicePolicyManager.getDeviceOwnerUserId()}.
     *
     * @see android.app.admin.DevicePolicyManager#getDeviceOwnerUserId
     */
    int getDeviceOwnerUserId();

    /**
     * Calls {@code DevicePolicyManager.getProfileOwnerAsUser()}.
     *
     * @see android.app.admin.DevicePolicyManager#getProfileOwnerAsUser
     */
    @Nullable ComponentName getProfileOwnerAsUser(final int userId);

    /**
     * Calls {@code DevicePolicyManager.getDeviceOwnerNameOnAnyUser()}.
     *
     * @see android.app.admin.DevicePolicyManager#getDeviceOwnerNameOnAnyUser
     */
    public CharSequence getDeviceOwnerOrganizationName();
    CharSequence getDeviceOwnerOrganizationName();

    /**
     * Calls {@code DevicePolicyManager.getPermissionGrantState()}.
@@ -53,19 +74,19 @@ public interface DevicePolicyManagerWrapper {
     *
     * @see android.app.admin.DevicePolicyManager#getLastSecurityLogRetrievalTime
     */
    public long getLastSecurityLogRetrievalTime();
    long getLastSecurityLogRetrievalTime();

    /**
     * Calls {@code DevicePolicyManager.getLastBugReportRequestTime()}.
     *
     * @see android.app.admin.DevicePolicyManager#getLastBugReportRequestTime
     */
    public long getLastBugReportRequestTime();
    long getLastBugReportRequestTime();

    /**
     * Calls {@code DevicePolicyManager.getLastNetworkLogRetrievalTime()}.
     *
     * @see android.app.admin.DevicePolicyManager#getLastNetworkLogRetrievalTime
     */
    public long getLastNetworkLogRetrievalTime();
    long getLastNetworkLogRetrievalTime();
}
+15 −0
Original line number Diff line number Diff line
@@ -27,11 +27,26 @@ public class DevicePolicyManagerWrapperImpl implements DevicePolicyManagerWrappe
        mDpm = dpm;
    }

    @Override
    public int getMaximumFailedPasswordsForWipe(@Nullable ComponentName admin, int userHandle) {
        return mDpm.getMaximumFailedPasswordsForWipe(admin, userHandle);
    }

    @Override
    public ComponentName getDeviceOwnerComponentOnAnyUser() {
        return mDpm.getDeviceOwnerComponentOnAnyUser();
    }

    @Override
    public int getDeviceOwnerUserId() {
        return mDpm.getDeviceOwnerUserId();
    }

    @Override
    public @Nullable ComponentName getProfileOwnerAsUser(final int userId) {
        return mDpm.getProfileOwnerAsUser(userId);
    }

    @Override
    public CharSequence getDeviceOwnerOrganizationName() {
        return mDpm.getDeviceOwnerOrganizationName();
Loading