aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-11-21 10:48:59 +0100
committerDaniel Gultsch <daniel@gultsch.de>2016-11-21 10:48:59 +0100
commit7b99346a4be2ffa97053079dc72ff4e4bb94ab7a (patch)
tree53cda470d5f0684d803e0d9e7af79629cea3cc83 /src/main/java/eu/siacs
parent568d6c8392b49ecdd3b1a830fdc6265e264335a7 (diff)
when swiping don't clean startup counter entirely. just don't count last startup
Diffstat (limited to 'src/main/java/eu/siacs')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java11
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java4
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index c111efa4..2ce0cca8 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -1328,9 +1328,14 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return count >= Config.FREQUENT_RESTARTS_THRESHOLD;
}
- public void clearStartTimeCounter() {
- Log.d(Config.LOGTAG,"resetting start time counter");
+ public void clearStartTimeCounter(boolean justOne) {
SQLiteDatabase db = this.getWritableDatabase();
- db.execSQL("delete from "+START_TIMES_TABLE);
+ if (justOne) {
+ db.execSQL("delete from "+START_TIMES_TABLE+" where timestamp in (select timestamp from "+START_TIMES_TABLE+" order by timestamp desc limit 1)");
+ Log.d(Config.LOGTAG,"do not count start up after being swiped away");
+ } else {
+ Log.d(Config.LOGTAG,"resetting start time counter");
+ 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 8c691102..1fa81ceb 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -978,7 +978,7 @@ public class XmppConnectionService extends Service {
private void logoutAndSave(boolean stop) {
int activeAccounts = 0;
- databaseBackend.clearStartTimeCounter(); // regular swipes don't count towards restart counter
+ databaseBackend.clearStartTimeCounter(true); // regular swipes don't count towards restart counter
for (final Account account : accounts) {
if (account.getStatus() != Account.State.DISABLED) {
activeAccounts++;
@@ -3611,7 +3611,7 @@ public class XmppConnectionService extends Service {
mDatabaseExecutor.execute(new Runnable() {
@Override
public void run() {
- databaseBackend.clearStartTimeCounter();
+ databaseBackend.clearStartTimeCounter(false);
}
});
}