Merge "Fix testPasswordMinimumRestrictions"
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
index 9874b75..79b7b2b 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
@@ -51,8 +51,10 @@
         if (!mHasFeature || !mHasSecureLockScreen) {
             return;
         }
+        disableParentRestrictionChange();
         runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".PasswordMinimumRestrictionsTest",
                 mProfileUserId);
+        enableParentRestrictionChange();
     }
 
     @FlakyTest
@@ -256,4 +258,14 @@
                         + "lockNow(FLAG_SECURE_USER_DATA)",
                 TIMEOUT_USER_LOCKED_MILLIS);
     }
+
+    private void disableParentRestrictionChange() throws Exception {
+        final String cmd = "am compat disable 165573442 " + MANAGED_PROFILE_PKG;
+        getDevice().executeShellCommand(cmd);
+    }
+
+    private void enableParentRestrictionChange() throws Exception {
+        final String cmd = "am compat enable 165573442 " + MANAGED_PROFILE_PKG;
+        getDevice().executeShellCommand(cmd);
+    }
 }