Add confirmation UI protocol to Keystore AIDL definition

Test: Manually tested
Bug: 63928580
Change-Id: Ief1cdb9a64737d5aac08aa1c48ff60c34218d5ba
This commit is contained in:
Janis Danisevskis
2018-01-24 15:12:11 -08:00
parent f88fdc995f
commit 7dacad8dc8
5 changed files with 85 additions and 1 deletions

View File

@@ -730,6 +730,58 @@ public class KeyStore {
}
}
// Keep in sync with confirmationui/1.0/types.hal.
public static final int CONFIRMATIONUI_OK = 0;
public static final int CONFIRMATIONUI_CANCELED = 1;
public static final int CONFIRMATIONUI_ABORTED = 2;
public static final int CONFIRMATIONUI_OPERATION_PENDING = 3;
public static final int CONFIRMATIONUI_IGNORED = 4;
public static final int CONFIRMATIONUI_SYSTEM_ERROR = 5;
public static final int CONFIRMATIONUI_UNIMPLEMENTED = 6;
public static final int CONFIRMATIONUI_UNEXPECTED = 7;
public static final int CONFIRMATIONUI_UIERROR = 0x10000;
public static final int CONFIRMATIONUI_UIERROR_MISSING_GLYPH = 0x10001;
public static final int CONFIRMATIONUI_UIERROR_MESSAGE_TOO_LONG = 0x10002;
public static final int CONFIRMATIONUI_UIERROR_MALFORMED_UTF8_ENCODING = 0x10003;
/**
* Requests keystore call into the confirmationui HAL to display a prompt.
*
* @param listener the binder to use for callbacks.
* @param promptText the prompt to display.
* @param extraData extra data / nonce from application.
* @param locale the locale as a BCP 47 langauge tag.
* @param uiOptionsAsFlags the UI options to use, as flags.
* @return one of the {@code CONFIRMATIONUI_*} constants, for
* example {@code KeyStore.CONFIRMATIONUI_OK}.
*/
public int presentConfirmationPrompt(IBinder listener, String promptText, byte[] extraData,
String locale, int uiOptionsAsFlags) {
try {
return mBinder.presentConfirmationPrompt(listener, promptText, extraData, locale,
uiOptionsAsFlags);
} catch (RemoteException e) {
Log.w(TAG, "Cannot connect to keystore", e);
return CONFIRMATIONUI_SYSTEM_ERROR;
}
}
/**
* Requests keystore call into the confirmationui HAL to cancel displaying a prompt.
*
* @param listener the binder passed to the {@link #presentConfirmationPrompt} method.
* @return one of the {@code CONFIRMATIONUI_*} constants, for
* example {@code KeyStore.CONFIRMATIONUI_OK}.
*/
public int cancelConfirmationPrompt(IBinder listener) {
try {
return mBinder.cancelConfirmationPrompt(listener);
} catch (RemoteException e) {
Log.w(TAG, "Cannot connect to keystore", e);
return CONFIRMATIONUI_SYSTEM_ERROR;
}
}
/**
* Returns a {@link KeyStoreException} corresponding to the provided keystore/keymaster error
* code.