Android-x86
Fork
Spenden

  • R/O
  • HTTP
  • SSH
  • HTTPS

packages-providers-DownloadProvider: Commit

packages/providers/DownloadProvider


Commit MetaInfo

Revisiona900a7676b770b6f4120d6dca25443d9e26e4a8b (tree)
Zeit2010-04-16 19:58:05
AutorYi Sun <beyounn@gmai...>
Commiter黃志偉

Log Message

change the permission of the download directory.

Ändern Zusammenfassung

Diff

--- a/src/com/android/providers/downloads/Helpers.java
+++ b/src/com/android/providers/downloads/Helpers.java
@@ -27,6 +27,7 @@ import android.net.ConnectivityManager;
2727 import android.net.NetworkInfo;
2828 import android.net.Uri;
2929 import android.os.Environment;
30+import android.os.FileUtils;
3031 import android.os.StatFs;
3132 import android.os.SystemClock;
3233 import android.provider.Downloads;
@@ -180,12 +181,20 @@ public class Helpers {
180181 if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
181182 String root = Environment.getExternalStorageDirectory().getPath();
182183 base = new File(root + Constants.DEFAULT_DL_SUBDIR);
183- if (!base.isDirectory() && !base.mkdir()) {
184- if (Config.LOGD) {
185- Log.d(Constants.TAG, "download aborted - can't create base directory "
186- + base.getPath());
184+ if (!base.isDirectory()) {
185+ if (base.mkdir()) {
186+ /*
187+ * Make sure the download directory is accessible
188+ */
189+ FileUtils.setPermissions(base.getPath(),
190+ FileUtils.S_IRWXU|FileUtils.S_IXGRP|FileUtils.S_IXOTH, -1, -1);
191+ } else {
192+ if (Config.LOGD) {
193+ Log.d(Constants.TAG, "download aborted - can't create base directory "
194+ + base.getPath());
195+ }
196+ return new DownloadFileInfo(null, null, Downloads.STATUS_FILE_ERROR);
187197 }
188- return new DownloadFileInfo(null, null, Downloads.STATUS_FILE_ERROR);
189198 }
190199 stat = new StatFs(base.getPath());
191200 } else {
Show on old repository browser