Loading api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -7242,7 +7242,7 @@ package android.app.admin { public final class FactoryResetProtectionPolicy implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<java.lang.String> getFactoryResetProtectionAccounts(); method public boolean isFactoryResetProtectionDisabled(); method public boolean isFactoryResetProtectionEnabled(); method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FactoryResetProtectionPolicy> CREATOR; } Loading @@ -7251,7 +7251,7 @@ package android.app.admin { ctor public FactoryResetProtectionPolicy.Builder(); method @NonNull public android.app.admin.FactoryResetProtectionPolicy build(); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionAccounts(@NonNull java.util.List<java.lang.String>); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionDisabled(boolean); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionEnabled(boolean); } public class FreezePeriod { core/java/android/app/admin/FactoryResetProtectionPolicy.java +26 −24 Original line number Diff line number Diff line Loading @@ -53,17 +53,17 @@ public final class FactoryResetProtectionPolicy implements Parcelable { private static final String KEY_FACTORY_RESET_PROTECTION_ACCOUNT = "factory_reset_protection_account"; private static final String KEY_FACTORY_RESET_PROTECTION_DISABLED = "factory_reset_protection_disabled"; private static final String KEY_FACTORY_RESET_PROTECTION_ENABLED = "factory_reset_protection_enabled"; private static final String ATTR_VALUE = "value"; private final List<String> mFactoryResetProtectionAccounts; private final boolean mFactoryResetProtectionDisabled; private final boolean mFactoryResetProtectionEnabled; private FactoryResetProtectionPolicy(List<String> factoryResetProtectionAccounts, boolean factoryResetProtectionDisabled) { boolean factoryResetProtectionEnabled) { mFactoryResetProtectionAccounts = factoryResetProtectionAccounts; mFactoryResetProtectionDisabled = factoryResetProtectionDisabled; mFactoryResetProtectionEnabled = factoryResetProtectionEnabled; } /** Loading @@ -74,10 +74,10 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } /** * Return whether factory reset protection for the device is disabled or not. * Return whether factory reset protection for the device is enabled or not. */ public boolean isFactoryResetProtectionDisabled() { return mFactoryResetProtectionDisabled; public boolean isFactoryResetProtectionEnabled() { return mFactoryResetProtectionEnabled; } /** Loading @@ -85,12 +85,13 @@ public final class FactoryResetProtectionPolicy implements Parcelable { */ public static class Builder { private List<String> mFactoryResetProtectionAccounts; private boolean mFactoryResetProtectionDisabled; private boolean mFactoryResetProtectionEnabled; /** * Initialize a new Builder to construct a {@link FactoryResetProtectionPolicy}. */ public Builder() { mFactoryResetProtectionEnabled = true; }; /** Loading @@ -113,18 +114,19 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } /** * Sets whether factory reset protection is disabled or not. * Sets whether factory reset protection is enabled or not. * <p> * Once disabled, factory reset protection will not kick in all together when the device * goes through untrusted factory reset. This applies to both the consumer unlock flow and * the admin account overrides via {@link #setFactoryResetProtectionAccounts} * the admin account overrides via {@link #setFactoryResetProtectionAccounts}. By default, * factory reset protection is enabled. * * @param factoryResetProtectionDisabled Whether the policy is disabled or not. * @param factoryResetProtectionEnabled Whether the policy is enabled or not. * @return the same Builder instance. */ @NonNull public Builder setFactoryResetProtectionDisabled(boolean factoryResetProtectionDisabled) { mFactoryResetProtectionDisabled = factoryResetProtectionDisabled; public Builder setFactoryResetProtectionEnabled(boolean factoryResetProtectionEnabled) { mFactoryResetProtectionEnabled = factoryResetProtectionEnabled; return this; } Loading @@ -136,7 +138,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { @NonNull public FactoryResetProtectionPolicy build() { return new FactoryResetProtectionPolicy(mFactoryResetProtectionAccounts, mFactoryResetProtectionDisabled); mFactoryResetProtectionEnabled); } } Loading @@ -144,7 +146,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { public String toString() { return "FactoryResetProtectionPolicy{" + "mFactoryResetProtectionAccounts=" + mFactoryResetProtectionAccounts + ", mFactoryResetProtectionDisabled=" + mFactoryResetProtectionDisabled + ", mFactoryResetProtectionEnabled=" + mFactoryResetProtectionEnabled + '}'; } Loading @@ -155,7 +157,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { for (String account: mFactoryResetProtectionAccounts) { dest.writeString(account); } dest.writeBoolean(mFactoryResetProtectionDisabled); dest.writeBoolean(mFactoryResetProtectionEnabled); } @Override Loading @@ -173,10 +175,10 @@ public final class FactoryResetProtectionPolicy implements Parcelable { for (int i = 0; i < accountsCount; i++) { factoryResetProtectionAccounts.add(in.readString()); } boolean factoryResetProtectionDisabled = in.readBoolean(); boolean factoryResetProtectionEnabled = in.readBoolean(); return new FactoryResetProtectionPolicy(factoryResetProtectionAccounts, factoryResetProtectionDisabled); factoryResetProtectionEnabled); } @Override Loading @@ -195,8 +197,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable { @Nullable public static FactoryResetProtectionPolicy readFromXml(@NonNull XmlPullParser parser) { try { boolean factoryResetProtectionDisabled = Boolean.parseBoolean( parser.getAttributeValue(null, KEY_FACTORY_RESET_PROTECTION_DISABLED)); boolean factoryResetProtectionEnabled = Boolean.parseBoolean( parser.getAttributeValue(null, KEY_FACTORY_RESET_PROTECTION_ENABLED)); List<String> factoryResetProtectionAccounts = new ArrayList<>(); int outerDepth = parser.getDepth(); Loading @@ -214,7 +216,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } return new FactoryResetProtectionPolicy(factoryResetProtectionAccounts, factoryResetProtectionDisabled); factoryResetProtectionEnabled); } catch (XmlPullParserException | IOException e) { Log.w(LOG_TAG, "Reading from xml failed", e); } Loading @@ -225,8 +227,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable { * @hide */ public void writeToXml(@NonNull XmlSerializer out) throws IOException { out.attribute(null, KEY_FACTORY_RESET_PROTECTION_DISABLED, Boolean.toString(mFactoryResetProtectionDisabled)); out.attribute(null, KEY_FACTORY_RESET_PROTECTION_ENABLED, Boolean.toString(mFactoryResetProtectionEnabled)); for (String account : mFactoryResetProtectionAccounts) { out.startTag(null, KEY_FACTORY_RESET_PROTECTION_ACCOUNT); out.attribute(null, ATTR_VALUE, account); Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -2087,7 +2087,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(new ArrayList<>()) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); dpm.setFactoryResetProtectionPolicy(admin1, policy); Loading @@ -2105,7 +2105,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { setupProfileOwner(); FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); assertExpectException(SecurityException.class, null, Loading Loading @@ -2157,7 +2157,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(new ArrayList<>()) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); dpm.setFactoryResetProtectionPolicy(admin1, policy); Loading @@ -2177,8 +2177,8 @@ public class DevicePolicyManagerTest extends DpmTestBase { private void assertPoliciesAreEqual(FactoryResetProtectionPolicy expectedPolicy, FactoryResetProtectionPolicy actualPolicy) { assertThat(actualPolicy.isFactoryResetProtectionDisabled()).isEqualTo( expectedPolicy.isFactoryResetProtectionDisabled()); assertThat(actualPolicy.isFactoryResetProtectionEnabled()).isEqualTo( expectedPolicy.isFactoryResetProtectionEnabled()); assertAccountsAreEqual(expectedPolicy.getFactoryResetProtectionAccounts(), actualPolicy.getFactoryResetProtectionAccounts()); } Loading services/tests/servicestests/src/com/android/server/devicepolicy/FactoryResetProtectionPolicyTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class FactoryResetProtectionPolicyTest { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(accounts) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); testParcelAndUnparcel(policy); Loading @@ -77,7 +77,7 @@ public class FactoryResetProtectionPolicyTest { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(accounts) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); testParcelAndUnparcel(policy); Loading Loading @@ -133,8 +133,8 @@ public class FactoryResetProtectionPolicyTest { private void assertPoliciesAreEqual(FactoryResetProtectionPolicy expectedPolicy, FactoryResetProtectionPolicy actualPolicy) { assertEquals(expectedPolicy.isFactoryResetProtectionDisabled(), actualPolicy.isFactoryResetProtectionDisabled()); assertEquals(expectedPolicy.isFactoryResetProtectionEnabled(), actualPolicy.isFactoryResetProtectionEnabled()); assertAccountsAreEqual(expectedPolicy.getFactoryResetProtectionAccounts(), actualPolicy.getFactoryResetProtectionAccounts()); } Loading Loading
api/current.txt +2 −2 Original line number Diff line number Diff line Loading @@ -7242,7 +7242,7 @@ package android.app.admin { public final class FactoryResetProtectionPolicy implements android.os.Parcelable { method public int describeContents(); method @NonNull public java.util.List<java.lang.String> getFactoryResetProtectionAccounts(); method public boolean isFactoryResetProtectionDisabled(); method public boolean isFactoryResetProtectionEnabled(); method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int); field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FactoryResetProtectionPolicy> CREATOR; } Loading @@ -7251,7 +7251,7 @@ package android.app.admin { ctor public FactoryResetProtectionPolicy.Builder(); method @NonNull public android.app.admin.FactoryResetProtectionPolicy build(); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionAccounts(@NonNull java.util.List<java.lang.String>); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionDisabled(boolean); method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionEnabled(boolean); } public class FreezePeriod {
core/java/android/app/admin/FactoryResetProtectionPolicy.java +26 −24 Original line number Diff line number Diff line Loading @@ -53,17 +53,17 @@ public final class FactoryResetProtectionPolicy implements Parcelable { private static final String KEY_FACTORY_RESET_PROTECTION_ACCOUNT = "factory_reset_protection_account"; private static final String KEY_FACTORY_RESET_PROTECTION_DISABLED = "factory_reset_protection_disabled"; private static final String KEY_FACTORY_RESET_PROTECTION_ENABLED = "factory_reset_protection_enabled"; private static final String ATTR_VALUE = "value"; private final List<String> mFactoryResetProtectionAccounts; private final boolean mFactoryResetProtectionDisabled; private final boolean mFactoryResetProtectionEnabled; private FactoryResetProtectionPolicy(List<String> factoryResetProtectionAccounts, boolean factoryResetProtectionDisabled) { boolean factoryResetProtectionEnabled) { mFactoryResetProtectionAccounts = factoryResetProtectionAccounts; mFactoryResetProtectionDisabled = factoryResetProtectionDisabled; mFactoryResetProtectionEnabled = factoryResetProtectionEnabled; } /** Loading @@ -74,10 +74,10 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } /** * Return whether factory reset protection for the device is disabled or not. * Return whether factory reset protection for the device is enabled or not. */ public boolean isFactoryResetProtectionDisabled() { return mFactoryResetProtectionDisabled; public boolean isFactoryResetProtectionEnabled() { return mFactoryResetProtectionEnabled; } /** Loading @@ -85,12 +85,13 @@ public final class FactoryResetProtectionPolicy implements Parcelable { */ public static class Builder { private List<String> mFactoryResetProtectionAccounts; private boolean mFactoryResetProtectionDisabled; private boolean mFactoryResetProtectionEnabled; /** * Initialize a new Builder to construct a {@link FactoryResetProtectionPolicy}. */ public Builder() { mFactoryResetProtectionEnabled = true; }; /** Loading @@ -113,18 +114,19 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } /** * Sets whether factory reset protection is disabled or not. * Sets whether factory reset protection is enabled or not. * <p> * Once disabled, factory reset protection will not kick in all together when the device * goes through untrusted factory reset. This applies to both the consumer unlock flow and * the admin account overrides via {@link #setFactoryResetProtectionAccounts} * the admin account overrides via {@link #setFactoryResetProtectionAccounts}. By default, * factory reset protection is enabled. * * @param factoryResetProtectionDisabled Whether the policy is disabled or not. * @param factoryResetProtectionEnabled Whether the policy is enabled or not. * @return the same Builder instance. */ @NonNull public Builder setFactoryResetProtectionDisabled(boolean factoryResetProtectionDisabled) { mFactoryResetProtectionDisabled = factoryResetProtectionDisabled; public Builder setFactoryResetProtectionEnabled(boolean factoryResetProtectionEnabled) { mFactoryResetProtectionEnabled = factoryResetProtectionEnabled; return this; } Loading @@ -136,7 +138,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { @NonNull public FactoryResetProtectionPolicy build() { return new FactoryResetProtectionPolicy(mFactoryResetProtectionAccounts, mFactoryResetProtectionDisabled); mFactoryResetProtectionEnabled); } } Loading @@ -144,7 +146,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { public String toString() { return "FactoryResetProtectionPolicy{" + "mFactoryResetProtectionAccounts=" + mFactoryResetProtectionAccounts + ", mFactoryResetProtectionDisabled=" + mFactoryResetProtectionDisabled + ", mFactoryResetProtectionEnabled=" + mFactoryResetProtectionEnabled + '}'; } Loading @@ -155,7 +157,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { for (String account: mFactoryResetProtectionAccounts) { dest.writeString(account); } dest.writeBoolean(mFactoryResetProtectionDisabled); dest.writeBoolean(mFactoryResetProtectionEnabled); } @Override Loading @@ -173,10 +175,10 @@ public final class FactoryResetProtectionPolicy implements Parcelable { for (int i = 0; i < accountsCount; i++) { factoryResetProtectionAccounts.add(in.readString()); } boolean factoryResetProtectionDisabled = in.readBoolean(); boolean factoryResetProtectionEnabled = in.readBoolean(); return new FactoryResetProtectionPolicy(factoryResetProtectionAccounts, factoryResetProtectionDisabled); factoryResetProtectionEnabled); } @Override Loading @@ -195,8 +197,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable { @Nullable public static FactoryResetProtectionPolicy readFromXml(@NonNull XmlPullParser parser) { try { boolean factoryResetProtectionDisabled = Boolean.parseBoolean( parser.getAttributeValue(null, KEY_FACTORY_RESET_PROTECTION_DISABLED)); boolean factoryResetProtectionEnabled = Boolean.parseBoolean( parser.getAttributeValue(null, KEY_FACTORY_RESET_PROTECTION_ENABLED)); List<String> factoryResetProtectionAccounts = new ArrayList<>(); int outerDepth = parser.getDepth(); Loading @@ -214,7 +216,7 @@ public final class FactoryResetProtectionPolicy implements Parcelable { } return new FactoryResetProtectionPolicy(factoryResetProtectionAccounts, factoryResetProtectionDisabled); factoryResetProtectionEnabled); } catch (XmlPullParserException | IOException e) { Log.w(LOG_TAG, "Reading from xml failed", e); } Loading @@ -225,8 +227,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable { * @hide */ public void writeToXml(@NonNull XmlSerializer out) throws IOException { out.attribute(null, KEY_FACTORY_RESET_PROTECTION_DISABLED, Boolean.toString(mFactoryResetProtectionDisabled)); out.attribute(null, KEY_FACTORY_RESET_PROTECTION_ENABLED, Boolean.toString(mFactoryResetProtectionEnabled)); for (String account : mFactoryResetProtectionAccounts) { out.startTag(null, KEY_FACTORY_RESET_PROTECTION_ACCOUNT); out.attribute(null, ATTR_VALUE, account); Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +5 −5 Original line number Diff line number Diff line Loading @@ -2087,7 +2087,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(new ArrayList<>()) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); dpm.setFactoryResetProtectionPolicy(admin1, policy); Loading @@ -2105,7 +2105,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { setupProfileOwner(); FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); assertExpectException(SecurityException.class, null, Loading Loading @@ -2157,7 +2157,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(new ArrayList<>()) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); dpm.setFactoryResetProtectionPolicy(admin1, policy); Loading @@ -2177,8 +2177,8 @@ public class DevicePolicyManagerTest extends DpmTestBase { private void assertPoliciesAreEqual(FactoryResetProtectionPolicy expectedPolicy, FactoryResetProtectionPolicy actualPolicy) { assertThat(actualPolicy.isFactoryResetProtectionDisabled()).isEqualTo( expectedPolicy.isFactoryResetProtectionDisabled()); assertThat(actualPolicy.isFactoryResetProtectionEnabled()).isEqualTo( expectedPolicy.isFactoryResetProtectionEnabled()); assertAccountsAreEqual(expectedPolicy.getFactoryResetProtectionAccounts(), actualPolicy.getFactoryResetProtectionAccounts()); } Loading
services/tests/servicestests/src/com/android/server/devicepolicy/FactoryResetProtectionPolicyTest.java +4 −4 Original line number Diff line number Diff line Loading @@ -62,7 +62,7 @@ public class FactoryResetProtectionPolicyTest { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(accounts) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); testParcelAndUnparcel(policy); Loading @@ -77,7 +77,7 @@ public class FactoryResetProtectionPolicyTest { FactoryResetProtectionPolicy policy = new FactoryResetProtectionPolicy.Builder() .setFactoryResetProtectionAccounts(accounts) .setFactoryResetProtectionDisabled(true) .setFactoryResetProtectionEnabled(false) .build(); testParcelAndUnparcel(policy); Loading Loading @@ -133,8 +133,8 @@ public class FactoryResetProtectionPolicyTest { private void assertPoliciesAreEqual(FactoryResetProtectionPolicy expectedPolicy, FactoryResetProtectionPolicy actualPolicy) { assertEquals(expectedPolicy.isFactoryResetProtectionDisabled(), actualPolicy.isFactoryResetProtectionDisabled()); assertEquals(expectedPolicy.isFactoryResetProtectionEnabled(), actualPolicy.isFactoryResetProtectionEnabled()); assertAccountsAreEqual(expectedPolicy.getFactoryResetProtectionAccounts(), actualPolicy.getFactoryResetProtectionAccounts()); } Loading