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

Commit ea5a59c3 authored by Himanshu Gupta's avatar Himanshu Gupta
Browse files

Fixing read from mUsersRedirectedToOwnerForMedia sparse array.

ag/21547694 introduced some fixes in ContentProvider for clone
profile. However, a new bug was also introduced due to incorrect
index calculation. This CL fixes the same.

Bug: 270350104
Test: atest AppCloningHostTest
Change-Id: Iea3cc4b40194d809a62457899d7c4e96021692d7
parent b130b003
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -892,8 +892,9 @@ public abstract class ContentProvider implements ContentInterface, ComponentCall
     */
    private boolean isContentRedirectionAllowedForUser(int incomingUserId) {
        if (MediaStore.AUTHORITY.equals(mAuthority)) {
            if (mUsersRedirectedToOwnerForMedia.indexOfKey(incomingUserId) >= 0) {
                return mUsersRedirectedToOwnerForMedia.valueAt(incomingUserId);
            int incomingUserIdIndex = mUsersRedirectedToOwnerForMedia.indexOfKey(incomingUserId);
            if (incomingUserIdIndex >= 0) {
                return mUsersRedirectedToOwnerForMedia.valueAt(incomingUserIdIndex);
            }

            // Haven't seen this user yet, look it up