Loading
Save the user id when iterating mLocalPolicies
mLocalPolicies is a sparse array of user ids, whenever a new user is added, the keyAt(i) function may return different results. To avoid crashes or unexpected behavior, save the user id for subsequent calls. Now when new users are added, we may skip iterating over them, or iterate over the same user twice. This issue seems to exist in multiple places in policy engine and I will take a look in a follow up. Fix: 374511959 Test: atest com.android.cts.devicepolicy.ManagedProfileTest Flag: EXEMPT BUG_FIX Change-Id: Ifb34be2f33bc1e7c9b8cee3f8c26642766a5d101