Loading src/com/android/documentsui/ContentLock.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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") Loading @@ -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; Loading Loading @@ -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 { Loading src/com/android/documentsui/DirectoryLoader.java +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading Loading
src/com/android/documentsui/ContentLock.java +12 −0 Original line number Diff line number Diff line Loading @@ -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; Loading @@ -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") Loading @@ -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; Loading Loading @@ -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 { Loading
src/com/android/documentsui/DirectoryLoader.java +4 −0 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } } Loading