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
This commit is contained in:
@@ -2,8 +2,12 @@
|
||||
|
||||
adb root
|
||||
wait ${!}
|
||||
adb shell pm disable com.google.android.setupwizard || true
|
||||
wait ${!}
|
||||
adb shell pm disable com.android.provision || true
|
||||
wait ${!}
|
||||
if adb shell pm list packages | grep com.google.android.setupwizard; then
|
||||
adb shell pm disable com.google.android.setupwizard || true
|
||||
wait ${!}
|
||||
fi
|
||||
if adb shell pm list packages | grep com.android.provision; then
|
||||
adb shell pm disable com.android.provision || true
|
||||
wait ${!}
|
||||
fi
|
||||
adb shell am start org.lineageos.setupwizard/org.lineageos.setupwizard.SetupWizardTestActivity
|
||||
|
@@ -4,8 +4,10 @@ adb root
|
||||
wait ${!}
|
||||
adb shell pm enable com.google.android.setupwizard || true
|
||||
wait ${!}
|
||||
adb shell pm disable com.android.provision || true
|
||||
wait ${!}
|
||||
if adb shell pm list packages | grep com.android.provision; then
|
||||
adb shell pm disable com.android.provision || true
|
||||
wait ${!}
|
||||
fi
|
||||
adb shell am start org.lineageos.setupwizard/org.lineageos.setupwizard.SetupWizardTestActivity
|
||||
wait ${!}
|
||||
sleep 1
|
||||
|
Reference in New Issue
Block a user