mirror of
https://github.com/Kunzisoft/KeePassDX.git
synced 2026-12-05 00:02:27 -08:00
Refactor lock
This commit is contained in:
1 parent
ef8db46ae7
commit
37ca15b77c
11 files changed
+40
-30
No files matched your search
@@ -28,17 +28,16 @@ import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import com.kunzisoft.keepass.R;
|
||||
import com.kunzisoft.keepass.lock.LockService;
|
||||
|
||||
public class Timeout {
|
||||
|
||||
public static final String TIMEOUT = "com.kunzisoft.keepass.timeout";
|
||||
|
||||
private static final int REQUEST_ID = 0;
|
||||
private static final long DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
||||
private static String TAG = "KeePass Timeout";
|
||||
|
||||
private static PendingIntent buildIntent(Context ctx) {
|
||||
Intent intent = new Intent(TIMEOUT);
|
||||
Intent intent = new Intent(LockService.LOCK_ACTION);
|
||||
return PendingIntent.getBroadcast(ctx, REQUEST_ID, intent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ public class Timeout {
|
||||
return;
|
||||
}
|
||||
|
||||
ctx.startService(new Intent(ctx, TimeoutService.class));
|
||||
ctx.startService(new Intent(ctx, LockService.class));
|
||||
|
||||
long triggerTime = System.currentTimeMillis() + timeout;
|
||||
AlarmManager am = (AlarmManager) ctx.getSystemService(Context.ALARM_SERVICE);
|
||||
@@ -77,7 +76,7 @@ public class Timeout {
|
||||
am.cancel(buildIntent(ctx));
|
||||
}
|
||||
|
||||
ctx.stopService(new Intent(ctx, TimeoutService.class));
|
||||
ctx.stopService(new Intent(ctx, LockService.class));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user