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

Commit 600b8eb3 authored by Shawn Lin's avatar Shawn Lin Committed by Android (Google) Code Review
Browse files

Merge "Add more debug logs for directory update process"

parents f1ad5654 bac1b4e8
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);
        }
    }