summaryrefslogtreecommitdiffstats
path: root/src/com/android/providers/downloads/DownloadReceiver.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-08-27 21:53:30 -0700
committerJeff Sharkey <jsharkey@android.com>2012-08-27 21:55:06 -0700
commitc0622bf896c1af62b0e69b18cd84c7de3b67beb3 (patch)
treed5cbc3624eb9db219d38cebe0ef9f9951884641a /src/com/android/providers/downloads/DownloadReceiver.java
parent5cae217e7c6c8b043eada8041b224e713104f141 (diff)
downloadandroid_packages_providers_DownloadProvider-c0622bf896c1af62b0e69b18cd84c7de3b67beb3.tar.gz
android_packages_providers_DownloadProvider-c0622bf896c1af62b0e69b18cd84c7de3b67beb3.tar.bz2
android_packages_providers_DownloadProvider-c0622bf896c1af62b0e69b18cd84c7de3b67beb3.zip
Send ORIGINATING_URI and REFERRER to installer.
When building PackageInstaller intents, include ORIGINATING_URI and REFERRER extras. Unify view intent building for both notifications and list UI. Bug: 6900672 Change-Id: I18435e0f8aa549880ec594f82b6a250232706135
Diffstat (limited to 'src/com/android/providers/downloads/DownloadReceiver.java')
-rw-r--r--src/com/android/providers/downloads/DownloadReceiver.java22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/com/android/providers/downloads/DownloadReceiver.java b/src/com/android/providers/downloads/DownloadReceiver.java
index 81ff4040..aa165e41 100644
--- a/src/com/android/providers/downloads/DownloadReceiver.java
+++ b/src/com/android/providers/downloads/DownloadReceiver.java
@@ -28,13 +28,12 @@ import android.database.Cursor;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
+import android.provider.BaseColumns;
import android.provider.Downloads;
import android.util.Log;
import com.google.common.annotations.VisibleForTesting;
-import java.io.File;
-
/**
* Receives system broadcasts (boot, network connectivity)
*/
@@ -144,23 +143,12 @@ public class DownloadReceiver extends BroadcastReceiver {
* has been clicked.
*/
private void openDownload(Context context, Cursor cursor) {
- String filename = cursor.getString(cursor.getColumnIndexOrThrow(Downloads.Impl._DATA));
- String mimetype =
- cursor.getString(cursor.getColumnIndexOrThrow(Downloads.Impl.COLUMN_MIME_TYPE));
- Uri path = Uri.parse(filename);
- // If there is no scheme, then it must be a file
- if (path.getScheme() == null) {
- path = Uri.fromFile(new File(filename));
- }
-
- Intent activityIntent = new Intent(Intent.ACTION_VIEW);
- mimetype = DownloadDrmHelper.getOriginalMimeType(context, filename, mimetype);
- activityIntent.setDataAndType(path, mimetype);
- activityIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ final long id = cursor.getLong(cursor.getColumnIndexOrThrow(BaseColumns._ID));
+ final Intent intent = OpenHelper.buildViewIntent(context, id);
try {
- context.startActivity(activityIntent);
+ context.startActivity(intent);
} catch (ActivityNotFoundException ex) {
- Log.d(Constants.TAG, "no activity for " + mimetype, ex);
+ Log.d(Constants.TAG, "no activity for " + intent, ex);
}
}