Do not launch a quick viewer unless it's whitelisted.

Bug: 26697917
Change-Id: Ibe2c7c462380c219d6ce5b5c69af6dac0df62d41
This commit is contained in:
Tomasz Mikolajewski
2016-01-21 12:38:03 +09:00
parent 223531d88a
commit c2b1237ca5

View File

@@ -72,18 +72,12 @@ final class QuickViewIntentBuilder {
String trustedPkg = mResources.getString(R.string.trusted_quick_viewer_package);
Intent intent = new Intent(Intent.ACTION_QUICK_VIEW);
intent.setDataAndType(mDocument.derivedUri, mDocument.mimeType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (TextUtils.isEmpty(trustedPkg)) {
if (hasRegisteredHandler(intent)) {
return intent;
}
} else {
if (!TextUtils.isEmpty(trustedPkg)) {
Intent intent = new Intent(Intent.ACTION_QUICK_VIEW);
intent.setDataAndType(mDocument.derivedUri, mDocument.mimeType);
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setPackage(trustedPkg);
if (hasRegisteredHandler(intent)) {
// We have a trusted handler. Load all of the docs into the intent.
Cursor cursor = mSiblings.getCursor();
for (int i = 0; i < cursor.getCount(); i++) {
onNextItem(i, cursor);