mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 19:58:34 +00:00
Add better Loader performance logs.
This commit is contained in:
parent
b0a6bb79f6
commit
c1e6b6b086
@ -364,8 +364,6 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle state, boolean ready) {
|
||||
Log.i(TAG, "onCreate()");
|
||||
|
||||
RecipientId recipientId = getIntent().getParcelableExtra(RECIPIENT_EXTRA);
|
||||
|
||||
if (recipientId == null) {
|
||||
|
@ -146,7 +146,6 @@ public class ConversationFragment extends Fragment
|
||||
private int previousOffset;
|
||||
private int activeOffset;
|
||||
private boolean firstLoad;
|
||||
private long loaderStartTime;
|
||||
private ActionMode actionMode;
|
||||
private Locale locale;
|
||||
private RecyclerView list;
|
||||
@ -654,7 +653,6 @@ public class ConversationFragment extends Fragment
|
||||
@Override
|
||||
public @NonNull Loader<Cursor> onCreateLoader(int id, Bundle args) {
|
||||
Log.i(TAG, "onCreateLoader");
|
||||
loaderStartTime = System.currentTimeMillis();
|
||||
|
||||
int limit = args.getInt(KEY_LIMIT, PARTIAL_CONVERSATION_LIMIT);
|
||||
int offset = 0;
|
||||
@ -668,9 +666,7 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
@Override
|
||||
public void onLoadFinished(@NonNull Loader<Cursor> cursorLoader, Cursor cursor) {
|
||||
long loadTime = System.currentTimeMillis() - loaderStartTime;
|
||||
int count = cursor.getCount();
|
||||
Log.i(TAG, "onLoadFinished - took " + loadTime + " ms to load a cursor of size " + count);
|
||||
ConversationLoader loader = (ConversationLoader)cursorLoader;
|
||||
|
||||
ConversationAdapter adapter = getListAdapter();
|
||||
|
@ -5,6 +5,8 @@ import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import androidx.loader.content.AsyncTaskLoader;
|
||||
|
||||
import org.thoughtcrime.securesms.logging.Log;
|
||||
|
||||
/**
|
||||
* A Loader similar to CursorLoader that doesn't require queries to go through the ContentResolver
|
||||
* to get the benefits of reloading when content has changed.
|
||||
@ -71,11 +73,15 @@ public abstract class AbstractCursorLoader extends AsyncTaskLoader<Cursor> {
|
||||
|
||||
@Override
|
||||
public Cursor loadInBackground() {
|
||||
long startTime = System.currentTimeMillis();
|
||||
|
||||
Cursor newCursor = getCursor();
|
||||
if (newCursor != null) {
|
||||
newCursor.getCount();
|
||||
newCursor.registerContentObserver(observer);
|
||||
}
|
||||
|
||||
Log.d(TAG, "[" + getClass().getSimpleName() + "] Cursor load time: " + (System.currentTimeMillis() - startTime) + " ms");
|
||||
return newCursor;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user