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

Commit 3b7d59da authored by lijilou's avatar lijilou Committed by Jilou li
Browse files

FadeOutManager: the NPE problem due to add null value to SparseArray.

In some cases,the getFadeOutVolumeShaperConfig method may return null value.

Test: OEM monkey test
Flag: EXEMPT bugfix
Bug: 384435132
Change-Id: Ie75934f9520d0747c3baeb82bbef48c9d3227660
parent b8b78a30
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ public final class FadeManagerConfiguration implements Parcelable {
        return config != null ? config.getDuration() : DURATION_NOT_SET;
    }

    @Nullable
    private VolumeShaper.Configuration getVolumeShaperConfigFromWrapper(
            FadeVolumeShaperConfigsWrapper wrapper, boolean isFadeIn) {
        // if no volume shaper config is available, return null
+4 −2
Original line number Diff line number Diff line
@@ -199,10 +199,12 @@ public final class FadeOutManager {
            for (AudioPlaybackConfiguration apc : players) {
                final VolumeShaper.Configuration volShaper =
                        mFadeConfigurations.getFadeOutVolumeShaperConfig(apc.getAudioAttributes());
                if (volShaper != null) {
                    fa.addFade(apc, /* skipRamp= */ false, volShaper);
                }
            }
        }
    }

    /**
     * Remove the app for the given UID from the list of faded out apps, unfade out its players
@@ -249,7 +251,7 @@ public final class FadeOutManager {
            final VolumeShaper.Configuration volShaper =
                    mFadeConfigurations.getFadeOutVolumeShaperConfig(apc.getAudioAttributes());
            final FadedOutApp fa = mUidToFadedAppsMap.get(apc.getClientUid());
            if (fa == null) {
            if (fa == null || volShaper == null) {
                return;
            }
            fa.addFade(apc, /* skipRamp= */ true, volShaper);