Loading src/com/android/documentsui/base/DocumentStack.java +8 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,10 @@ package com.android.documentsui.base; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static androidx.core.util.Preconditions.checkArgument; import static com.android.documentsui.base.SharedMinimal.DEBUG; import android.content.ContentResolver; import android.database.Cursor; import android.os.Parcel; Loading Loading @@ -150,6 +151,11 @@ public class DocumentStack implements Durable, Parcelable { if (DEBUG) Log.d(TAG, "Root changed to: " + root); reset(); mRoot = root; // Add this for keep stack size is 1 on recent root. if (root.isRecents()) { push(new DocumentInfo()); } } /** This will return true even when the initial location is set. Loading @@ -170,7 +176,7 @@ public class DocumentStack implements Durable, Parcelable { } public boolean isRecents() { return mRoot != null && mRoot.isRecents(); return mRoot != null && mRoot.isRecents() && size() == 1; } /** Loading tests/unit/com/android/documentsui/base/DocumentStackTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -188,4 +188,13 @@ public class DocumentStackTest { return true; }); } @Test public void testIsRecent() { final RootInfo rootRecent = new RootInfo(); mStack.changeRoot(rootRecent); assertEquals(1, mStack.size()); assertEquals(true, mStack.isRecents()); } } Loading
src/com/android/documentsui/base/DocumentStack.java +8 −2 Original line number Diff line number Diff line Loading @@ -16,9 +16,10 @@ package com.android.documentsui.base; import static com.android.documentsui.base.SharedMinimal.DEBUG; import static androidx.core.util.Preconditions.checkArgument; import static com.android.documentsui.base.SharedMinimal.DEBUG; import android.content.ContentResolver; import android.database.Cursor; import android.os.Parcel; Loading Loading @@ -150,6 +151,11 @@ public class DocumentStack implements Durable, Parcelable { if (DEBUG) Log.d(TAG, "Root changed to: " + root); reset(); mRoot = root; // Add this for keep stack size is 1 on recent root. if (root.isRecents()) { push(new DocumentInfo()); } } /** This will return true even when the initial location is set. Loading @@ -170,7 +176,7 @@ public class DocumentStack implements Durable, Parcelable { } public boolean isRecents() { return mRoot != null && mRoot.isRecents(); return mRoot != null && mRoot.isRecents() && size() == 1; } /** Loading
tests/unit/com/android/documentsui/base/DocumentStackTest.java +9 −0 Original line number Diff line number Diff line Loading @@ -188,4 +188,13 @@ public class DocumentStackTest { return true; }); } @Test public void testIsRecent() { final RootInfo rootRecent = new RootInfo(); mStack.changeRoot(rootRecent); assertEquals(1, mStack.size()); assertEquals(true, mStack.isRecents()); } }