SuW: Avoid showing exceptions if packages are not installed
Just check if the package is installed before trying to disable it.
Test: Observe that the following exception is not longer shown.
Exception occurred while executing 'disable':
java.lang.IllegalArgumentException: Unknown package: com.android.provision
at com.android.server.pm.PackageManagerService.setEnabledSetting(PackageManagerService.java:21052)
at com.android.server.pm.PackageManagerService.setApplicationEnabledSetting(PackageManagerService.java:20910)
at com.android.server.pm.PackageManagerShellCommand.runSetEnabledSetting(PackageManagerShellCommand.java:2151)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:231)
at android.os.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:98)
at android.os.ShellCommand.exec(ShellCommand.java:44)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21736)
at android.os.Binder.shellCommand(Binder.java:929)
at android.os.Binder.onTransact(Binder.java:813)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4621)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4361)
at android.os.Binder.execTransactInternal(Binder.java:1159)
at android.os.Binder.execTransact(Binder.java:1123)
Change-Id: I646f2803f95817d7d9f2b1dfe54a9c1f8c9988e7
2 files changed