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
Loading
Please register or sign in to comment