Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bac1b4e8 authored by shawnlin's avatar shawnlin
Browse files

Add more debug logs for directory update process

Bug: 111869773
Test: manual
Change-Id: I4b234de4e5af7f406bf032dc38118043f6373313
parent aaa9b118
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -15,6 +15,10 @@
 */
package com.android.documentsui;

import static com.android.documentsui.base.SharedMinimal.DEBUG;

import android.util.Log;

import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import androidx.recyclerview.selection.OperationMonitor;
@@ -27,6 +31,8 @@ import androidx.recyclerview.selection.OperationMonitor;
 */
public final class ContentLock {

    private static final String TAG = "ContentLock";

    private final OperationMonitor mMonitor = new OperationMonitor();

    @GuardedBy("this")
@@ -34,6 +40,9 @@ public final class ContentLock {

    public ContentLock() {
        mMonitor.addListener(() -> {
            if (DEBUG) {
                Log.d(TAG, "monitor listener, is locked : " + isLocked());
            }
            if (!isLocked()) {
                synchronized (this) {
                    final Runnable callback = mCallback;
@@ -62,6 +71,9 @@ public final class ContentLock {
     * (replacing any previous set Runnables).
     */
    public synchronized void runWhenUnlocked(Runnable runnable) {
        if (DEBUG) {
            Log.d(TAG, "run when unlock, is locked : " + isLocked());
        }
        if (!isLocked()) {
            runnable.run();
        } else {
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.documentsui;

import static com.android.documentsui.base.SharedMinimal.DEBUG;
import static com.android.documentsui.base.SharedMinimal.VERBOSE;

import android.content.ContentProviderClient;
@@ -258,6 +259,9 @@ public class DirectoryLoader extends AsyncTaskLoader<DirectoryResult> {

        @Override
        public void onChange(boolean selfChange) {
            if (DEBUG) {
                Log.d(TAG, "Directory content updated.");
            }
            mLock.runWhenUnlocked(mContentChangedCallback);
        }
    }