summaryrefslogtreecommitdiff
path: root/services/java/com/android/server/BackupManagerService.java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-09-07 23:16:01 -0700
committerJeff Sharkey <jsharkey@android.com>2012-09-11 23:11:14 -0700
commitb049e212ab7fe8967893c202efcb30fecfdb82fb (patch)
treecd6150a7e6152ff4d761a25f1d9d41b0bd9023d0 /services/java/com/android/server/BackupManagerService.java
parentb1ee58860280e2dfad63170495393a914ab34804 (diff)
downloadbase-b049e212ab7fe8967893c202efcb30fecfdb82fb.tar.gz
Include user identifier in external storage paths.
When building external storage paths, always include user in path to enable cross-user paths and aid debugging. Each Zygote process continues to only have access to the appropriate user-specific emulated storage through bind mounts. A second set of mounts continue supporting legacy /sdcard-style paths. For example, a process running as owner has these mount points: /storage/emulated_legacy /storage/emulated_legacy/Android/obb /storage/emulated/0 /storage/emulated/obb Since Environment is created before Zygote forks, we need to update its internal paths after each process launches. Bug: 7131382 Change-Id: I6f8c6971f2a8edfb415c14cb4ed05ff97e587a21
Diffstat (limited to 'services/java/com/android/server/BackupManagerService.java')
-rw-r--r--services/java/com/android/server/BackupManagerService.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 1d40f4f427f9..5e2b42551d95 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -67,6 +67,7 @@ import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
+import android.os.Environment.UserEnvironment;
import android.os.storage.IMountService;
import android.provider.Settings;
import android.util.EventLog;
@@ -2720,9 +2721,13 @@ class BackupManagerService extends IBackupManager.Stub {
FullBackup.backupToTar(pkg.packageName, FullBackup.APK_TREE_TOKEN, null,
apkDir, appSourceDir, output);
+ // TODO: migrate this to SharedStorageBackup, since AID_SYSTEM
+ // doesn't have access to external storage.
+
// Save associated .obb content if it exists and we did save the apk
// check for .obb and save those too
- final File obbDir = Environment.getExternalStorageAppObbDirectory(pkg.packageName);
+ final UserEnvironment userEnv = new UserEnvironment(UserHandle.USER_OWNER);
+ final File obbDir = userEnv.getExternalStorageAppObbDirectory(pkg.packageName);
if (obbDir != null) {
if (MORE_DEBUG) Log.i(TAG, "obb dir: " + obbDir.getAbsolutePath());
File[] obbFiles = obbDir.listFiles();