diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index b9b91f84af..85c93e31f4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -2060,7 +2060,7 @@ public class OsmandSettings { public final OsmandPreference LEVEL_TO_SWITCH_VECTOR_RASTER = new IntPreference("level_to_switch_vector_raster", 1).makeGlobal().cache(); // this value string is synchronized with settings_pref.xml preference name - public final OsmandPreference AUDIO_STREAM_GUIDANCE = new IntPreference("audio_stream", 3/*AudioManager.STREAM_MUSIC*/) { + public final OsmandPreference AUDIO_MANAGER_STREAM = new IntPreference("audio_stream", 3/*AudioManager.STREAM_MUSIC*/) { @Override protected boolean setValue(Object prefs, Integer stream) { boolean valueSaved = super.setValue(prefs, stream); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index b7f163f14c..76e2f25588 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -798,8 +798,8 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven // for voice navigation ApplicationMode routingAppMode = getRoutingHelper().getAppMode(); - if (routingAppMode != null && settings.AUDIO_STREAM_GUIDANCE.getModeValue(routingAppMode) != null) { - setVolumeControlStream(settings.AUDIO_STREAM_GUIDANCE.getModeValue(routingAppMode)); + if (routingAppMode != null && settings.AUDIO_MANAGER_STREAM.getModeValue(routingAppMode) != null) { + setVolumeControlStream(settings.AUDIO_MANAGER_STREAM.getModeValue(routingAppMode)); } else { setVolumeControlStream(AudioManager.STREAM_MUSIC); } diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index ddc69f48c8..c7854100ba 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -264,7 +264,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { AudioManager.STREAM_NOTIFICATION, AudioManager.STREAM_VOICE_CALL}; //AudioManager.USE_DEFAULT_STREAM_TYPE}; ListPreference lp = createListPreference( - settings.AUDIO_STREAM_GUIDANCE, streamTypes, streamIntTypes , R.string.choose_audio_stream, + settings.AUDIO_MANAGER_STREAM, streamTypes, streamIntTypes , R.string.choose_audio_stream, R.string.choose_audio_stream_descr); final Preference.OnPreferenceChangeListener prev = lp.getOnPreferenceChangeListener(); lp.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -274,11 +274,11 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { prev.onPreferenceChange(preference, newValue); CommandPlayer player = getMyApplication().getPlayer(); if (player != null) { - player.updateAudioStream(settings.AUDIO_STREAM_GUIDANCE.get()); + player.updateAudioStream(settings.AUDIO_MANAGER_STREAM.get()); } // Sync corresponding AUDIO_USAGE value ApplicationMode mode = getMyApplication().getSettings().getApplicationMode(); - int stream = settings.AUDIO_STREAM_GUIDANCE.getModeValue(mode); + int stream = settings.AUDIO_MANAGER_STREAM.getModeValue(mode); if (stream == AudioManager.STREAM_MUSIC) { settings.AUDIO_USAGE.setModeValue(mode, AudioAttributes.USAGE_ASSISTANCE_NAVIGATION_GUIDANCE); } else if (stream == AudioManager.STREAM_NOTIFICATION) { @@ -288,7 +288,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { } // Sync DEFAULT value with CAR value, as we have other way to set it for now - settings.AUDIO_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_STREAM_GUIDANCE.getModeValue(ApplicationMode.CAR)); + settings.AUDIO_MANAGER_STREAM.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_MANAGER_STREAM.getModeValue(ApplicationMode.CAR)); settings.AUDIO_USAGE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_USAGE.getModeValue(ApplicationMode.CAR)); return true; } diff --git a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java index a62564ca18..3d8937893a 100644 --- a/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java +++ b/OsmAnd/src/net/osmand/plus/audionotes/AudioVideoNotesPlugin.java @@ -1223,7 +1223,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { private void muteStreamMusicAndOutputGuidance() { AudioManager am = (AudioManager)app.getSystemService(Context.AUDIO_SERVICE); - int voiceGuidanceOutput = app.getSettings().AUDIO_STREAM_GUIDANCE.get(); + int voiceGuidanceOutput = app.getSettings().AUDIO_MANAGER_STREAM.get(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ am.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_MUTE, 0); if (voiceGuidanceOutput != AudioManager.STREAM_MUSIC) @@ -1237,7 +1237,7 @@ public class AudioVideoNotesPlugin extends OsmandPlugin { private void unmuteStreamMusicAndOutputGuidance() { AudioManager am = (AudioManager) app.getSystemService(Context.AUDIO_SERVICE); - int voiceGuidanceOutput = app.getSettings().AUDIO_STREAM_GUIDANCE.get(); + int voiceGuidanceOutput = app.getSettings().AUDIO_MANAGER_STREAM.get(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){ am.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_UNMUTE, 0); if (voiceGuidanceOutput != AudioManager.STREAM_MUSIC) diff --git a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java index cb1c0a1a63..90acf2e9fa 100644 --- a/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java +++ b/OsmAnd/src/net/osmand/plus/development/TestVoiceActivity.java @@ -125,14 +125,14 @@ public class TestVoiceActivity extends OsmandActionBarActivity { String v =""; v += " \u25CF App profile: " + ((OsmandApplication) getApplication()).getSettings().APPLICATION_MODE.get().getStringKey(); - if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 3) { + if (((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get() == 3) { v += "\n \u25CF Voice guidance output: Media/music audio"; - } else if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 5) { + } else if (((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get() == 5) { v += "\n \u25CF Voice guidance output: Notification audio"; - } else if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { + } else if (((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get() == 0) { v += "\n \u25CF Voice guidance output: Phone call audio"; } else { - v += "\n \u25CF Voice guidance output: " + ((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get(); + v += "\n \u25CF Voice guidance output: " + ((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get(); } v += "\n \u25CF OsmAnd voice: " + osmandVoice; @@ -141,7 +141,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity { v += "\n \u25CF TTS voice language availability: " + TTSCommandPlayerImpl.getTtsVoiceStatus(); v += "\n \u25CF TTS voice actually used: " + TTSCommandPlayerImpl.getTtsVoiceUsed(); - if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { + if (((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get() == 0) { v += "\n \u25CF BT SCO: " + AbstractPrologCommandPlayer.btScoInit; } else { v += "\n \u25CF BT SCO: The current app profile is not set to use 'Phone call audio'."; @@ -282,7 +282,7 @@ public class TestVoiceActivity extends OsmandActionBarActivity { Toast.makeText(TestVoiceActivity.this, "Info refreshed.", Toast.LENGTH_LONG).show(); } if (description.startsWith("\u25BA (11.2)")) { - if (((OsmandApplication) getApplication()).getSettings().AUDIO_STREAM_GUIDANCE.get() == 0) { + if (((OsmandApplication) getApplication()).getSettings().AUDIO_MANAGER_STREAM.get() == 0) { if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 1000) { ((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.set(1500); } else if (((OsmandApplication) getApplication()).getSettings().BT_SCO_DELAY.get() == 1500) { diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java index 71b58ab710..0b34ec6a1d 100644 --- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java +++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java @@ -203,7 +203,7 @@ public class VoiceRouter { } // Trigger close prompts earlier if delayed for BT SCO connection establishment - if ((settings.AUDIO_STREAM_GUIDANCE.getModeValue(router.getAppMode()) == 0) && !AbstractPrologCommandPlayer.btScoStatus) { + if ((settings.AUDIO_MANAGER_STREAM.getModeValue(router.getAppMode()) == 0) && !AbstractPrologCommandPlayer.btScoStatus) { btScoDelayDistance = currentSpeed * (double) settings.BT_SCO_DELAY.get() / 1000; } diff --git a/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java b/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java index d0b4c0df8e..b7a4c01500 100644 --- a/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java @@ -199,7 +199,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment { }; //AudioManager.USE_DEFAULT_STREAM_TYPE}; - ListPreferenceEx audioStreamGuidance = createListPreferenceEx(settings.AUDIO_STREAM_GUIDANCE.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr); + ListPreferenceEx audioStreamGuidance = createListPreferenceEx(settings.AUDIO_MANAGER_STREAM.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr); getPreferenceScreen().addPreference(audioStreamGuidance); } @@ -285,13 +285,13 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment { return true; } } - if (prefId.equals(settings.AUDIO_STREAM_GUIDANCE.getId())) { + if (prefId.equals(settings.AUDIO_MANAGER_STREAM.getId())) { // Sync DEFAULT value with CAR value, as we have other way to set it for now if (getSelectedAppMode().equals(ApplicationMode.CAR) && newValue instanceof Integer) { - settings.AUDIO_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, (Integer) newValue); + settings.AUDIO_MANAGER_STREAM.setModeValue(ApplicationMode.DEFAULT, (Integer) newValue); } else { - settings.AUDIO_STREAM_GUIDANCE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_STREAM_GUIDANCE.getModeValue(ApplicationMode.CAR)); + settings.AUDIO_MANAGER_STREAM.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_MANAGER_STREAM.getModeValue(ApplicationMode.CAR)); } settings.AUDIO_USAGE.setModeValue(ApplicationMode.DEFAULT, settings.AUDIO_USAGE.getModeValue(ApplicationMode.CAR)); diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index beb63ee098..a645fc8c9d 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -77,7 +77,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat long time = System.currentTimeMillis(); this.ctx = ctx; - this.streamType = ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode); + this.streamType = ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(applicationMode); initVoiceDir(voiceProvider); if (voiceDir != null && (MediaCommandPlayerImpl.isMyData(voiceDir) || TTSCommandPlayerImpl.isMyData(voiceDir))) { if (log.isInfoEnabled()) { @@ -294,7 +294,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat if (mAudioFocusHelper != null && ctx != null) { boolean audioFocusGranted = mAudioFocusHelper.requestFocus(ctx, applicationMode, streamType); // If AudioManager.STREAM_VOICE_CALL try using BT SCO: - if (audioFocusGranted && ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode) == 0) { + if (audioFocusGranted && ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(applicationMode) == 0) { toggleBtSco(true); } } @@ -311,7 +311,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat protected synchronized void abandonAudioFocus() { log.debug("abandonAudioFocus"); - if ((ctx != null && ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(applicationMode) == 0) || (btScoStatus == true)) { + if ((ctx != null && ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(applicationMode) == 0) || (btScoStatus == true)) { toggleBtSco(false); } if (ctx != null && mAudioFocusHelper != null) { diff --git a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java index decb8e2c09..c22973427a 100644 --- a/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/JSMediaCommandPlayerImpl.java @@ -56,7 +56,7 @@ public class JSMediaCommandPlayerImpl extends MediaCommandPlayerImpl { if (mediaPlayer == null) { requestAudioFocus(); // Delay first prompt of each batch to allow BT SCO connection being established - if (ctx != null && ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(getApplicationMode()) == 0) { + if (ctx != null && ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(getApplicationMode()) == 0) { try { log.debug("Delaying MediaCommandPlayer for BT SCO"); Thread.sleep(ctx.getSettings().BT_SCO_DELAY.get()); diff --git a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java index 93e37e205d..8c5b454ddd 100644 --- a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java @@ -88,7 +88,7 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen if (mediaPlayer == null) { requestAudioFocus(); // Delay first prompt of each batch to allow BT SCO connection being established - if (ctx != null && ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(getApplicationMode()) == 0) { + if (ctx != null && ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(getApplicationMode()) == 0) { try { log.debug("Delaying MediaCommandPlayer for BT SCO"); Thread.sleep(ctx.getSettings().BT_SCO_DELAY.get()); diff --git a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java index 3073366605..7bb19f361b 100644 --- a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java @@ -88,7 +88,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { cSpeechRate = app.getSettings().SPEECH_RATE.get(); } initializeEngine(app, ctx); - params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, app.getSettings().AUDIO_STREAM_GUIDANCE + params.put(TextToSpeech.Engine.KEY_PARAM_STREAM, app.getSettings().AUDIO_MANAGER_STREAM .getModeValue(getApplicationMode()).toString()); } @@ -124,7 +124,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { .build()); } // Delay first prompt of each batch to allow BT SCO connection being established - if (ctx.getSettings().AUDIO_STREAM_GUIDANCE.getModeValue(getApplicationMode()) == 0) { + if (ctx.getSettings().AUDIO_MANAGER_STREAM.getModeValue(getApplicationMode()) == 0) { ttsRequests++; if (android.os.Build.VERSION.SDK_INT < 21) { params.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID,""+System.currentTimeMillis());