diff options
author | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:33:11 -0800 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2012-11-18 22:33:11 -0800 |
commit | 516f77f561e1388ae94fe1a26d2a31960074158a (patch) | |
tree | a01a9e9deb200f593008b0763f475471502b6728 /ui/src/com/android/providers/downloads/ui/DownloadList.java | |
parent | 59a409bbc018124a275fbedc9e7d0166e0e18cca (diff) | |
parent | 2fa007ef678b2283d47d007aa3dc91af683cc52c (diff) | |
download | android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.tar.gz android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.tar.bz2 android_packages_providers_DownloadProvider-516f77f561e1388ae94fe1a26d2a31960074158a.zip |
Merge branch 'jb-mr1-release' of https://android.googlesource.com/platform/packages/providers/DownloadProvider into HEADcm-10.1-M1
Diffstat (limited to 'ui/src/com/android/providers/downloads/ui/DownloadList.java')
-rw-r--r-- | ui/src/com/android/providers/downloads/ui/DownloadList.java | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java index 103d3f83..6ffa0691 100644 --- a/ui/src/com/android/providers/downloads/ui/DownloadList.java +++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java @@ -32,6 +32,7 @@ import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Parcelable; +import android.provider.BaseColumns; import android.provider.Downloads; import android.util.Log; import android.util.SparseBooleanArray; @@ -50,6 +51,8 @@ import android.widget.ExpandableListView.OnChildClickListener; import android.widget.ListView; import android.widget.Toast; +import com.android.providers.downloads.OpenHelper; + import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; @@ -499,7 +502,6 @@ public class DownloadList extends Activity { * Send an Intent to open the download currently pointed to by the given cursor. */ private void openCurrentDownload(Cursor cursor) { - final long id = cursor.getInt(mIdColumnId); final Uri localUri = Uri.parse(cursor.getString(mLocalUriColumnId)); try { getContentResolver().openFileDescriptor(localUri, "r").close(); @@ -512,20 +514,8 @@ public class DownloadList extends Activity { // close() failed, not a problem } - final Uri viewUri; - final String mimeType = cursor.getString(mMediaTypeColumnId); - if ("application/vnd.android.package-archive".equals(mimeType)) { - // PackageInstaller doesn't like content URIs, so open file - viewUri = localUri; - } else if ("file".equals(localUri.getScheme())) { - viewUri = ContentUris.withAppendedId(Downloads.Impl.ALL_DOWNLOADS_CONTENT_URI, id); - } else { - viewUri = localUri; - } - - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(viewUri, mimeType); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_GRANT_READ_URI_PERMISSION); + final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BaseColumns._ID)); + final Intent intent = OpenHelper.buildViewIntent(this, id); try { startActivity(intent); } catch (ActivityNotFoundException ex) { |