Loading media/java/android/media/AudioManager.java +2 −29 Original line number Diff line number Diff line Loading @@ -55,12 +55,10 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -3548,20 +3546,7 @@ public class AudioManager { * whether sounds are heard or not. */ public void playSoundEffect(@SystemSoundEffect int effectType) { if (effectType < 0 || effectType >= NUM_SOUND_EFFECTS) { return; } if (!querySoundEffectsEnabled(Process.myUserHandle().getIdentifier())) { return; } final IAudioService service = getService(); try { service.playSoundEffect(effectType); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } playSoundEffect(effectType, UserHandle.USER_CURRENT); } /** Loading @@ -3577,13 +3562,9 @@ public class AudioManager { return; } if (!querySoundEffectsEnabled(userId)) { return; } final IAudioService service = getService(); try { service.playSoundEffect(effectType); service.playSoundEffect(effectType, userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -3611,14 +3592,6 @@ public class AudioManager { } } /** * Settings has an in memory cache, so this is fast. */ private boolean querySoundEffectsEnabled(int user) { return Settings.System.getIntForUser(getContext().getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 0, user) != 0; } /** * Load Sound effects. * This method must be called when sound effects are enabled. Loading media/java/android/media/IAudioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ interface IAudioService { int getMode(); oneway void playSoundEffect(int effectType); oneway void playSoundEffect(int effectType, int userId); oneway void playSoundEffectVolume(int effectType, float volume); Loading packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -377,7 +377,8 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa private void playTouchFeedback() { if (System.currentTimeMillis() - mLastToggledRingerOn < TOUCH_FEEDBACK_TIMEOUT_MS) { try { mAudioService.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD); mAudioService.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, UserHandle.USER_CURRENT); } catch (RemoteException e) { // ignore } Loading services/core/java/com/android/server/audio/AudioService.java +13 −3 Original line number Diff line number Diff line Loading @@ -5037,10 +5037,20 @@ public class AudioService extends IAudioService.Stub } } /** @see AudioManager#playSoundEffect(int) */ public void playSoundEffect(int effectType) { /** @see AudioManager#playSoundEffect(int, int) */ public void playSoundEffect(int effectType, int userId) { if (querySoundEffectsEnabled(userId)) { playSoundEffectVolume(effectType, -1.0f); } } /** * Settings has an in memory cache, so this is fast. */ private boolean querySoundEffectsEnabled(int user) { return Settings.System.getIntForUser(getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 0, user) != 0; } /** @see AudioManager#playSoundEffect(int, float) */ public void playSoundEffectVolume(int effectType, float volume) { Loading Loading
media/java/android/media/AudioManager.java +2 −29 Original line number Diff line number Diff line Loading @@ -55,12 +55,10 @@ import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.Message; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Log; Loading Loading @@ -3548,20 +3546,7 @@ public class AudioManager { * whether sounds are heard or not. */ public void playSoundEffect(@SystemSoundEffect int effectType) { if (effectType < 0 || effectType >= NUM_SOUND_EFFECTS) { return; } if (!querySoundEffectsEnabled(Process.myUserHandle().getIdentifier())) { return; } final IAudioService service = getService(); try { service.playSoundEffect(effectType); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } playSoundEffect(effectType, UserHandle.USER_CURRENT); } /** Loading @@ -3577,13 +3562,9 @@ public class AudioManager { return; } if (!querySoundEffectsEnabled(userId)) { return; } final IAudioService service = getService(); try { service.playSoundEffect(effectType); service.playSoundEffect(effectType, userId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading Loading @@ -3611,14 +3592,6 @@ public class AudioManager { } } /** * Settings has an in memory cache, so this is fast. */ private boolean querySoundEffectsEnabled(int user) { return Settings.System.getIntForUser(getContext().getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 0, user) != 0; } /** * Load Sound effects. * This method must be called when sound effects are enabled. Loading
media/java/android/media/IAudioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -158,7 +158,7 @@ interface IAudioService { int getMode(); oneway void playSoundEffect(int effectType); oneway void playSoundEffect(int effectType, int userId); oneway void playSoundEffectVolume(int effectType, float volume); Loading
packages/SystemUI/src/com/android/systemui/volume/VolumeDialogControllerImpl.java +2 −1 Original line number Diff line number Diff line Loading @@ -377,7 +377,8 @@ public class VolumeDialogControllerImpl implements VolumeDialogController, Dumpa private void playTouchFeedback() { if (System.currentTimeMillis() - mLastToggledRingerOn < TOUCH_FEEDBACK_TIMEOUT_MS) { try { mAudioService.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD); mAudioService.playSoundEffect(AudioManager.FX_KEYPRESS_STANDARD, UserHandle.USER_CURRENT); } catch (RemoteException e) { // ignore } Loading
services/core/java/com/android/server/audio/AudioService.java +13 −3 Original line number Diff line number Diff line Loading @@ -5037,10 +5037,20 @@ public class AudioService extends IAudioService.Stub } } /** @see AudioManager#playSoundEffect(int) */ public void playSoundEffect(int effectType) { /** @see AudioManager#playSoundEffect(int, int) */ public void playSoundEffect(int effectType, int userId) { if (querySoundEffectsEnabled(userId)) { playSoundEffectVolume(effectType, -1.0f); } } /** * Settings has an in memory cache, so this is fast. */ private boolean querySoundEffectsEnabled(int user) { return Settings.System.getIntForUser(getContentResolver(), Settings.System.SOUND_EFFECTS_ENABLED, 0, user) != 0; } /** @see AudioManager#playSoundEffect(int, float) */ public void playSoundEffectVolume(int effectType, float volume) { Loading