Skip to content
Commit d0446dc8 authored by hyomin.oh's avatar hyomin.oh
Browse files

Fixed unsafe lock upon safe media volume

Safe media volume uses lock as Integer.
But it is not safe since the Integer value is changed.

disableSafeMediaVolume()
   synchronized (mSafeMediaVolumeState)  // step. 1
      setSafeMediaVolumeEnabled()
         mSafeMediaVolumeState = SAFE_MEDIA_VOLUME_ACTIVE  // step. 2
      ...
      onSetStreamVolume(mPendingVolumeCommand.mStreamType, // step.4
      -> mPendingVolumeCommand is set as null by step.3
      -> it causes NPE and reboot

------------

setStreamVolume()
   synchronized (mSafeMediaVolumeState)
   -> mSafeMediaVolumeState was changed by step.2
   -> so that it would go next step
      mPendingVolumeCommand = null;  // step. 3

Test: Build Pass, manual test, change volume
Change-Id: I33f473d42ccbf0f9b177c6886622ecc2f8020f8d
parent 7b9184bf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment