summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@google.com>2018-08-14 21:39:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-08-14 21:39:15 +0000
commit9b191c24152823fac542a15f6b50be930a5e36e8 (patch)
tree9bbc25b76ed199d16f99948545af99ea73e21549 /core/java/android
parenteb0fb4efbaad2368f6d134eb46460455cc4ec074 (diff)
parent5790af08f8b299e7a8d88390abd38ada52f2d4f4 (diff)
Merge "Methods to translate sandbox paths."
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/content/pm/PackageManagerInternal.java17
-rw-r--r--core/java/android/os/storage/IStorageManager.aidl2
-rw-r--r--core/java/android/os/storage/StorageManager.java30
3 files changed, 49 insertions, 0 deletions
diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java
index a2a483280123..823d9951862c 100644
--- a/core/java/android/content/pm/PackageManagerInternal.java
+++ b/core/java/android/content/pm/PackageManagerInternal.java
@@ -31,6 +31,7 @@ import android.util.SparseArray;
import com.android.internal.util.function.TriFunction;
+import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
@@ -680,4 +681,20 @@ public abstract class PackageManagerInternal {
* @return a SparseArray mapping from appId to it's sharedUserId.
*/
public abstract SparseArray<String> getAppsWithSharedUserIds();
+
+ /**
+ * Return if device is currently in a "core" boot environment, typically
+ * used to support full-disk encryption. Only apps marked with
+ * {@code coreApp} attribute are available.
+ */
+ public abstract boolean isOnlyCoreApps();
+
+ /**
+ * Make a best-effort attempt to provide the requested free disk space by
+ * deleting cached files.
+ *
+ * @throws IOException if the request was unable to be fulfilled.
+ */
+ public abstract void freeStorage(String volumeUuid, long bytes, int storageFlags)
+ throws IOException;
}
diff --git a/core/java/android/os/storage/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl
index 55a202fd3a66..5c2d41e1aebc 100644
--- a/core/java/android/os/storage/IStorageManager.aidl
+++ b/core/java/android/os/storage/IStorageManager.aidl
@@ -187,4 +187,6 @@ interface IStorageManager {
void allocateBytes(String volumeUuid, long bytes, int flags, String callingPackage) = 78;
void runIdleMaintenance() = 79;
void abortIdleMaintenance() = 80;
+ String translateAppToSystem(String path, String packageName, int userId) = 81;
+ String translateSystemToApp(String path, String packageName, int userId) = 82;
}
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index b24dda002caa..5a1ea68b65da 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -1486,6 +1486,36 @@ public class StorageManager {
return path;
}
+ /**
+ * Translate given shared storage path from a path in an app sandbox
+ * namespace to a path in the system namespace.
+ *
+ * @hide
+ */
+ public File translateAppToSystem(File file, String packageName) {
+ try {
+ return new File(mStorageManager.translateAppToSystem(file.getAbsolutePath(),
+ packageName, mContext.getUserId()));
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
+ /**
+ * Translate given shared storage path from a path in the system namespace
+ * to a path in an app sandbox namespace.
+ *
+ * @hide
+ */
+ public File translateSystemToApp(File file, String packageName) {
+ try {
+ return new File(mStorageManager.translateSystemToApp(file.getAbsolutePath(),
+ packageName, mContext.getUserId()));
+ } catch (RemoteException e) {
+ throw e.rethrowFromSystemServer();
+ }
+ }
+
/** {@hide} */
@VisibleForTesting
public @NonNull ParcelFileDescriptor openProxyFileDescriptor(