Restore the appropriate SELinux context to the downloads dir.

Change-Id: I4839fd07abdd1c6b866f1d94dc36567df047e30c
diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java
index 2d0c807..e0b5842 100644
--- a/src/com/android/providers/downloads/DownloadProvider.java
+++ b/src/com/android/providers/downloads/DownloadProvider.java
@@ -37,6 +37,7 @@
 import android.os.Environment;
 import android.os.ParcelFileDescriptor;
 import android.os.Process;
+import android.os.SELinux;
 import android.provider.BaseColumns;
 import android.provider.Downloads;
 import android.provider.OpenableColumns;
@@ -441,8 +442,7 @@
             appInfo = getContext().getPackageManager().
                     getApplicationInfo("com.android.defcontainer", 0);
         } catch (NameNotFoundException e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+            Log.wtf(Constants.TAG, "Could not get ApplicationInfo for com.android.defconatiner", e);
         }
         if (appInfo != null) {
             mDefContainerUid = appInfo.uid;
@@ -452,6 +452,11 @@
         Context context = getContext();
         context.startService(new Intent(context, DownloadService.class));
         mDownloadsDataDir = StorageManager.getDownloadDataDirectory(getContext());
+        try {
+            SELinux.restorecon(mDownloadsDataDir.getCanonicalPath());
+        } catch (IOException e) {
+            Log.wtf(Constants.TAG, "Could not get canonical path for download directory", e);
+        }
         return true;
     }