diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index f28ba5c94c..4b9bc5e9e6 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Turn on the screen
+ Turn on the phone screen when approaching a turn
Select on map
Avoid roads…
Tram and train
diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml
index 0465fdef44..08944b4d2c 100644
--- a/OsmAnd/res/xml/navigation_settings.xml
+++ b/OsmAnd/res/xml/navigation_settings.xml
@@ -28,5 +28,6 @@
android:title="@string/speed_limit_exceed"
android:summary="@string/speed_limit_exceed_message"/>
+
diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
index 5842a706bd..f41b510533 100644
--- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java
@@ -114,7 +114,8 @@ public class MapActivity extends AccessibleActivity implements
private GpxImportHelper gpxImportHelper;
private PowerManager.WakeLock wakeLock = null;
private KeyguardManager.KeyguardLock keyguardLock = null;
- private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
+ private ReleaseWakeLocksRunnable releaseWakeLocksRunnable = new ReleaseWakeLocksRunnable();
+ private boolean active = false;
private Notification getNotification() {
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
@@ -539,6 +540,7 @@ public class MapActivity extends AccessibleActivity implements
@Override
protected void onStart() {
super.onStart();
+ active = true;
if ((wakeLock == null) || (keyguardLock == null)) {
VoiceRouter voiceRouter = app.getRoutingHelper().getVoiceRouter();
voiceRouter.removeVoiceMessageListener(this);
@@ -565,10 +567,11 @@ public class MapActivity extends AccessibleActivity implements
progressDlg.dismiss();
progressDlg = null;
}
- if (!isFinishing()) {
+ if (!isFinishing() && settings.WAKE_ON_VOICE.get()) {
VoiceRouter voiceRouter = app.getRoutingHelper().getVoiceRouter();
voiceRouter.addVoiceMessageListener(this);
}
+ active = false;
super.onStop();
}
@@ -788,17 +791,18 @@ public class MapActivity extends AccessibleActivity implements
if (settings.WAKE_ON_VOICE.get()) {
uiHandler.removeCallbacks(releaseWakeLocksRunnable);
- if (wakeLock == null) {
+ if (!active && (wakeLock == null)) {
PowerManager pm = (PowerManager) getSystemService(POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK
| PowerManager.ACQUIRE_CAUSES_WAKEUP,
"OsmAndOnVoiceWakeupTag");
wakeLock.acquire();
- }
- if (keyguardLock == null) {
- KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
- keyguardLock = km.newKeyguardLock("OsmAndKeyguardLock");
- keyguardLock.disableKeyguard();
+
+ if (keyguardLock == null) {
+ KeyguardManager km = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
+ keyguardLock = km.newKeyguardLock("OsmAndKeyguardLock");
+ keyguardLock.disableKeyguard();
+ }
}
uiHandler.postDelayed(releaseWakeLocksRunnable, WAKE_ON_VOICE_INTERVAL);
diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
index 9f17001839..a081091e82 100644
--- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
+++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java
@@ -92,6 +92,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
registerListPreference(settings.KEEP_INFORMING, screen, keepInformingNames, keepInformingValues);
registerBooleanPreference(settings.SHOW_ZOOM_BUTTONS_NAVIGATION, screen);
+ registerBooleanPreference(settings.WAKE_ON_VOICE, screen);
autoZoomMapPreference = (ListPreference) screen.findPreference(settings.AUTO_ZOOM_MAP.getId());
autoZoomMapPreference.setOnPreferenceChangeListener(this);
diff --git a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java
index 168c1e5538..a78f0ae57b 100644
--- a/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java
+++ b/OsmAnd/src/net/osmand/plus/routing/VoiceRouter.java
@@ -871,10 +871,14 @@ public class VoiceRouter {
for (final VoiceMessageListener voiceMessageListener : voiceMessageListeners) {
Runnable closure = new Runnable() {
public void run() {
- synchronized (voiceMessageListeners) {
- if (voiceMessageListeners
- .contains(voiceMessageListener)) {
- voiceMessageListener.onVoiceMessage();
+ if (settings.WAKE_ON_VOICE.get()) {
+ synchronized (voiceMessageListeners) {
+ if (voiceMessageListeners
+ .contains(voiceMessageListener)
+ && settings.WAKE_ON_VOICE.get()) {
+ voiceMessageListener
+ .onVoiceMessage();
+ }
}
}
}