Add support for confirmation APIs.
This code implements new keystore APIs for confirmations.
Also add new 'confirmation' verb to the keystore_cli_v2 command to be
used for testing confirmations. It will block until there's a
callback. Example invocations:
phone:/ # keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --ui_options=1,2,3
Waiting for prompt to complete - use Ctrl+C to abort...
Confirmation prompt completed
responseCode = 0
dataThatWasConfirmed[30] = {0xa2, 0x66, 0x70, 0x72, 0x6f, 0x6d, 0x70, 0x74, 0x6b, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x65, 0x65, 0x78, 0x74, 0x72, 0x61, 0x43, 0x01, 0x02, 0x03}
phone:/ #
If a prompt is already being shown, the |OperationPending| return code
(code 3) is returned:
phone:/ # keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --ui_options=1,2,3
Presenting confirmation prompt failed with return code 3.
Canceling a prompt:
phone:/# keystore_cli_v2 confirmation --prompt_text="Hello World" --extra_data=010203 --cancel_after=1.5
Sleeping 1.5 seconds before canceling prompt...
Waiting for prompt to complete - use Ctrl+C to abort...
Confirmation prompt completed
responseCode = 2
dataThatWasConfirmed[0] = {}
Bug: 63928580
Test: Manually tested.
Change-Id: Ida14706ad066d5350b9081eb7821c7b1a1472dd2
diff --git a/keystore/Android.bp b/keystore/Android.bp
index de11ec6..cedbfa9 100644
--- a/keystore/Android.bp
+++ b/keystore/Android.bp
@@ -26,6 +26,7 @@
"Keymaster4.cpp",
"auth_token_table.cpp",
"blob.cpp",
+ "confirmation_manager.cpp",
"entropy.cpp",
"grant_store.cpp",
"key_store_service.cpp",
@@ -40,6 +41,7 @@
"user_state.cpp",
],
shared_libs: [
+ "android.hardware.confirmationui@1.0",
"android.hardware.keymaster@3.0",
"android.hardware.keymaster@4.0",
"android.system.wifi.keystore@1.0",
@@ -108,12 +110,17 @@
],
srcs: ["keystore_cli_v2.cpp"],
shared_libs: [
+ "android.hardware.confirmationui@1.0",
"android.hardware.keymaster@3.0",
+ "libbinder",
"libchrome",
+ "libutils",
"libhidlbase",
"libhwbinder",
"libkeymaster4support",
+ "libkeystore_aidl",
"libkeystore_binder",
+ "libkeystore_parcelables",
],
local_include_dirs: ["include"],