reset startup count when swiped away (only count kills)
This commit is contained in:
parent
5007aa1b07
commit
4d965e96ed
|
@ -1285,10 +1285,12 @@ public class DatabaseBackend extends SQLiteOpenHelper {
|
||||||
count = 0;
|
count = 0;
|
||||||
}
|
}
|
||||||
cursor.close();
|
cursor.close();
|
||||||
|
Log.d(Config.LOGTAG,"start time counter reached "+count);
|
||||||
return count >= Config.FREQUENT_RESTARTS_THRESHOLD;
|
return count >= Config.FREQUENT_RESTARTS_THRESHOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearStartTimeCounter() {
|
public void clearStartTimeCounter() {
|
||||||
|
Log.d(Config.LOGTAG,"resetting start time counter");
|
||||||
SQLiteDatabase db = this.getWritableDatabase();
|
SQLiteDatabase db = this.getWritableDatabase();
|
||||||
db.execSQL("delete from "+START_TIMES_TABLE);
|
db.execSQL("delete from "+START_TIMES_TABLE);
|
||||||
}
|
}
|
||||||
|
|
|
@ -969,6 +969,7 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
private void logoutAndSave(boolean stop) {
|
private void logoutAndSave(boolean stop) {
|
||||||
int activeAccounts = 0;
|
int activeAccounts = 0;
|
||||||
|
databaseBackend.clearStartTimeCounter(); // regular swipes don't count towards restart counter
|
||||||
for (final Account account : accounts) {
|
for (final Account account : accounts) {
|
||||||
if (account.getStatus() != Account.State.DISABLED) {
|
if (account.getStatus() != Account.State.DISABLED) {
|
||||||
activeAccounts++;
|
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) {
|
public void scheduleWakeUpCall(int seconds, int requestCode) {
|
||||||
final long timeToWake = SystemClock.elapsedRealtime() + (seconds < 0 ? 1 : seconds + 1) * 1000;
|
final long timeToWake = SystemClock.elapsedRealtime() + (seconds < 0 ? 1 : seconds + 1) * 1000;
|
||||||
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
|
||||||
|
|
Loading…
Reference in a new issue