Skip to content
Commit 283e3c38 authored by felipeal's avatar felipeal Committed by Felipe Leme
Browse files

Fixed how ShellCommand show exceptions.

Prior to this change, it was duplicating the exception. Example:

$ adb shell cmd car_service create-user --flags 4444 --timeout 100 --hal-only Dude

Exception occurred while executing: new user flags mismatch on existing users on {.requestId = 2, .newUserInfo = {.userId = 11, .flags = 0x115c}, .newUserName = Dude, .usersInfo = {.currentUser = {.userId = 11, .flags = NONE}, .numberUsers = 3, .existingUsers = [{.userId = 0, .flags = 0x9}, {.userId = 10, .flags = ADMIN}, {.userId = 11, .flags = NONE}]}}
java.lang.IllegalArgumentException: new user flags mismatch on existing users on {.requestId = 2, .newUserInfo = {.userId = 11, .flags = 0x115c}, .newUserName = Dude, .usersInfo = {.currentUser = {.userId = 11, .flags = NONE}, .numberUsers = 3, .existingUsers = [{.userId = 0, .flags = 0x9}, {.userId = 10, .flags = ADMIN}, {.userId = 11, .flags = NONE}]}}
	at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:69)
	at android.car.userlib.UserHalHelper.toVehiclePropValue(UserHalHelper.java:503)
	at com.android.car.hal.UserHalService.createUser(UserHalService.java:339)

Now it's showing the failed command instead:

Exception occurred while executing 'create-user --flags 4444 --timeout 100 --hal-only Dude':
java.lang.IllegalArgumentException: new user flags mismatch on existing users on {.requestId = 2, .newUserInfo = {.userId = 11, .flags = 0x115c}, .newUserName = Dude, .usersInfo = {.currentUser = {.userId = 11, .flags = NONE}, .numberUsers = 3, .existingUsers = [{.userId = 0, .flags = 0x9}, {.userId = 10, .flags = ADMIN}, {.userId = 11, .flags = NONE}]}}
	at com.android.internal.util.Preconditions.checkArgument(Preconditions.java:69)
	at android.car.userlib.UserHalHelper.toVehiclePropValue(UserHalHelper.java:503)
	at com.android.car.hal.UserHalService.createUser(UserHalService.java:339)

Test: manual verification
Bug: 150408921

Change-Id: I42221fbe2410770b0755c32d16620acc71d8d5d2
parent 7f5a592d
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment