Bug fix compiling secondary dexes from cmd line
Summary: Currently, any attempts to compile secondary dexes from the command line will fail, saying the reason is invalid. For example, this command: adb shell cmd package compile -r cmdline --secondary-dex com.facebook.wakizashi will fail with this error message/stack trace: Exception occurred while executing 'compile': java.lang.IllegalArgumentException: reason -1 invalid at com.android.server.pm.PackageManagerServiceCompilerMapping.getReasonName(PackageManagerServiceCompilerMapping.java:146) at com.android.server.pm.PackageDexOptimizer.dexOptSecondaryDexPathLI(PackageDexOptimizer.java:515) at com.android.server.pm.PackageDexOptimizer.dexOptSecondaryDexPath(PackageDexOptimizer.java:437) at com.android.server.pm.dex.DexManager.dexoptSecondaryDex(DexManager.java:548) at com.android.server.pm.PackageManagerService.performDexOpt(PackageManagerService.java:12817) at com.android.server.pm.PackageManagerService.performDexOptSecondary(PackageManagerService.java:12806) at com.android.server.pm.PackageManagerShellCommand.runCompile(PackageManagerShellCommand.java:1812) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:222) at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97) at android.os.ShellCommand.exec(ShellCommand.java:38) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24612) at android.os.Binder.shellCommand(Binder.java:950) at android.os.Binder.onTransact(Binder.java:834) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4818) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:8506) at android.os.Binder.execTransactInternal(Binder.java:1184) at android.os.Binder.execTransact(Binder.java:1143) This is because a bug was introduced in this change: https://cs.android.com/android/_/android/platform/frameworks/base/+/7e477ab0f86986feb061bf5a7e9c5a2083268343 that removed the PackageManagerService.REASON_UNKNOWN (which was previously equal to -1). This change forgot to include the new replacement reason, PackageManagerService.REASON_INSTALL, for the secondary dexes dexopt path. This DexoptOptions constructor, when not given a compilation reason, will still default to -1, causing this bug when we later attempt to get the reason name. Test: m Reviewers: calin@google.com Subscribers: Tasks: Tags: Signed-off-by: Daniel Jin <danjin@fb.com> Change-Id: I246a44d35ae78f19feee58c93774da46b67a5e6d Merged-In: Ic3cef72627985bb906e87b875c180a7dc32a295f
Loading
Please register or sign in to comment