diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java index 56968853c..715673560 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 9f3eea3fd..9ebbcf63c 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);