final SafeIntent safeIntent = new SafeIntent(getIntent());
// Is this deep link? if (isDeepLink(safeIntent)) { dispatchDeepLink(safeIntent);
} elseif (isShutdownIntent(safeIntent)) { dispatchShutdownIntent(); // Is this web app? } elseif (isWebAppIntent(safeIntent)) { dispatchWebAppIntent();
// If it's not a view intent, it won't be a custom tabs intent either, and for content URI // let's handle only with normal tabs for the moment } elseif (!isViewIntentWithURL(safeIntent) || isContentUri(safeIntent.getData())) { dispatchNormalIntent();
// Can we dispatch this VIEW action intent to the tab queue service? } elseif (!safeIntent.getBooleanExtra(BrowserContract.SKIP_TAB_QUEUE_FLAG, false) && TabQueueHelper.TAB_QUEUE_ENABLED && TabQueueHelper.isTabQueueEnabled(this)) { dispatchTabQueueIntent();
// Dispatch this VIEW action intent to the browser. } else { dispatchNormalIntent(); }
publicstatic@NullableString getOriginalFilePathFromUri(final Context context, final Uri uri){ // DocumentProvider if (Build.VERSION.SDK_INT >= 19 && DocumentsContract.isDocumentUri(context, uri)) { // ExternalStorageProvider if (isExternalStorageDocument(uri)) { final String docId = DocumentsContract.getDocumentId(uri); // The AOSP ExternalStorageProvider creates document IDs of the form // "storage device ID" + ':' + "document path". final String[] split = docId.split(":"); final String type = split[0]; final String docPath = split[1];
final String rootPath; if ("primary".equalsIgnoreCase(type)) { rootPath = Environment.getExternalStorageDirectory().getAbsolutePath(); } else { rootPath = FileUtils.getExternalStoragePath(context, type); } return !TextUtils.isEmpty(rootPath) ? rootPath + "/" + docPath : null; } elseif (isDownloadsDocument(uri)) { // DownloadsProvider final String id = DocumentsContract.getDocumentId(uri); // workaround for issue (https://bugzilla.mozilla.org/show_bug.cgi?id=1502721) and // as per https://github.com/Yalantis/uCrop/issues/318#issuecomment-333066640 if (!TextUtils.isEmpty(id)) { if (id.startsWith("raw:")) { return id.replaceFirst("raw:", ""); } try { final Uri contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(id)); return getDataColumn(context, contentUri, null, null); } catch (NumberFormatException e) { returnnull; } } } elseif (isMediaDocument(uri)) { // MediaProvider final String docId = DocumentsContract.getDocumentId(uri); final String[] split = docId.split(":"); final String type = split[0];