aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2016-11-24 20:27:08 +0100
committerChristian Schneppe <christian@pix-art.de>2016-11-24 20:27:08 +0100
commitf9a466a9d93543869deecaca08f6ee09597a4703 (patch)
treea374cc1cdaec90a79db7f240a23fdfe6b1dcaaf7 /src/main
parent4cc7c1f4c79f83fd58ff19b8add31b309265a00e (diff)
when swiping don't clean startup counter entirely. just don't count last startup
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java11
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java4
2 files changed, 10 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index 25fb2aeef..ed0f14cd9 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -1326,9 +1326,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/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index bde16df00..92588e239 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -1130,7 +1130,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++;
@@ -3765,7 +3765,7 @@ public class XmppConnectionService extends Service {
mDatabaseExecutor.execute(new Runnable() {
@Override
public void run() {
- databaseBackend.clearStartTimeCounter();
+ databaseBackend.clearStartTimeCounter(false);
}
});
}