diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-04-09 21:41:11 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-09 21:41:12 +0000 |
commit | 1d3c77a21e9c8fc59200b42503d9f0effd3f1551 (patch) | |
tree | 738807c1990347b54be562f30591b8cda927a472 /services | |
parent | 97d2d7c42752a52b5fe890cdb9a5dcbbf53837cc (diff) | |
parent | 790a4ecac708883eb3f84165298f4927be59e0fa (diff) | |
download | frameworks_base-1d3c77a21e9c8fc59200b42503d9f0effd3f1551.zip frameworks_base-1d3c77a21e9c8fc59200b42503d9f0effd3f1551.tar.gz frameworks_base-1d3c77a21e9c8fc59200b42503d9f0effd3f1551.tar.bz2 |
Merge "Start passing volume UUID to installd."
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/Installer.java | 103 |
1 files changed, 101 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java index 3215acb..ce31f98 100644 --- a/services/core/java/com/android/server/pm/Installer.java +++ b/services/core/java/com/android/server/pm/Installer.java @@ -20,7 +20,9 @@ import android.annotation.Nullable; import android.content.Context; import android.content.pm.PackageStats; import android.os.Build; +import android.text.TextUtils; import android.util.Slog; + import dalvik.system.VMRuntime; import com.android.internal.os.InstallerConnection; @@ -42,9 +44,24 @@ public final class Installer extends SystemService { ping(); } + private static String escapeNull(String arg) { + if (TextUtils.isEmpty(arg)) { + return "!"; + } else { + return arg; + } + } + + @Deprecated public int install(String name, int uid, int gid, String seinfo) { + return install(null, name, uid, gid, seinfo); + } + + public int install(String uuid, String name, int uid, int gid, String seinfo) { StringBuilder builder = new StringBuilder("install"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(uid); @@ -128,9 +145,16 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + @Deprecated public int remove(String name, int userId) { + return remove(null, name, userId); + } + + public int remove(String uuid, String name, int userId) { StringBuilder builder = new StringBuilder("remove"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(userId); @@ -146,9 +170,16 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + @Deprecated public int fixUid(String name, int uid, int gid) { + return fixUid(null, name, uid, gid); + } + + public int fixUid(String uuid, String name, int uid, int gid) { StringBuilder builder = new StringBuilder("fixuid"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(uid); @@ -157,27 +188,48 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + @Deprecated public int deleteCacheFiles(String name, int userId) { + return deleteCacheFiles(null, name, userId); + } + + public int deleteCacheFiles(String uuid, String name, int userId) { StringBuilder builder = new StringBuilder("rmcache"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(userId); return mInstaller.execute(builder.toString()); } + @Deprecated public int deleteCodeCacheFiles(String name, int userId) { + return deleteCodeCacheFiles(null, name, userId); + } + + public int deleteCodeCacheFiles(String uuid, String name, int userId) { StringBuilder builder = new StringBuilder("rmcodecache"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(userId); return mInstaller.execute(builder.toString()); } + @Deprecated public int createUserData(String name, int uid, int userId, String seinfo) { + return createUserData(null, name, uid, userId, seinfo); + } + + public int createUserData(String uuid, String name, int uid, int userId, String seinfo) { StringBuilder builder = new StringBuilder("mkuserdata"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(uid); @@ -195,16 +247,30 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + @Deprecated public int removeUserDataDirs(int userId) { + return removeUserDataDirs(null, userId); + } + + public int removeUserDataDirs(String uuid, int userId) { StringBuilder builder = new StringBuilder("rmuser"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(userId); return mInstaller.execute(builder.toString()); } + @Deprecated public int clearUserData(String name, int userId) { + return clearUserData(null, name, userId); + } + + public int clearUserData(String uuid, String name, int userId) { StringBuilder builder = new StringBuilder("rmuserdata"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(name); builder.append(' '); builder.append(userId); @@ -231,15 +297,30 @@ public final class Installer extends SystemService { } } + @Deprecated public int freeCache(long freeStorageSize) { + return freeCache(null, freeStorageSize); + } + + public int freeCache(String uuid, long freeStorageSize) { StringBuilder builder = new StringBuilder("freecache"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(String.valueOf(freeStorageSize)); return mInstaller.execute(builder.toString()); } + @Deprecated public int getSizeInfo(String pkgName, int persona, String apkPath, String libDirPath, String fwdLockApkPath, String asecPath, String[] instructionSets, PackageStats pStats) { + return getSizeInfo(null, pkgName, persona, apkPath, libDirPath, fwdLockApkPath, asecPath, + instructionSets, pStats); + } + + public int getSizeInfo(String uuid, String pkgName, int persona, String apkPath, + String libDirPath, String fwdLockApkPath, String asecPath, String[] instructionSets, + PackageStats pStats) { for (String instructionSet : instructionSets) { if (!isValidInstructionSet(instructionSet)) { Slog.e(TAG, "Invalid instruction set: " + instructionSet); @@ -249,6 +330,8 @@ public final class Installer extends SystemService { StringBuilder builder = new StringBuilder("getsize"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(pkgName); builder.append(' '); builder.append(persona); @@ -288,6 +371,11 @@ public final class Installer extends SystemService { return mInstaller.execute("movefiles"); } + @Deprecated + public int linkNativeLibraryDirectory(String dataPath, String nativeLibPath32, int userId) { + return linkNativeLibraryDirectory(null, dataPath, nativeLibPath32, userId); + } + /** * Links the 32 bit native library directory in an application's data directory to the * real location for backward compatibility. Note that no such symlink is created for @@ -295,7 +383,8 @@ public final class Installer extends SystemService { * * @return -1 on error */ - public int linkNativeLibraryDirectory(String dataPath, String nativeLibPath32, int userId) { + public int linkNativeLibraryDirectory(String uuid, String dataPath, String nativeLibPath32, + int userId) { if (dataPath == null) { Slog.e(TAG, "linkNativeLibraryDirectory dataPath is null"); return -1; @@ -304,7 +393,10 @@ public final class Installer extends SystemService { return -1; } - StringBuilder builder = new StringBuilder("linklib "); + StringBuilder builder = new StringBuilder("linklib"); + builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(dataPath); builder.append(' '); builder.append(nativeLibPath32); @@ -314,9 +406,16 @@ public final class Installer extends SystemService { return mInstaller.execute(builder.toString()); } + @Deprecated public boolean restoreconData(String pkgName, String seinfo, int uid) { + return restoreconData(null, pkgName, seinfo, uid); + } + + public boolean restoreconData(String uuid, String pkgName, String seinfo, int uid) { StringBuilder builder = new StringBuilder("restorecondata"); builder.append(' '); + builder.append(escapeNull(uuid)); + builder.append(' '); builder.append(pkgName); builder.append(' '); builder.append(seinfo != null ? seinfo : "!"); |