If you supply a non-null type to this function, the returned * file will be a path to a sub-directory of the given type. Though these files * are not automatically scanned by the media scanner, you can explicitly * add them to the media database with @@ -450,7 +450,7 @@ public abstract class Context { * Environment.getExternalStoragePublicDirectory()}, which provides * directories of media shared by all applications. The * directories returned here are - * owned by the application, and its contents will be removed when the + * owned by the application, and their contents will be removed when the * application is uninstalled. Unlike * {@link android.os.Environment#getExternalStoragePublicDirectory * Environment.getExternalStoragePublicDirectory()}, the directory @@ -479,6 +479,7 @@ public abstract class Context { * this method again when it is available. * * @see #getFilesDir + * @see android.os.Environment#getExternalStoragePublicDirectory */ public abstract File getExternalFilesDir(String type); @@ -1372,6 +1373,7 @@ public abstract class Context { public static final String SENSOR_SERVICE = "sensor"; /** + * @hide * Use with {@link #getSystemService} to retrieve a {@link * android.os.storage.StorageManager} for accesssing system storage * functions. diff --git a/core/java/android/os/Environment.java b/core/java/android/os/Environment.java index a9831aa0fd568..12487ff7919ce 100644 --- a/core/java/android/os/Environment.java +++ b/core/java/android/os/Environment.java @@ -116,6 +116,15 @@ public class Environment { * happened. You can determine its current state with * {@link #getExternalStorageState()}. * + *
Applications should not directly use this top-level directory, in + * order to avoid polluting the user's root namespace. Any files that are + * private to the application should be placed in a directory returned + * by {@link android.content.Context#getExternalFilesDir + * Context.getExternalFilesDir}, which the system will take care of deleting + * if the application is uninstalled. Other shared files should be placed + * in one of the directories returned by + * {@link #getExternalStoragePublicDirectory}. + * *
Here is an example of typical code to monitor the state of * external storage:
*