Loading cmds/pm/src/com/android/commands/pm/Pm.java +21 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageInstaller.SessionInfo; import android.content.pm.PackageInstaller.SessionParams; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser.ApkLite; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageParserException; import android.content.pm.UserInfo; import android.net.Uri; import android.os.Binder; Loading Loading @@ -362,11 +366,27 @@ public final class Pm { */ private int runInstall() throws RemoteException { final InstallParams params = makeInstallParams(); final String inPath = nextArg(); if (params.sessionParams.sizeBytes < 0 && inPath != null) { File file = new File(inPath); if (file.isFile()) { try { ApkLite baseApk = PackageParser.parseApkLite(file, 0); PackageLite pkgLite = new PackageLite(null, baseApk, null, null, null); params.sessionParams.setSize( PackageHelper.calculateInstalledSize(pkgLite, false, params.sessionParams.abiOverride)); } catch (PackageParserException | IOException e) { System.err.println("Error: Failed to parse APK file : " + e); return 1; } } } final int sessionId = doCreateSession(params.sessionParams, params.installerPackageName, params.userId); try { final String inPath = nextArg(); if (inPath == null && params.sessionParams.sizeBytes == 0) { System.err.println("Error: must either specify a package size or an APK file"); return 1; Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +13 −2 Original line number Diff line number Diff line Loading @@ -439,7 +439,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { if (!FileUtils.isValidExtFilename(name)) { throw new IllegalArgumentException("Invalid name: " + name); } final File target = new File(resolveStageDir(), name); final File target; final long identity = Binder.clearCallingIdentity(); try { target = new File(resolveStageDir(), name); } finally { Binder.restoreCallingIdentity(identity); } // TODO: this should delegate to DCS so the system process avoids // holding open FDs into containers. Loading Loading @@ -1084,7 +1090,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { if (stageDir != null) { prepareStageDir(stageDir); } else if (stageCid != null) { final long identity = Binder.clearCallingIdentity(); try { prepareExternalStageCid(stageCid, params.sizeBytes); } finally { Binder.restoreCallingIdentity(identity); } // TODO: deliver more granular progress for ASEC allocation mInternalProgress = 0.25f; Loading services/core/java/com/android/server/pm/PackageManagerShellCommand.java +21 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageInstaller; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser.ApkLite; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageParserException; import android.content.pm.ParceledListSlice; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; Loading @@ -48,6 +52,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; import android.util.PrintWriterPrinter; import com.android.internal.content.PackageHelper; import com.android.internal.util.SizedInputStream; import dalvik.system.DexFile; Loading Loading @@ -137,11 +142,26 @@ class PackageManagerShellCommand extends ShellCommand { private int runInstall() throws RemoteException { final PrintWriter pw = getOutPrintWriter(); final InstallParams params = makeInstallParams(); final String inPath = getNextArg(); if (params.sessionParams.sizeBytes < 0 && inPath != null) { File file = new File(inPath); if (file.isFile()) { try { ApkLite baseApk = PackageParser.parseApkLite(file, 0); PackageLite pkgLite = new PackageLite(null, baseApk, null, null, null); params.sessionParams.setSize( PackageHelper.calculateInstalledSize(pkgLite,false, params.sessionParams.abiOverride)); } catch (PackageParserException | IOException e) { pw.println("Error: Failed to parse APK file : " + e); return 1; } } } final int sessionId = doCreateSession(params.sessionParams, params.installerPackageName, params.userId); boolean abandonSession = true; try { final String inPath = getNextArg(); if (inPath == null && params.sessionParams.sizeBytes == 0) { pw.println("Error: must either specify a package size or an APK file"); return 1; Loading Loading
cmds/pm/src/com/android/commands/pm/Pm.java +21 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,10 @@ import android.content.pm.PackageInstaller; import android.content.pm.PackageInstaller.SessionInfo; import android.content.pm.PackageInstaller.SessionParams; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser.ApkLite; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageParserException; import android.content.pm.UserInfo; import android.net.Uri; import android.os.Binder; Loading Loading @@ -362,11 +366,27 @@ public final class Pm { */ private int runInstall() throws RemoteException { final InstallParams params = makeInstallParams(); final String inPath = nextArg(); if (params.sessionParams.sizeBytes < 0 && inPath != null) { File file = new File(inPath); if (file.isFile()) { try { ApkLite baseApk = PackageParser.parseApkLite(file, 0); PackageLite pkgLite = new PackageLite(null, baseApk, null, null, null); params.sessionParams.setSize( PackageHelper.calculateInstalledSize(pkgLite, false, params.sessionParams.abiOverride)); } catch (PackageParserException | IOException e) { System.err.println("Error: Failed to parse APK file : " + e); return 1; } } } final int sessionId = doCreateSession(params.sessionParams, params.installerPackageName, params.userId); try { final String inPath = nextArg(); if (inPath == null && params.sessionParams.sizeBytes == 0) { System.err.println("Error: must either specify a package size or an APK file"); return 1; Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +13 −2 Original line number Diff line number Diff line Loading @@ -439,7 +439,13 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { if (!FileUtils.isValidExtFilename(name)) { throw new IllegalArgumentException("Invalid name: " + name); } final File target = new File(resolveStageDir(), name); final File target; final long identity = Binder.clearCallingIdentity(); try { target = new File(resolveStageDir(), name); } finally { Binder.restoreCallingIdentity(identity); } // TODO: this should delegate to DCS so the system process avoids // holding open FDs into containers. Loading Loading @@ -1084,7 +1090,12 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { if (stageDir != null) { prepareStageDir(stageDir); } else if (stageCid != null) { final long identity = Binder.clearCallingIdentity(); try { prepareExternalStageCid(stageCid, params.sizeBytes); } finally { Binder.restoreCallingIdentity(identity); } // TODO: deliver more granular progress for ASEC allocation mInternalProgress = 0.25f; Loading
services/core/java/com/android/server/pm/PackageManagerShellCommand.java +21 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ import android.content.pm.PackageInfo; import android.content.pm.PackageInstaller; import android.content.pm.PackageItemInfo; import android.content.pm.PackageManager; import android.content.pm.PackageParser; import android.content.pm.PackageParser.ApkLite; import android.content.pm.PackageParser.PackageLite; import android.content.pm.PackageParser.PackageParserException; import android.content.pm.ParceledListSlice; import android.content.pm.PermissionGroupInfo; import android.content.pm.PermissionInfo; Loading @@ -48,6 +52,7 @@ import android.os.SystemProperties; import android.os.UserHandle; import android.text.TextUtils; import android.util.PrintWriterPrinter; import com.android.internal.content.PackageHelper; import com.android.internal.util.SizedInputStream; import dalvik.system.DexFile; Loading Loading @@ -137,11 +142,26 @@ class PackageManagerShellCommand extends ShellCommand { private int runInstall() throws RemoteException { final PrintWriter pw = getOutPrintWriter(); final InstallParams params = makeInstallParams(); final String inPath = getNextArg(); if (params.sessionParams.sizeBytes < 0 && inPath != null) { File file = new File(inPath); if (file.isFile()) { try { ApkLite baseApk = PackageParser.parseApkLite(file, 0); PackageLite pkgLite = new PackageLite(null, baseApk, null, null, null); params.sessionParams.setSize( PackageHelper.calculateInstalledSize(pkgLite,false, params.sessionParams.abiOverride)); } catch (PackageParserException | IOException e) { pw.println("Error: Failed to parse APK file : " + e); return 1; } } } final int sessionId = doCreateSession(params.sessionParams, params.installerPackageName, params.userId); boolean abandonSession = true; try { final String inPath = getNextArg(); if (inPath == null && params.sessionParams.sizeBytes == 0) { pw.println("Error: must either specify a package size or an APK file"); return 1; Loading