Merge "Master mute is valid when running fixed volume for automotive" into pi-dev

This commit is contained in:
Hongwei Wang
2018-05-31 01:22:45 +00:00
committed by Android (Google) Code Review

View File

@@ -215,6 +215,10 @@ public class AudioService extends IAudioService.Stub
return mPlatformType == AudioSystem.PLATFORM_TELEVISION; return mPlatformType == AudioSystem.PLATFORM_TELEVISION;
} }
private boolean isPlatformAutomotive() {
return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
}
/** The controller for the volume UI. */ /** The controller for the volume UI. */
private final VolumeController mVolumeController = new VolumeController(); private final VolumeController mVolumeController = new VolumeController();
@@ -2367,8 +2371,11 @@ public class AudioService extends IAudioService.Stub
if (DEBUG_VOL) { if (DEBUG_VOL) {
Log.d(TAG, String.format("Master mute %s, %d, user=%d", mute, flags, userId)); Log.d(TAG, String.format("Master mute %s, %d, user=%d", mute, flags, userId));
} }
if (mUseFixedVolume) { if (!isPlatformAutomotive() && mUseFixedVolume) {
return; // If using fixed volume, we don't mute. // If using fixed volume, we don't mute.
// TODO: remove the isPlatformAutomotive check here.
// The isPlatformAutomotive check is added for safety but may not be necessary.
return;
} }
if (getCurrentUserId() == userId) { if (getCurrentUserId() == userId) {
if (mute != AudioSystem.getMasterMute()) { if (mute != AudioSystem.getMasterMute()) {