Save password requirements on the right user

When changing the password requirements, two changes have to be saved:
(1) Whether the current password complies with the new password
requirements.
(2) The new password requirements themselves.

(1) is stored on the credential owner of the user, (2) is stored on the
user itself.

In ag/3729963 (Change-ID: Ide5b2e53cf100b087822844ca51b3bc69e7ddf82),
we've switched from saving the password sufficiency flag (1) in the
user to the credential owner.
A side effect was that the password requirements themselves, (2), which
were changed on the original user the call related to, were not saved.

This fixes the bug introduced in the aforementioned CL.

Bug: 78499736
Test: Manual with TestDPC.
Change-Id: I11faef37fa6f0e8e8e558069e77021c48ee36cd4
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index b76064b..1acecfc 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -4259,7 +4259,14 @@
 
         // Drain ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED broadcasts as part of
         // reportPasswordChanged()
-        verify(mContext.spiedContext, times(3)).sendBroadcastAsUser(
+        // This broadcast should be sent 4 times:
+        // * Twice from calls to DevicePolicyManagerService.updatePasswordExpirationsLocked,
+        //   once for each affected user, in DevicePolicyManagerService.reportPasswordChanged.
+        // * Twice from calls to DevicePolicyManagerService.saveSettingsLocked
+        //   in DevicePolicyManagerService.reportPasswordChanged, once with the userId
+        //   the password change is relevant to and another with the credential owner of said
+        //   userId.
+        verify(mContext.spiedContext, times(4)).sendBroadcastAsUser(
                 MockUtils.checkIntentAction(
                         DevicePolicyManager.ACTION_DEVICE_POLICY_MANAGER_STATE_CHANGED),
                 MockUtils.checkUserHandle(userHandle));