diff options
| author | 2016-12-07 10:37:47 -0700 | |
|---|---|---|
| committer | 2016-12-07 10:38:24 -0700 | |
| commit | c24fa029bf9a2ee3c3657cb598e1595262ad2eeb (patch) | |
| tree | b03713a77f0d4bff31d63c866e1361ae400ae8bd | |
| parent | 68ea36243df0d75bd6ab4f6c94cfba40b91ab089 (diff) | |
Yet another set of installd Binder methods.
Pretty straightforward refactoring.
Test: builds, boots, apps install fine
Bug: 13758960, 30944031
Change-Id: Ide533a04e1e31475a16046722f48b1934d8cacd3
| -rw-r--r-- | services/core/java/com/android/server/pm/Installer.java | 108 | ||||
| -rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 3 |
2 files changed, 90 insertions, 21 deletions
diff --git a/services/core/java/com/android/server/pm/Installer.java b/services/core/java/com/android/server/pm/Installer.java index 17bdd10684bf..0f7bdde81ab9 100644 --- a/services/core/java/com/android/server/pm/Installer.java +++ b/services/core/java/com/android/server/pm/Installer.java @@ -185,35 +185,70 @@ public final class Installer extends SystemService { outputPath, dexFlags, compilerFilter, volumeUuid, sharedLibraries); } - public boolean mergeProfiles(int uid, String pkgName) throws InstallerException { - return mInstaller.mergeProfiles(uid, pkgName); + public boolean mergeProfiles(int uid, String packageName) throws InstallerException { + checkLock(); + try { + return mInstalld.mergeProfiles(uid, packageName); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } - public boolean dumpProfiles(String gid, String packageName, String codePaths) + public boolean dumpProfiles(int uid, String packageName, String codePaths) throws InstallerException { - return mInstaller.dumpProfiles(gid, packageName, codePaths); + checkLock(); + try { + return mInstalld.dumpProfiles(uid, packageName, codePaths); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void idmap(String targetApkPath, String overlayApkPath, int uid) throws InstallerException { - mInstaller.execute("idmap", targetApkPath, overlayApkPath, uid); + checkLock(); + try { + mInstalld.idmap(targetApkPath, overlayApkPath, uid); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void rmdex(String codePath, String instructionSet) throws InstallerException { assertValidInstructionSet(instructionSet); - mInstaller.execute("rmdex", codePath, instructionSet); + checkLock(); + try { + mInstalld.rmdex(codePath, instructionSet); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void rmPackageDir(String packageDir) throws InstallerException { - mInstaller.execute("rmpackagedir", packageDir); + checkLock(); + try { + mInstalld.rmPackageDir(packageDir); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } - public void clearAppProfiles(String pkgName) throws InstallerException { - mInstaller.execute("clear_app_profiles", pkgName); + public void clearAppProfiles(String packageName) throws InstallerException { + checkLock(); + try { + mInstalld.clearAppProfiles(packageName); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } - public void destroyAppProfiles(String pkgName) throws InstallerException { - mInstaller.execute("destroy_app_profiles", pkgName); + public void destroyAppProfiles(String packageName) throws InstallerException { + checkLock(); + try { + mInstalld.destroyAppProfiles(packageName); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void createUserData(String uuid, int userId, int userSerial, int flags) @@ -227,11 +262,21 @@ public final class Installer extends SystemService { public void markBootComplete(String instructionSet) throws InstallerException { assertValidInstructionSet(instructionSet); - mInstaller.execute("markbootcomplete", instructionSet); + checkLock(); + try { + mInstalld.markBootComplete(instructionSet); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void freeCache(String uuid, long freeStorageSize) throws InstallerException { - mInstaller.execute("freecache", uuid, freeStorageSize); + checkLock(); + try { + mInstalld.freeCache(uuid, freeStorageSize); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } /** @@ -239,29 +284,54 @@ public final class Installer extends SystemService { * directory to the real location for backward compatibility. Note that no * such symlink is created for 64 bit shared libraries. */ - public void linkNativeLibraryDirectory(String uuid, String dataPath, String nativeLibPath32, + public void linkNativeLibraryDirectory(String uuid, String packageName, String nativeLibPath32, int userId) throws InstallerException { - mInstaller.execute("linklib", uuid, dataPath, nativeLibPath32, userId); + checkLock(); + try { + mInstalld.linkNativeLibraryDirectory(uuid, packageName, nativeLibPath32, userId); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void createOatDir(String oatDir, String dexInstructionSet) throws InstallerException { - mInstaller.execute("createoatdir", oatDir, dexInstructionSet); + checkLock(); + try { + mInstalld.createOatDir(oatDir, dexInstructionSet); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void linkFile(String relativePath, String fromBase, String toBase) throws InstallerException { - mInstaller.execute("linkfile", relativePath, fromBase, toBase); + checkLock(); + try { + mInstalld.linkFile(relativePath, fromBase, toBase); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void moveAb(String apkPath, String instructionSet, String outputPath) throws InstallerException { - mInstaller.execute("move_ab", apkPath, instructionSet, outputPath); + checkLock(); + try { + mInstalld.moveAb(apkPath, instructionSet, outputPath); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } public void deleteOdex(String apkPath, String instructionSet, String outputPath) throws InstallerException { - mInstaller.execute("delete_odex", apkPath, instructionSet, outputPath); + checkLock(); + try { + mInstalld.deleteOdex(apkPath, instructionSet, outputPath); + } catch (RemoteException | ServiceSpecificException e) { + throw new InstallerException(e.getMessage()); + } } private static void assertValidInstructionSet(String instructionSet) diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 56a01737eac2..9102fee89422 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -7530,9 +7530,8 @@ public class PackageManagerService extends IPackageManager.Stub { final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); try { List<String> allCodePaths = pkg.getAllCodePathsExcludingResourceOnly(); - String gid = Integer.toString(sharedGid); String codePaths = TextUtils.join(";", allCodePaths); - mInstaller.dumpProfiles(gid, packageName, codePaths); + mInstaller.dumpProfiles(sharedGid, packageName, codePaths); } catch (InstallerException e) { Slog.w(TAG, "Failed to dump profiles", e); } |