OSDN Git Service

Add Environment call: get config dir for some user
authorRobin Lee <rgl@google.com>
Mon, 28 Apr 2014 15:03:22 +0000 (16:03 +0100)
committerRobin Lee <rgl@google.com>
Thu, 5 Jun 2014 14:34:23 +0000 (14:34 +0000)
This returns a read-only directory accessible to any app running as the
same user, containing various configuration files written by the system.

Change-Id: I635de184fc285b8fef166b782bbc1ac79f8f0687

core/java/android/os/Environment.java

index 7bf7367..b554e9f 100644 (file)
@@ -319,6 +319,17 @@ public class Environment {
     }
 
     /**
     }
 
     /**
+     * Returns the config directory for a user. This is for use by system services to store files
+     * relating to the user which should be readable by any app running as that user.
+     *
+     * @hide
+     */
+    public static File getUserConfigDirectory(int userId) {
+        return new File(new File(new File(
+                getDataDirectory(), "misc"), "user"), Integer.toString(userId));
+    }
+
+    /**
      * Returns whether the Encrypted File System feature is enabled on the device or not.
      * @return <code>true</code> if Encrypted File System feature is enabled, <code>false</code>
      * if disabled.
      * Returns whether the Encrypted File System feature is enabled on the device or not.
      * @return <code>true</code> if Encrypted File System feature is enabled, <code>false</code>
      * if disabled.