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

Commit 495c62c1 authored by Haofan Wang's avatar Haofan Wang
Browse files

Fix cache in update picture profile

MQ should update the cache with original handle as key instead of
current handle(dbId).

Test: Gambit
Flag: EXEMPT bugfix
Bug: 427663034
Change-Id: Ie0f9de8f16921a25efbf6eccc2ef67edcfc8e225
parent c4063535
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -390,7 +390,10 @@ public class MediaQualityService extends SystemService {
                    // Keep cache in sync with database, and check for profile id and handle of the
                    // updated picture profile, because user might call this with a picture profile
                    // without handle or profileId.
                    PictureProfile cachedPp = mOriginalHandleToCurrentPictureProfile.get(dbId);
                    Long originalHandle = mCurrentPictureHandleToOriginal.getValue(dbId);
                    if (originalHandle != null) {
                        PictureProfile cachedPp = mOriginalHandleToCurrentPictureProfile
                                .get(originalHandle);
                        if (cachedPp != null) {
                            if (pp.getProfileId() == null
                                    || pp.getHandle() == PictureProfileHandle.NONE) {
@@ -398,11 +401,14 @@ public class MediaQualityService extends SystemService {
                                        .setProfileId(cachedPp.getProfileId())
                                        .setParameters(pp.getParameters())
                                        .build();
                            mOriginalHandleToCurrentPictureProfile.put(dbId, cachedPp);
                                mOriginalHandleToCurrentPictureProfile
                                        .put(originalHandle, cachedPp);
                            } else {
                            mOriginalHandleToCurrentPictureProfile.put(dbId, pp);
                                mOriginalHandleToCurrentPictureProfile.put(originalHandle, pp);
                            }
                        }
                    }

                    if (isPackageDefaultPictureProfile(pp)) {
                        if (DEBUG) {
                            Slog.d(TAG, "updatePictureProfile: "