reset startup count when swiped away (only count kills)

This commit is contained in:
Daniel Gultsch 2016-11-17 10:58:26 +01:00
parent 5007aa1b07
commit 4d965e96ed
2 changed files with 3 additions and 7 deletions

View file

@ -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);
}

View file

@ -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);