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

Commit 8edb5771 authored by Hyundo Moon's avatar Hyundo Moon Committed by android-build-merger
Browse files

Merge "Prevent system crash when adjusting volume with illegal direction" into oc-mr1-dev

am: ec0fc85a

Change-Id: I68535fbc5a90e49e928c89fa94c2ca970bb8bf78
parents e9f85bdb ec0fc85a
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -462,10 +462,11 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
        mHandler.post(new Runnable() {
            @Override
            public void run() {
                try {
                    if (useSuggested) {
                        if (AudioSystem.isStreamActive(stream, 0)) {
                        mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream, direction,
                                flags, packageName, uid);
                            mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(stream,
                                    direction, flags, packageName, uid);
                        } else {
                            mAudioManagerInternal.adjustSuggestedStreamVolumeForUid(
                                    AudioManager.USE_DEFAULT_STREAM_TYPE, direction,
@@ -475,6 +476,12 @@ public class MediaSessionRecord implements IBinder.DeathRecipient {
                        mAudioManagerInternal.adjustStreamVolumeForUid(stream, direction, flags,
                                packageName, uid);
                    }
                } catch (IllegalArgumentException e) {
                    Log.e(TAG, "Cannot adjust volume: direction=" + direction + ", stream="
                            + stream + ", flags=" + flags + ", packageName=" + packageName
                            + ", uid=" + uid + ", useSuggested=" + useSuggested
                            + ", previousFlagPlaySound=" + previousFlagPlaySound, e);
                }
            }
        });
    }
+4 −0
Original line number Diff line number Diff line
@@ -1363,6 +1363,10 @@ public class MediaSessionService extends SystemService implements Monitor {
                                    flags, packageName, TAG);
                        } catch (RemoteException e) {
                            Log.e(TAG, "Error adjusting default volume.", e);
                        } catch (IllegalArgumentException e) {
                            Log.e(TAG, "Cannot adjust volume: direction=" + direction
                                    + ", suggestedStream=" + suggestedStream + ", flags=" + flags,
                                    e);
                        }
                    }
                });