diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-11-17 10:58:26 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2016-11-17 10:58:26 +0100 |
commit | 4d965e96edaa1d27a693d1d5a3986b5fac38d758 (patch) | |
tree | 5172c9b53e9bc77f46c31588441b48f3cd5b6fa3 /src | |
parent | 5007aa1b0717f304606ccb100a08e6b517ea14df (diff) |
reset startup count when swiped away (only count kills)
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java | 2 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index 56968853..71567356 100644 --- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -1285,10 +1285,12 @@ public class DatabaseBackend extends SQLiteOpenHelper { count = 0; } cursor.close(); + Log.d(Config.LOGTAG,"start time counter reached "+count); return count >= Config.FREQUENT_RESTARTS_THRESHOLD; } public void clearStartTimeCounter() { + Log.d(Config.LOGTAG,"resetting start time counter"); SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("delete from "+START_TIMES_TABLE); } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 9f3eea3f..9ebbcf63 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -969,6 +969,7 @@ public class XmppConnectionService extends Service { private void logoutAndSave(boolean stop) { int activeAccounts = 0; + databaseBackend.clearStartTimeCounter(); // regular swipes don't count towards restart counter for (final Account account : accounts) { if (account.getStatus() != Account.State.DISABLED) { activeAccounts++; @@ -989,13 +990,6 @@ public class XmppConnectionService extends Service { } } - private void cancelWakeUpCall(int requestCode) { - final AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); - final Intent intent = new Intent(this, EventReceiver.class); - intent.setAction("ping"); - alarmManager.cancel(PendingIntent.getBroadcast(this, requestCode, intent, 0)); - } - public void scheduleWakeUpCall(int seconds, int requestCode) { final long timeToWake = SystemClock.elapsedRealtime() + (seconds < 0 ? 1 : seconds + 1) * 1000; AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); |