kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix crash during cache warming for fresh installs.
rodzic
b9514d0b94
commit
556518973d
|
@ -16,6 +16,7 @@ import org.thoughtcrime.securesms.database.RecipientDatabase;
|
||||||
import org.thoughtcrime.securesms.database.RecipientDatabase.MissingRecipientException;
|
import org.thoughtcrime.securesms.database.RecipientDatabase.MissingRecipientException;
|
||||||
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
import org.thoughtcrime.securesms.database.ThreadDatabase;
|
||||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||||
|
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||||
import org.thoughtcrime.securesms.util.CursorUtil;
|
import org.thoughtcrime.securesms.util.CursorUtil;
|
||||||
import org.thoughtcrime.securesms.util.LRUCache;
|
import org.thoughtcrime.securesms.util.LRUCache;
|
||||||
import org.thoughtcrime.securesms.util.Stopwatch;
|
import org.thoughtcrime.securesms.util.Stopwatch;
|
||||||
|
@ -198,6 +199,7 @@ public final class LiveRecipientCache {
|
||||||
|
|
||||||
stopwatch.split("thread");
|
stopwatch.split("thread");
|
||||||
|
|
||||||
|
if (SignalStore.registrationValues().isRegistrationComplete()) {
|
||||||
try (Cursor cursor = DatabaseFactory.getRecipientDatabase(context).getNonGroupContacts(false)) {
|
try (Cursor cursor = DatabaseFactory.getRecipientDatabase(context).getNonGroupContacts(false)) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while (cursor != null && cursor.moveToNext() && count < CONTACT_CACHE_WARM_MAX) {
|
while (cursor != null && cursor.moveToNext() && count < CONTACT_CACHE_WARM_MAX) {
|
||||||
|
@ -209,8 +211,10 @@ public final class LiveRecipientCache {
|
||||||
Log.d(TAG, "Warmed up " + count + " contact recipient.");
|
Log.d(TAG, "Warmed up " + count + " contact recipient.");
|
||||||
|
|
||||||
stopwatch.split("contact");
|
stopwatch.split("contact");
|
||||||
stopwatch.stop(TAG);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stopwatch.stop(TAG);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue