diff options
author | Steve McKay <smckay@google.com> | 2016-06-29 13:31:01 -0700 |
---|---|---|
committer | Steve McKay <smckay@google.com> | 2016-06-29 14:00:54 -0700 |
commit | c4011fceaaf1e4d8aeaf1b371f97a6793f7cae76 (patch) | |
tree | 67c4ff1a7bdf7540e9366f9e37157815d512b3ae /packages/DocumentsUI | |
parent | 4e5ee6530718ac330865a0fdb1ec897046a7d5a0 (diff) |
Allow quick view package to be set via setprop.
This allows testers to turn it on via adb.
Bug: 29875957
Change-Id: If4563a1799a7c1a1adead9ecfdb4c6ef0c07f82b
Diffstat (limited to 'packages/DocumentsUI')
-rw-r--r-- | packages/DocumentsUI/src/com/android/documentsui/QuickViewIntentBuilder.java | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/DocumentsUI/src/com/android/documentsui/QuickViewIntentBuilder.java b/packages/DocumentsUI/src/com/android/documentsui/QuickViewIntentBuilder.java index af6aee759eec..5e3bbbb86486 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/QuickViewIntentBuilder.java +++ b/packages/DocumentsUI/src/com/android/documentsui/QuickViewIntentBuilder.java @@ -28,6 +28,7 @@ import android.content.pm.PackageManager; import android.content.res.Resources; import android.database.Cursor; import android.net.Uri; +import android.os.Build; import android.provider.DocumentsContract; import android.provider.DocumentsContract.Document; import android.support.annotation.Nullable; @@ -73,7 +74,7 @@ final class QuickViewIntentBuilder { @Nullable Intent build() { if (DEBUG) Log.d(TAG, "Preparing intent for doc:" + mDocument.documentId); - String trustedPkg = mResources.getString(R.string.trusted_quick_viewer_package); + String trustedPkg = getQuickViewPackage(); if (!TextUtils.isEmpty(trustedPkg)) { Intent intent = new Intent(Intent.ACTION_QUICK_VIEW); @@ -116,6 +117,16 @@ final class QuickViewIntentBuilder { return null; } + private String getQuickViewPackage() { + String resValue = mResources.getString(R.string.trusted_quick_viewer_package); + if (Build.IS_DEBUGGABLE ) { + // Allow users of debug devices to override default quick viewer + // for the purposes of testing. + return android.os.SystemProperties.get("debug.quick_viewer", resValue); + } + return resValue; + } + private int collectViewableUris(ArrayList<Uri> uris) { final String[] siblingIds = mModel.getModelIds(); uris.ensureCapacity(siblingIds.length); |