From 157f5efd56cbcf6f3514df744c59070ad2d12a51 Mon Sep 17 00:00:00 2001 From: Zahnstocher Date: Wed, 5 Nov 2014 01:24:00 +0100 Subject: [PATCH] dismiss keyguard --- .../net/osmand/plus/activities/MapActivity.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 92e4b4d602..396e51755a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -263,6 +263,19 @@ public class MapActivity extends AccessibleActivity implements }); } + private void changeKeyguardFlags() { + if (settings.WAKE_ON_VOICE.get() > 0) { + getWindow().setFlags( + WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED, + WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + } else { + getWindow().clearFlags( + WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD + | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); + } + } @SuppressWarnings("rawtypes") public Object getLastNonConfigurationInstanceByKey(String key) { @@ -318,6 +331,8 @@ public class MapActivity extends AccessibleActivity implements } else { setVolumeControlStream(AudioManager.STREAM_MUSIC); } + + changeKeyguardFlags(); applicationModeListener = new StateChangedListener() { @Override @@ -642,6 +657,7 @@ public class MapActivity extends AccessibleActivity implements public void updateApplicationModeSettings() { + changeKeyguardFlags(); // update vector renderer RendererRegistry registry = app.getRendererRegistry(); RenderingRulesStorage newRenderer = registry.getRenderer(settings.RENDERER.get());