From 498f62e2da65df9e11e8da6feb959ed0d513f792 Mon Sep 17 00:00:00 2001 From: Geremy Condra Date: Wed, 3 Apr 2013 19:07:45 -0700 Subject: Restore the appropriate SELinux context to the downloads dir. Change-Id: I4839fd07abdd1c6b866f1d94dc36567df047e30c --- src/com/android/providers/downloads/DownloadProvider.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/com/android/providers/downloads/DownloadProvider.java b/src/com/android/providers/downloads/DownloadProvider.java index 2d0c807a..e0b5842d 100644 --- a/src/com/android/providers/downloads/DownloadProvider.java +++ b/src/com/android/providers/downloads/DownloadProvider.java @@ -37,6 +37,7 @@ import android.os.Binder; 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 @@ public final class DownloadProvider extends ContentProvider { 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 @@ public final class DownloadProvider extends ContentProvider { 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; } -- cgit v1.2.3