summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2016-05-31 22:03:27 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2016-05-31 22:03:29 +0000
commit760b5571582056e756d9fb1bc366247bc26a8e54 (patch)
tree89c0028f70d58468abe9728c7badaff697c91b54
parent1755dd08cbcdd2ffb14ac2eb84edc663843ced24 (diff)
parent3c6d499858d42cf3007ceaf029068cc7cdc05b8d (diff)
Merge "Don't assert on uris with stack." into nyc-dev
-rw-r--r--packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java27
1 files changed, 18 insertions, 9 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
index 57c14e98727c..b82f8dd3d7a3 100644
--- a/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
+++ b/packages/DocumentsUI/src/com/android/documentsui/FilesActivity.java
@@ -86,17 +86,26 @@ public class FilesActivity extends BaseActivity {
if (mState.restored) {
if (DEBUG) Log.d(TAG, "Stack already resolved for uri: " + intent.getData());
} else if (!mState.stack.isEmpty()) {
- // If a non-empty stack is present in our state it was read (presumably)
+ // If a non-empty stack is present in our state, it was read (presumably)
// from EXTRA_STACK intent extra. In this case, we'll skip other means of
- // loading or restoring the stack.
+ // loading or restoring the stack (like URI).
//
- // When restoring from a stack, if a URI is present, it should only ever
- // be a launch URI, or a fake Uri from notifications.
- // Launch URIs support sensible activity management, but don't specify a real
- // content target.
- if (DEBUG) Log.d(TAG, "Launching with non-empty stack.");
- assert(uri == null || uri.getAuthority() == null ||
- LauncherActivity.isLaunchUri(uri));
+ // When restoring from a stack, if a URI is present, it should only ever be:
+ // -- a launch URI: Launch URIs support sensible activity management,
+ // but don't specify a real content target)
+ // -- a fake Uri from notifications. These URIs have no authority (TODO: details).
+ //
+ // Any other URI is *sorta* unexpected...except when browsing an archive
+ // in downloads.
+ if(uri != null
+ && uri.getAuthority() != null
+ && !uri.equals(mState.stack.peek())
+ && !LauncherActivity.isLaunchUri(uri)) {
+ if (DEBUG) Log.w(TAG,
+ "Launching with non-empty stack. Ignoring unexpected uri: " + uri);
+ } else {
+ if (DEBUG) Log.d(TAG, "Launching with non-empty stack.");
+ }
refreshCurrentRootAndDirectory(AnimationView.ANIM_NONE);
} else if (Intent.ACTION_VIEW.equals(intent.getAction())) {
assert(uri != null);