Loading cmds/pm/src/com/android/commands/pm/Pm.java +19 −21 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.content.PackageHelper; Loading Loading @@ -923,33 +924,13 @@ public final class Pm { return; } } else if (opt.equals("--abi")) { abi = nextOptionData(); if (abi == null) { System.err.println("Error: must supply argument for --abi"); return; } abi = checkAbiArgument(nextOptionData()); } else { System.err.println("Error: Unknown option: " + opt); return; } } if (abi != null) { final String[] supportedAbis = Build.SUPPORTED_ABIS; boolean matched = false; for (String supportedAbi : supportedAbis) { if (supportedAbi.equals(abi)) { matched = true; break; } } if (!matched) { System.err.println("Error: abi " + abi + " not supported on this device."); return; } } final Uri verificationURI; final Uri originatingURI; final Uri referrerURI; Loading Loading @@ -1044,6 +1025,8 @@ public final class Pm { } else if (opt.equals("-S")) { params.deltaSize = Long.parseLong(nextOptionData()); params.progressMax = (int) params.deltaSize; } else if (opt.equals("--abi")) { params.abiOverride = checkAbiArgument(nextOptionData()); } else { throw new IllegalArgumentException("Unknown option " + opt); } Loading Loading @@ -1684,6 +1667,21 @@ public final class Pm { } } private static String checkAbiArgument(String abi) { if (TextUtils.isEmpty(abi)) { throw new IllegalArgumentException("Missing ABI argument"); } final String[] supportedAbis = Build.SUPPORTED_ABIS; for (String supportedAbi : supportedAbis) { if (supportedAbi.equals(abi)) { return abi; } } throw new IllegalArgumentException("ABI " + abi + " not supported on this device"); } private String nextOption() { if (mNextArg >= mArgs.length) { return null; Loading core/java/android/app/PackageInstallObserver.java +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ public class PackageInstallObserver { @Override public void packageInstalled(String basePackageName, Bundle extras, int returnCode, String msg) { PackageInstallObserver.this.packageInstalled(basePackageName, extras, returnCode); PackageInstallObserver.this.packageInstalled(basePackageName, extras, returnCode, msg); } }; Loading services/core/java/com/android/server/pm/PackageInstallerSession.java +2 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { @Override public void setClientProgress(int progress) { mClientProgress = progress; mProgress = MathUtils.constrain((mClientProgress * 8 * 100) / (params.progressMax * 10), 0, 80); mProgress = MathUtils.constrain( (int) (((float) mClientProgress) / ((float) params.progressMax)) * 80, 0, 80); mCallback.onSessionProgress(this, mProgress); } Loading services/core/java/com/android/server/pm/PackageManagerService.java +17 −3 Original line number Diff line number Diff line Loading @@ -9331,14 +9331,18 @@ public class PackageManagerService extends IPackageManager.Stub { return false; } else { final File beforeCodeFile = codeFile; final File afterCodeFile = new File(mAppInstallDir, getNextCodePath(oldCodePath, pkg.packageName, null)); final File afterCodeFile = getNextCodePath(pkg.packageName); Slog.d(TAG, "Renaming " + beforeCodeFile + " to " + afterCodeFile); if (!beforeCodeFile.renameTo(afterCodeFile)) { try { Os.rename(beforeCodeFile.getAbsolutePath(), afterCodeFile.getAbsolutePath()); } catch (ErrnoException e) { Slog.d(TAG, "Failed to rename", e); return false; } if (!SELinux.restoreconRecursive(afterCodeFile)) { Slog.d(TAG, "Failed to restorecon"); return false; } Loading Loading @@ -9811,6 +9815,16 @@ public class PackageManagerService extends IPackageManager.Stub { return prefix + idxStr; } private File getNextCodePath(String packageName) { int suffix = 1; File result; do { result = new File(mAppInstallDir, packageName + "-" + suffix); suffix++; } while (result.exists()); return result; } // Utility method used to ignore ADD/REMOVE events // by directory observer. private static boolean ignoreCodePath(String fullPathStr) { Loading Loading
cmds/pm/src/com/android/commands/pm/Pm.java +19 −21 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.os.UserManager; import android.text.TextUtils; import android.util.Log; import com.android.internal.content.PackageHelper; Loading Loading @@ -923,33 +924,13 @@ public final class Pm { return; } } else if (opt.equals("--abi")) { abi = nextOptionData(); if (abi == null) { System.err.println("Error: must supply argument for --abi"); return; } abi = checkAbiArgument(nextOptionData()); } else { System.err.println("Error: Unknown option: " + opt); return; } } if (abi != null) { final String[] supportedAbis = Build.SUPPORTED_ABIS; boolean matched = false; for (String supportedAbi : supportedAbis) { if (supportedAbi.equals(abi)) { matched = true; break; } } if (!matched) { System.err.println("Error: abi " + abi + " not supported on this device."); return; } } final Uri verificationURI; final Uri originatingURI; final Uri referrerURI; Loading Loading @@ -1044,6 +1025,8 @@ public final class Pm { } else if (opt.equals("-S")) { params.deltaSize = Long.parseLong(nextOptionData()); params.progressMax = (int) params.deltaSize; } else if (opt.equals("--abi")) { params.abiOverride = checkAbiArgument(nextOptionData()); } else { throw new IllegalArgumentException("Unknown option " + opt); } Loading Loading @@ -1684,6 +1667,21 @@ public final class Pm { } } private static String checkAbiArgument(String abi) { if (TextUtils.isEmpty(abi)) { throw new IllegalArgumentException("Missing ABI argument"); } final String[] supportedAbis = Build.SUPPORTED_ABIS; for (String supportedAbi : supportedAbis) { if (supportedAbi.equals(abi)) { return abi; } } throw new IllegalArgumentException("ABI " + abi + " not supported on this device"); } private String nextOption() { if (mNextArg >= mArgs.length) { return null; Loading
core/java/android/app/PackageInstallObserver.java +1 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ public class PackageInstallObserver { @Override public void packageInstalled(String basePackageName, Bundle extras, int returnCode, String msg) { PackageInstallObserver.this.packageInstalled(basePackageName, extras, returnCode); PackageInstallObserver.this.packageInstalled(basePackageName, extras, returnCode, msg); } }; Loading
services/core/java/com/android/server/pm/PackageInstallerSession.java +2 −1 Original line number Diff line number Diff line Loading @@ -177,7 +177,8 @@ public class PackageInstallerSession extends IPackageInstallerSession.Stub { @Override public void setClientProgress(int progress) { mClientProgress = progress; mProgress = MathUtils.constrain((mClientProgress * 8 * 100) / (params.progressMax * 10), 0, 80); mProgress = MathUtils.constrain( (int) (((float) mClientProgress) / ((float) params.progressMax)) * 80, 0, 80); mCallback.onSessionProgress(this, mProgress); } Loading
services/core/java/com/android/server/pm/PackageManagerService.java +17 −3 Original line number Diff line number Diff line Loading @@ -9331,14 +9331,18 @@ public class PackageManagerService extends IPackageManager.Stub { return false; } else { final File beforeCodeFile = codeFile; final File afterCodeFile = new File(mAppInstallDir, getNextCodePath(oldCodePath, pkg.packageName, null)); final File afterCodeFile = getNextCodePath(pkg.packageName); Slog.d(TAG, "Renaming " + beforeCodeFile + " to " + afterCodeFile); if (!beforeCodeFile.renameTo(afterCodeFile)) { try { Os.rename(beforeCodeFile.getAbsolutePath(), afterCodeFile.getAbsolutePath()); } catch (ErrnoException e) { Slog.d(TAG, "Failed to rename", e); return false; } if (!SELinux.restoreconRecursive(afterCodeFile)) { Slog.d(TAG, "Failed to restorecon"); return false; } Loading Loading @@ -9811,6 +9815,16 @@ public class PackageManagerService extends IPackageManager.Stub { return prefix + idxStr; } private File getNextCodePath(String packageName) { int suffix = 1; File result; do { result = new File(mAppInstallDir, packageName + "-" + suffix); suffix++; } while (result.exists()); return result; } // Utility method used to ignore ADD/REMOVE events // by directory observer. private static boolean ignoreCodePath(String fullPathStr) { Loading