Use the new download manager APIs introduced in change 7400
[android/platform/packages/providers/DownloadProvider.git] / src / com / android / providers / downloads / DownloadReceiver.java
index 73eb094..c0ccad3 100644 (file)
@@ -71,20 +71,22 @@ public class DownloadReceiver extends BroadcastReceiver {
                     intent.getData(), null, null, null, null);
             if (cursor != null) {
                 if (cursor.moveToFirst()) {
-                    int statusColumn = cursor.getColumnIndexOrThrow(Downloads.STATUS);
+                    int statusColumn = cursor.getColumnIndexOrThrow(Downloads.COLUMN_STATUS);
                     int status = cursor.getInt(statusColumn);
-                    int visibilityColumn = cursor.getColumnIndexOrThrow(Downloads.VISIBILITY);
+                    int visibilityColumn =
+                            cursor.getColumnIndexOrThrow(Downloads.COLUMN_VISIBILITY);
                     int visibility = cursor.getInt(visibilityColumn);
                     if (Downloads.isStatusCompleted(status)
                             && visibility == Downloads.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) {
                         ContentValues values = new ContentValues();
-                        values.put(Downloads.VISIBILITY, Downloads.VISIBILITY_VISIBLE);
+                        values.put(Downloads.COLUMN_VISIBILITY, Downloads.VISIBILITY_VISIBLE);
                         context.getContentResolver().update(intent.getData(), values, null, null);
                     }
 
                     if (intent.getAction().equals(Constants.ACTION_OPEN)) {
                         int filenameColumn = cursor.getColumnIndexOrThrow(Downloads._DATA);
-                        int mimetypeColumn = cursor.getColumnIndexOrThrow(Downloads.MIMETYPE);
+                        int mimetypeColumn =
+                                cursor.getColumnIndexOrThrow(Downloads.COLUMN_MIME_TYPE);
                         String filename = cursor.getString(filenameColumn);
                         String mimetype = cursor.getString(mimetypeColumn);
                         Uri path = Uri.parse(filename);
@@ -106,13 +108,13 @@ public class DownloadReceiver extends BroadcastReceiver {
                         }
                     } else {
                         int packageColumn =
-                                cursor.getColumnIndexOrThrow(Downloads.NOTIFICATION_PACKAGE);
+                                cursor.getColumnIndexOrThrow(Downloads.COLUMN_NOTIFICATION_PACKAGE);
                         int classColumn =
-                                cursor.getColumnIndexOrThrow(Downloads.NOTIFICATION_CLASS);
+                                cursor.getColumnIndexOrThrow(Downloads.COLUMN_NOTIFICATION_CLASS);
                         String pckg = cursor.getString(packageColumn);
                         String clazz = cursor.getString(classColumn);
                         if (pckg != null && clazz != null) {
-                            Intent appIntent = new Intent(Downloads.NOTIFICATION_CLICKED_ACTION);
+                            Intent appIntent = new Intent(Downloads.ACTION_NOTIFICATION_CLICKED);
                             appIntent.setClassName(pckg, clazz);
                             if (intent.getBooleanExtra("multiple", true)) {
                                 appIntent.setData(Downloads.CONTENT_URI);
@@ -138,14 +140,15 @@ public class DownloadReceiver extends BroadcastReceiver {
                     intent.getData(), null, null, null, null);
             if (cursor != null) {
                 if (cursor.moveToFirst()) {
-                    int statusColumn = cursor.getColumnIndexOrThrow(Downloads.STATUS);
+                    int statusColumn = cursor.getColumnIndexOrThrow(Downloads.COLUMN_STATUS);
                     int status = cursor.getInt(statusColumn);
-                    int visibilityColumn = cursor.getColumnIndexOrThrow(Downloads.VISIBILITY);
+                    int visibilityColumn =
+                            cursor.getColumnIndexOrThrow(Downloads.COLUMN_VISIBILITY);
                     int visibility = cursor.getInt(visibilityColumn);
                     if (Downloads.isStatusCompleted(status)
                             && visibility == Downloads.VISIBILITY_VISIBLE_NOTIFY_COMPLETED) {
                         ContentValues values = new ContentValues();
-                        values.put(Downloads.VISIBILITY, Downloads.VISIBILITY_VISIBLE);
+                        values.put(Downloads.COLUMN_VISIBILITY, Downloads.VISIBILITY_VISIBLE);
                         context.getContentResolver().update(intent.getData(), values, null, null);
                     }
                 }