Skip to content

Commit

Permalink
Disabled Keyguard service restart on kill
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulAnnekov committed Oct 15, 2013
1 parent 206212a commit 2f183f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions NFC Unlocker/gen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/com
2 changes: 1 addition & 1 deletion NFC Unlocker/res/values/strings_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<string-array name="pref_unlock_method_entries">
<item>Flag</item>
<item>Input</item>
<item>KeyguardLock</item>
<item>KeyguardLock (unstable)</item>
</string-array>

<string-array name="pref_unlock_method_values">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 2f183f6

Please sign in to comment.