From 2f183f68cd4a00b672a6f7c066afc3beab3d2bac Mon Sep 17 00:00:00 2001 From: Paul Annekov Date: Tue, 15 Oct 2013 20:03:41 +0300 Subject: [PATCH] Disabled Keyguard service restart on kill --- NFC Unlocker/gen/.gitignore | 1 + NFC Unlocker/res/values/strings_settings.xml | 2 +- .../nfcunlocker/unlockmethods/KeyguardUnlock.java | 8 +++++--- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 NFC Unlocker/gen/.gitignore diff --git a/NFC Unlocker/gen/.gitignore b/NFC Unlocker/gen/.gitignore new file mode 100644 index 0000000..43e58b9 --- /dev/null +++ b/NFC Unlocker/gen/.gitignore @@ -0,0 +1 @@ +/com diff --git a/NFC Unlocker/res/values/strings_settings.xml b/NFC Unlocker/res/values/strings_settings.xml index 2bebc79..a037151 100644 --- a/NFC Unlocker/res/values/strings_settings.xml +++ b/NFC Unlocker/res/values/strings_settings.xml @@ -15,7 +15,7 @@ Flag Input - KeyguardLock + KeyguardLock (unstable) diff --git a/NFC Unlocker/src/com/steelrat/nfcunlocker/unlockmethods/KeyguardUnlock.java b/NFC Unlocker/src/com/steelrat/nfcunlocker/unlockmethods/KeyguardUnlock.java index 6a0a687..a495618 100644 --- a/NFC Unlocker/src/com/steelrat/nfcunlocker/unlockmethods/KeyguardUnlock.java +++ b/NFC Unlocker/src/com/steelrat/nfcunlocker/unlockmethods/KeyguardUnlock.java @@ -88,7 +88,6 @@ public static class KeyguardService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { - // TODO: intent may be null if service was killed by OS and re-created. String action = intent.getAction(); // Create new broadcast receiver for screen off action. @@ -101,15 +100,18 @@ public int onStartCommand(Intent intent, int flags, int startId) { stopSelf(); } - return super.onStartCommand(intent, flags, startId); + // Don't restart service after kill. Keyguard will be re-enabled in + // onDestroy automatically. + return START_NOT_STICKY; } @Override public void onDestroy() { super.onDestroy(); + restoreKeygurad(); + if (mReceiver != null) { - restoreKeygurad(); unregisterReceiver(mReceiver); } }