Loading core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -19911,6 +19911,7 @@ package android.media { field public static final int FLAG_REMOVE_SOUND_AND_VIBRATE = 8; // 0x8 field public static final int FLAG_SHOW_UI = 1; // 0x1 field public static final int FLAG_VIBRATE = 16; // 0x10 field public static final int FX_BACK = 10; // 0xa field public static final int FX_FOCUS_NAVIGATION_DOWN = 2; // 0x2 field public static final int FX_FOCUS_NAVIGATION_LEFT = 3; // 0x3 field public static final int FX_FOCUS_NAVIGATION_RIGHT = 4; // 0x4 core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4600,4 +4600,9 @@ <!-- If true, attach the navigation bar to the app during app transition --> <bool name="config_attachNavBarToAppDuringTransition">false</bool> <!-- Flag indicating that the media framework should play a back sound when a back-transition happens that doesn't result in bringing the home task to the front. This is currently only used on TV. --> <bool name="config_enableBackSound">false</bool> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4142,4 +4142,6 @@ <java-symbol type="dimen" name="accessibility_focus_highlight_stroke_width" /> <java-symbol type="bool" name="config_attachNavBarToAppDuringTransition" /> <java-symbol type="bool" name="config_enableBackSound" /> </resources> core/res/res/xml/audio_assets.xml +11 −14 Original line number Diff line number Diff line Loading @@ -19,12 +19,9 @@ <!-- Mapping of UI sound effects to audio assets under /system/media/audio/ui. Modify this file to override default sound assets. Currently only touch sounds can be overridden. Other groups can be added in the future for other UI sounds like camera, lock, dock... --> <audio_assets version="1.0"> <group name="touch_sounds"> <asset id="FX_KEY_CLICK" file="Effect_Tick.ogg"/> <asset id="FX_FOCUS_NAVIGATION_UP" file="Effect_Tick.ogg"/> <asset id="FX_FOCUS_NAVIGATION_DOWN" file="Effect_Tick.ogg"/> Loading @@ -35,5 +32,5 @@ <asset id="FX_KEYPRESS_DELETE" file="KeypressDelete.ogg"/> <asset id="FX_KEYPRESS_RETURN" file="KeypressReturn.ogg"/> <asset id="FX_KEYPRESS_INVALID" file="KeypressInvalid.ogg"/> </group> <asset id="FX_BACK" file="Effect_Tick.ogg"/> </audio_assets> media/java/android/media/AudioManager.java +134 −2 Original line number Diff line number Diff line Loading @@ -3096,11 +3096,140 @@ public class AudioManager { * @see #playSoundEffect(int) */ public static final int FX_KEYPRESS_INVALID = 9; /** * Back sound * @see #playSoundEffect(int) */ public static final int FX_BACK = 10; /** * @hide Home sound * Played by the framework when the home app becomes active if config_enableHomeSound is set to * true. This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml. * @see #playSoundEffect(int) */ public static final int FX_HOME = 11; /** * @hide Fast scroll sound 1 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_1 = 12; /** * @hide Fast scroll sound 2 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_2 = 13; /** * @hide Fast scroll sound 3 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_3 = 14; /** * @hide Fast scroll sound 4 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_4 = 15; /** * @hide Number of sound effects */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static final int NUM_SOUND_EFFECTS = 10; public static final int NUM_SOUND_EFFECTS = 16; /** * @hide Number of fast scroll sound effects */ public static final int NUM_FAST_SCROLL_SOUND_EFFECTS = 4; /** * @hide * @param n a value in [0, {@link #NUM_FAST_SCROLL_SOUND_EFFECTS}[ * @return The id of a fast scroll sound effect or -1 if out of bounds */ public static int getNthFastScrollSoundEffectId(int n) { switch (n) { case 0: return FX_FAST_SCROLL_1; case 1: return FX_FAST_SCROLL_2; case 2: return FX_FAST_SCROLL_3; case 3: return FX_FAST_SCROLL_4; default: Log.w(TAG, "Invalid fast-scroll sound effect id: " + n); return -1; } } /** * @hide */ public void setFastScrollSoundEffectsEnabled(boolean enabled) { try { getService().setFastScrollSoundEffectsEnabled(enabled); } catch (RemoteException e) { } } /** * @hide * @return true if the fast scroll sound effects are enabled */ public boolean areFastScrollSoundEffectsEnabled() { try { return getService().areFastScrollSoundEffectsEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * @hide * @param enabled */ public void setHomeSoundEffectEnabled(boolean enabled) { try { getService().setHomeSoundEffectEnabled(enabled); } catch (RemoteException e) { } } /** * @hide * @return true if the home sound effect is enabled */ public boolean isHomeSoundEffectEnabled() { try { return getService().isHomeSoundEffectEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Plays a sound effect (Key clicks, lid open/close...) Loading @@ -3115,6 +3244,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * NOTE: This version uses the UI settings to determine * whether sounds are heard or not. */ Loading Loading @@ -3148,6 +3278,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * @param userId The current user to pull sound settings from * NOTE: This version uses the UI settings to determine * whether sounds are heard or not. Loading Loading @@ -3183,6 +3314,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * @param volume Sound effect volume. * The volume value is a raw scalar so UI controls should be scaled logarithmically. * If a volume of -1 is specified, the AudioManager.STREAM_MUSIC stream volume minus 3dB will be used. Loading Loading
core/api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -19911,6 +19911,7 @@ package android.media { field public static final int FLAG_REMOVE_SOUND_AND_VIBRATE = 8; // 0x8 field public static final int FLAG_SHOW_UI = 1; // 0x1 field public static final int FLAG_VIBRATE = 16; // 0x10 field public static final int FX_BACK = 10; // 0xa field public static final int FX_FOCUS_NAVIGATION_DOWN = 2; // 0x2 field public static final int FX_FOCUS_NAVIGATION_LEFT = 3; // 0x3 field public static final int FX_FOCUS_NAVIGATION_RIGHT = 4; // 0x4
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4600,4 +4600,9 @@ <!-- If true, attach the navigation bar to the app during app transition --> <bool name="config_attachNavBarToAppDuringTransition">false</bool> <!-- Flag indicating that the media framework should play a back sound when a back-transition happens that doesn't result in bringing the home task to the front. This is currently only used on TV. --> <bool name="config_enableBackSound">false</bool> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4142,4 +4142,6 @@ <java-symbol type="dimen" name="accessibility_focus_highlight_stroke_width" /> <java-symbol type="bool" name="config_attachNavBarToAppDuringTransition" /> <java-symbol type="bool" name="config_enableBackSound" /> </resources>
core/res/res/xml/audio_assets.xml +11 −14 Original line number Diff line number Diff line Loading @@ -19,12 +19,9 @@ <!-- Mapping of UI sound effects to audio assets under /system/media/audio/ui. Modify this file to override default sound assets. Currently only touch sounds can be overridden. Other groups can be added in the future for other UI sounds like camera, lock, dock... --> <audio_assets version="1.0"> <group name="touch_sounds"> <asset id="FX_KEY_CLICK" file="Effect_Tick.ogg"/> <asset id="FX_FOCUS_NAVIGATION_UP" file="Effect_Tick.ogg"/> <asset id="FX_FOCUS_NAVIGATION_DOWN" file="Effect_Tick.ogg"/> Loading @@ -35,5 +32,5 @@ <asset id="FX_KEYPRESS_DELETE" file="KeypressDelete.ogg"/> <asset id="FX_KEYPRESS_RETURN" file="KeypressReturn.ogg"/> <asset id="FX_KEYPRESS_INVALID" file="KeypressInvalid.ogg"/> </group> <asset id="FX_BACK" file="Effect_Tick.ogg"/> </audio_assets>
media/java/android/media/AudioManager.java +134 −2 Original line number Diff line number Diff line Loading @@ -3096,11 +3096,140 @@ public class AudioManager { * @see #playSoundEffect(int) */ public static final int FX_KEYPRESS_INVALID = 9; /** * Back sound * @see #playSoundEffect(int) */ public static final int FX_BACK = 10; /** * @hide Home sound * Played by the framework when the home app becomes active if config_enableHomeSound is set to * true. This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml. * @see #playSoundEffect(int) */ public static final int FX_HOME = 11; /** * @hide Fast scroll sound 1 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_1 = 12; /** * @hide Fast scroll sound 2 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_2 = 13; /** * @hide Fast scroll sound 3 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_3 = 14; /** * @hide Fast scroll sound 4 * To be by the framework when a fast-scrolling is performed and * {@link #areFastScrollSoundEffectsEnabled()} is true. * This is currently only used on TV devices. * Note that this sound is only available if a sound file is specified in audio_assets.xml * @see #playSoundEffect(int) */ public static final int FX_FAST_SCROLL_4 = 15; /** * @hide Number of sound effects */ @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) public static final int NUM_SOUND_EFFECTS = 10; public static final int NUM_SOUND_EFFECTS = 16; /** * @hide Number of fast scroll sound effects */ public static final int NUM_FAST_SCROLL_SOUND_EFFECTS = 4; /** * @hide * @param n a value in [0, {@link #NUM_FAST_SCROLL_SOUND_EFFECTS}[ * @return The id of a fast scroll sound effect or -1 if out of bounds */ public static int getNthFastScrollSoundEffectId(int n) { switch (n) { case 0: return FX_FAST_SCROLL_1; case 1: return FX_FAST_SCROLL_2; case 2: return FX_FAST_SCROLL_3; case 3: return FX_FAST_SCROLL_4; default: Log.w(TAG, "Invalid fast-scroll sound effect id: " + n); return -1; } } /** * @hide */ public void setFastScrollSoundEffectsEnabled(boolean enabled) { try { getService().setFastScrollSoundEffectsEnabled(enabled); } catch (RemoteException e) { } } /** * @hide * @return true if the fast scroll sound effects are enabled */ public boolean areFastScrollSoundEffectsEnabled() { try { return getService().areFastScrollSoundEffectsEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * @hide * @param enabled */ public void setHomeSoundEffectEnabled(boolean enabled) { try { getService().setHomeSoundEffectEnabled(enabled); } catch (RemoteException e) { } } /** * @hide * @return true if the home sound effect is enabled */ public boolean isHomeSoundEffectEnabled() { try { return getService().isHomeSoundEffectEnabled(); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Plays a sound effect (Key clicks, lid open/close...) Loading @@ -3115,6 +3244,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * NOTE: This version uses the UI settings to determine * whether sounds are heard or not. */ Loading Loading @@ -3148,6 +3278,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * @param userId The current user to pull sound settings from * NOTE: This version uses the UI settings to determine * whether sounds are heard or not. Loading Loading @@ -3183,6 +3314,7 @@ public class AudioManager { * {@link #FX_KEYPRESS_DELETE}, * {@link #FX_KEYPRESS_RETURN}, * {@link #FX_KEYPRESS_INVALID}, * {@link #FX_BACK}, * @param volume Sound effect volume. * The volume value is a raw scalar so UI controls should be scaled logarithmically. * If a volume of -1 is specified, the AudioManager.STREAM_MUSIC stream volume minus 3dB will be used. Loading