Merge "Update fingerprint.h for new API"
diff --git a/include/hardware/gatekeeper.h b/include/hardware/gatekeeper.h
new file mode 100644
index 0000000..9150e70
--- /dev/null
+++ b/include/hardware/gatekeeper.h
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GATEKEEPER_H
+#define ANDROID_HARDWARE_GATEKEEPER_H
+
+#include <sys/cdefs.h>
+#include <sys/types.h>
+#include <hardware/hardware.h>
+
+__BEGIN_DECLS
+
+#define GATEKEEPER_HARDWARE_MODULE_ID "gatekeeper"
+
+#define GATEKEEPER_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
+
+#define HARDWARE_GATEKEEPER "gatekeeper"
+
+struct gatekeeper_module {
+ /**
+ * Comon methods of the gatekeeper module. This *must* be the first member of
+ * gatekeeper_module as users of this structure will cast a hw_module_t to
+ * a gatekeeper_module pointer in the appropriate context.
+ */
+ hw_module_t common;
+};
+
+struct gatekeeper_device {
+ /**
+ * Common methods of the gatekeeper device. As above, this must be the first
+ * member of keymaster_device.
+ */
+ hw_device_t common;
+
+ /**
+ * Enrolls desired_password, which should be derived from a user selected pin or password,
+ * with the authentication factor private key used only for enrolling authentication
+ * factor data.
+ *
+ * If there was already a password enrolled, it should be provided in
+ * current_password_handle, along with the current password in current_password
+ * that should validate against current_password_handle.
+ *
+ * Returns: 0 on success or an error code less than 0 on error.
+ * On error, enrolled_password_handle will not be allocated.
+ */
+ int (*enroll)(const struct gatekeeper_device *dev, uint32_t uid,
+ const uint8_t *current_password_handle, size_t current_password_handle_length,
+ const uint8_t *current_password, size_t current_password_length,
+ const uint8_t *desired_password, size_t desired_password_length,
+ uint8_t **enrolled_password_handle, size_t *enrolled_password_handle_length);
+
+ /**
+ * Verifies provided_password matches enrolled_password_handle.
+ *
+ * Implementations of this module may retain the result of this call
+ * to attest to the recency of authentication.
+ *
+ * On success, writes the address of a verification token to auth_token,
+ * usable to attest password verification to other trusted services. Clients
+ * may pass NULL for this value.
+ *
+ * Returns: 0 on success or an error code less than 0 on error
+ * On error, verification token will not be allocated
+ */
+ int (*verify)(const struct gatekeeper_device *dev, uint32_t uid,
+ const uint8_t *enrolled_password_handle, size_t enrolled_password_handle_length,
+ const uint8_t *provided_password, size_t provided_password_length,
+ uint8_t **auth_token, size_t *auth_token_length);
+
+};
+typedef struct gatekeeper_device gatekeeper_device_t;
+
+static inline int gatekeeper_open(const struct hw_module_t *module,
+ gatekeeper_device_t **device) {
+ return module->methods->open(module, HARDWARE_GATEKEEPER,
+ (struct hw_device_t **) device);
+}
+
+static inline int gatekeeper_close(gatekeeper_device_t *device) {
+ return device->common.close(&device->common);
+}
+
+__END_DECLS
+
+#endif // ANDROID_HARDWARE_GATEKEEPER_H
diff --git a/include/hardware/keyguard.h b/include/hardware/keyguard.h
deleted file mode 100644
index 88dcad1..0000000
--- a/include/hardware/keyguard.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ANDROID_HARDWARE_KEYGUARD_H
-#define ANDROID_HARDWARE_KEYGUARD_H
-
-#include <sys/cdefs.h>
-#include <sys/types.h>
-#include <hardware/hardware.h>
-
-__BEGIN_DECLS
-
-#define KEYGUARD_HARDWARE_MODULE_ID "keyguard"
-
-#define KEYGUARD_MODULE_API_VERSION_0_1 HARDWARE_MODULE_API_VERSION(0, 1)
-
-#define HARDWARE_KEYGUARD "keyguard"
-
-struct keyguard_module {
- /**
- * Comon methods of the keyguard module. This *must* be the first member of
- * keyguard_module as users of this structure will cast a hw_module_t to
- * a keyguard_module pointer in the appropriate context.
- */
- hw_module_t common;
-};
-
-struct keyguard_device {
- /**
- * Common methods of the keyguard device. As above, this must be the first
- * member of keymaster_device.
- */
- hw_device_t common;
-
- /**
- * Enrolls password_payload, which should be derived from a user selected pin or password,
- * with the authentication factor private key used only for enrolling authentication
- * factor data.
- *
- * Returns: 0 on success or an error code less than 0 on error.
- * On error, enrolled_password_handle will not be allocated.
- */
- int (*enroll)(const struct keyguard_device *dev, uint32_t uid,
- const uint8_t *password_payload, size_t password_payload_length,
- uint8_t **enrolled_password_handle, size_t *enrolled_password_handle_length);
-
- /**
- * Verifies provided_password matches enrolled_password_handle.
- *
- * Implementations of this module may retain the result of this call
- * to attest to the recency of authentication.
- *
- * On success, writes the address of a verification token to verification_token,
- * usable to attest password verification to other trusted services. Clients
- * may pass NULL for this value.
- *
- * Returns: 0 on success or an error code less than 0 on error
- * On error, verification token will not be allocated
- */
- int (*verify)(const struct keyguard_device *dev, uint32_t uid,
- const uint8_t *enrolled_password_handle, size_t enrolled_password_handle_length,
- const uint8_t *provided_password, size_t provided_password_length,
- uint8_t **verification_token, size_t *verification_token_length);
-
-};
-typedef struct keyguard_device keyguard_device_t;
-
-static inline int keyguard_open(const struct hw_module_t *module,
- keyguard_device_t **device) {
- return module->methods->open(module, HARDWARE_KEYGUARD,
- (struct hw_device_t **) device);
-}
-
-static inline int keyguard_close(keyguard_device_t *device) {
- return device->common.close(&device->common);
-}
-
-__END_DECLS
-
-#endif // ANDROID_HARDWARE_KEYGUARD_H
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index 664d3a7..dd2c764 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -41,6 +41,7 @@
KM_BOOL = 7 << 28,
KM_BIGNUM = 8 << 28,
KM_BYTES = 9 << 28,
+ KM_LONG_REP = 10 << 28, /* Repeatable long value */
} keymaster_tag_type_t;
typedef enum {
@@ -92,20 +93,23 @@
boot. */
/* User authentication */
- KM_TAG_ALL_USERS = KM_BOOL | 500, /* If key is usable by all users. */
- KM_TAG_USER_ID = KM_INT | 501, /* ID of authorized user. Disallowed if
- KM_TAG_ALL_USERS is present. */
- KM_TAG_NO_AUTH_REQUIRED = KM_BOOL | 502, /* If key is usable without authentication. */
- KM_TAG_USER_AUTH_ID = KM_INT_REP | 503, /* ID of the authenticator to use (e.g. password,
- fingerprint, etc.). Repeatable to support
- multi-factor auth. Disallowed if
- KM_TAG_NO_AUTH_REQUIRED is present. */
- KM_TAG_AUTH_TIMEOUT = KM_INT | 504, /* Required freshness of user authentication for
- private/secret key operations, in seconds.
- Public key operations require no authentication.
- If absent, authentication is required for every
- use. Authentication state is lost when the
- device is powered off. */
+ KM_TAG_ALL_USERS = KM_BOOL | 500, /* If key is usable by all users. */
+ KM_TAG_USER_ID = KM_INT | 501, /* ID of authorized user. Disallowed if
+ KM_TAG_ALL_USERS is present. */
+ KM_TAG_USER_SECURE_ID = KM_LONG_REP | 502, /* Secure ID of authorized user or authenticator(s).
+ Disallowed if KM_TAG_ALL_USERS or
+ KM_TAG_NO_AUTH_REQUIRED is present. */
+ KM_TAG_NO_AUTH_REQUIRED = KM_BOOL | 503, /* If key is usable without authentication. */
+ KM_TAG_USER_AUTH_TYPE = KM_ENUM | 504, /* Bitmask of authenticator types allowed when
+ * KM_TAG_USER_SECURE_ID contains a secure user ID,
+ * rather than a secure authenticator ID. Defined in
+ * hw_authenticator_type_t in hw_auth_token.h. */
+ KM_TAG_AUTH_TIMEOUT = KM_INT | 505, /* Required freshness of user authentication for
+ private/secret key operations, in seconds.
+ Public key operations require no authentication.
+ If absent, authentication is required for every
+ use. Authentication state is lost when the
+ device is powered off. */
/* Application access control */
KM_TAG_ALL_APPLICATIONS = KM_BOOL | 600, /* If key is usable by all applications. */
@@ -486,6 +490,7 @@
case KM_INT_REP:
return KEYMASTER_SIMPLE_COMPARE(a->integer, b->integer);
case KM_LONG:
+ case KM_LONG_REP:
return KEYMASTER_SIMPLE_COMPARE(a->long_integer, b->long_integer);
case KM_DATE:
return KEYMASTER_SIMPLE_COMPARE(a->date_time, b->date_time);
diff --git a/modules/audio/Android.mk b/modules/audio/Android.mk
index a31c85f..ef4b8f5 100644
--- a/modules/audio/Android.mk
+++ b/modules/audio/Android.mk
@@ -31,6 +31,23 @@
include $(BUILD_SHARED_LIBRARY)
+# The stub audio HAL module, identical to the default audio hal, but with
+# different name to be loaded concurrently with other audio HALs if necessary.
+# This can also be used as skeleton for new implementations
+#
+# The format of the name is audio.<type>.<hardware/etc>.so where the only
+# required type is 'primary'. Other possibilites are 'a2dp', 'usb', etc.
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := audio.stub.default
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := audio_hw.c
+LOCAL_SHARED_LIBRARIES := liblog libcutils
+LOCAL_MODULE_TAGS := optional
+LOCAL_CFLAGS := -Wno-unused-parameter
+
+include $(BUILD_SHARED_LIBRARY)
+
# The stub audio policy HAL module that can be used as a skeleton for
# new implementations.
include $(CLEAR_VARS)
diff --git a/modules/audio/audio_hw.c b/modules/audio/audio_hw.c
index 637e3f4..a1a322f 100644
--- a/modules/audio/audio_hw.c
+++ b/modules/audio/audio_hw.c
@@ -48,65 +48,78 @@
static int out_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
- return 0;
+ ALOGV("out_set_sample_rate: %d", 0);
+ return -ENOSYS;
}
static size_t out_get_buffer_size(const struct audio_stream *stream)
{
+ ALOGV("out_get_buffer_size: %d", 4096);
return 4096;
}
static audio_channel_mask_t out_get_channels(const struct audio_stream *stream)
{
+ ALOGV("out_get_channels");
return AUDIO_CHANNEL_OUT_STEREO;
}
static audio_format_t out_get_format(const struct audio_stream *stream)
{
+ ALOGV("out_get_format");
return AUDIO_FORMAT_PCM_16_BIT;
}
static int out_set_format(struct audio_stream *stream, audio_format_t format)
{
- return 0;
+ ALOGV("out_set_format: %d",format);
+ return -ENOSYS;
}
static int out_standby(struct audio_stream *stream)
{
+ ALOGV("out_standby");
+
return 0;
}
static int out_dump(const struct audio_stream *stream, int fd)
{
+ ALOGV("out_dump");
return 0;
}
static int out_set_parameters(struct audio_stream *stream, const char *kvpairs)
{
+ ALOGV("out_set_parameters");
return 0;
}
static char * out_get_parameters(const struct audio_stream *stream, const char *keys)
{
+ ALOGV("out_get_parameters");
return strdup("");
}
static uint32_t out_get_latency(const struct audio_stream_out *stream)
{
+ ALOGV("out_get_latency");
return 0;
}
static int out_set_volume(struct audio_stream_out *stream, float left,
float right)
{
+ ALOGV("out_set_volume: Left:%f Right:%f", left, right);
return 0;
}
static ssize_t out_write(struct audio_stream_out *stream, const void* buffer,
size_t bytes)
{
+ ALOGV("out_write: bytes: %d", bytes);
/* XXX: fake timing for audio output */
- usleep(bytes * 1000000 / audio_stream_out_frame_size(stream) /
+ usleep((int64_t)bytes * 1000000 / audio_stream_out_frame_size(stream) /
out_get_sample_rate(&stream->common));
return bytes;
}
@@ -114,43 +127,53 @@
static int out_get_render_position(const struct audio_stream_out *stream,
uint32_t *dsp_frames)
{
+ *dsp_frames = 0;
+ ALOGV("out_get_render_position: dsp_frames: %p", dsp_frames);
return -EINVAL;
}
static int out_add_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
+ ALOGV("out_add_audio_effect: %p", effect);
return 0;
}
static int out_remove_audio_effect(const struct audio_stream *stream, effect_handle_t effect)
{
+ ALOGV("out_remove_audio_effect: %p", effect);
return 0;
}
static int out_get_next_write_timestamp(const struct audio_stream_out *stream,
int64_t *timestamp)
{
+ *timestamp = 0;
+ ALOGV("out_get_next_write_timestamp: %ld", (long int)(*timestamp));
return -EINVAL;
}
/** audio_stream_in implementation **/
static uint32_t in_get_sample_rate(const struct audio_stream *stream)
{
+ ALOGV("in_get_sample_rate");
return 8000;
}
static int in_set_sample_rate(struct audio_stream *stream, uint32_t rate)
{
- return 0;
+ ALOGV("in_set_sample_rate: %d", rate);
+ return -ENOSYS;
}
static size_t in_get_buffer_size(const struct audio_stream *stream)
{
+ ALOGV("in_get_buffer_size: %d", 320);
return 320;
}
static audio_channel_mask_t in_get_channels(const struct audio_stream *stream)
{
+ ALOGV("in_get_channels: %d", AUDIO_CHANNEL_IN_MONO);
return AUDIO_CHANNEL_IN_MONO;
}
@@ -161,7 +184,7 @@
static int in_set_format(struct audio_stream *stream, audio_format_t format)
{
- return 0;
+ return -ENOSYS;
}
static int in_standby(struct audio_stream *stream)
@@ -193,9 +216,11 @@
static ssize_t in_read(struct audio_stream_in *stream, void* buffer,
size_t bytes)
{
+ ALOGV("in_read: bytes %d", bytes);
/* XXX: fake timing for audio input */
- usleep(bytes * 1000000 / audio_stream_in_frame_size(stream) /
+ usleep((int64_t)bytes * 1000000 / audio_stream_in_frame_size(stream) /
in_get_sample_rate(&stream->common));
+ memset(buffer, 0, bytes);
return bytes;
}
@@ -222,6 +247,8 @@
struct audio_stream_out **stream_out,
const char *address __unused)
{
+ ALOGV("adev_open_output_stream...");
+
struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
struct stub_stream_out *out;
int ret;
@@ -260,68 +287,81 @@
static void adev_close_output_stream(struct audio_hw_device *dev,
struct audio_stream_out *stream)
{
+ ALOGV("adev_close_output_stream...");
free(stream);
}
static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
{
+ ALOGV("adev_set_parameters");
return -ENOSYS;
}
static char * adev_get_parameters(const struct audio_hw_device *dev,
const char *keys)
{
- return NULL;
+ ALOGV("adev_get_parameters");
+ return strdup("");
}
static int adev_init_check(const struct audio_hw_device *dev)
{
+ ALOGV("adev_init_check");
return 0;
}
static int adev_set_voice_volume(struct audio_hw_device *dev, float volume)
{
+ ALOGV("adev_set_voice_volume: %f", volume);
return -ENOSYS;
}
static int adev_set_master_volume(struct audio_hw_device *dev, float volume)
{
+ ALOGV("adev_set_master_volume: %f", volume);
return -ENOSYS;
}
static int adev_get_master_volume(struct audio_hw_device *dev, float *volume)
{
+ ALOGV("adev_get_master_volume: %f", *volume);
return -ENOSYS;
}
static int adev_set_master_mute(struct audio_hw_device *dev, bool muted)
{
+ ALOGV("adev_set_master_mute: %d", muted);
return -ENOSYS;
}
static int adev_get_master_mute(struct audio_hw_device *dev, bool *muted)
{
+ ALOGV("adev_get_master_mute: %d", *muted);
return -ENOSYS;
}
static int adev_set_mode(struct audio_hw_device *dev, audio_mode_t mode)
{
+ ALOGV("adev_set_mode: %d", mode);
return 0;
}
static int adev_set_mic_mute(struct audio_hw_device *dev, bool state)
{
+ ALOGV("adev_set_mic_mute: %d",state);
return -ENOSYS;
}
static int adev_get_mic_mute(const struct audio_hw_device *dev, bool *state)
{
+ ALOGV("adev_get_mic_mute");
return -ENOSYS;
}
static size_t adev_get_input_buffer_size(const struct audio_hw_device *dev,
const struct audio_config *config)
{
+ ALOGV("adev_get_input_buffer_size: %d", 320);
return 320;
}
@@ -334,6 +374,8 @@
const char *address __unused,
audio_source_t source __unused)
{
+ ALOGV("adev_open_input_stream...");
+
struct stub_audio_device *ladev = (struct stub_audio_device *)dev;
struct stub_stream_in *in;
int ret;
@@ -370,16 +412,19 @@
static void adev_close_input_stream(struct audio_hw_device *dev,
struct audio_stream_in *in)
{
+ ALOGV("adev_close_input_stream...");
return;
}
static int adev_dump(const audio_hw_device_t *device, int fd)
{
+ ALOGV("adev_dump");
return 0;
}
static int adev_close(hw_device_t *device)
{
+ ALOGV("adev_close");
free(device);
return 0;
}
@@ -387,6 +432,8 @@
static int adev_open(const hw_module_t* module, const char* name,
hw_device_t** device)
{
+ ALOGV("adev_open: %s", name);
+
struct stub_audio_device *adev;
int ret;
diff --git a/tests/camera2/CameraModuleFixture.h b/tests/camera2/CameraModuleFixture.h
index bf82a97..3a2df69 100644
--- a/tests/camera2/CameraModuleFixture.h
+++ b/tests/camera2/CameraModuleFixture.h
@@ -65,7 +65,7 @@
ASSERT_LE(0, mNumberOfCameras);
ASSERT_LE(
- CAMERA_MODULE_API_VERSION_2_0, mModule->getRawModule()->module_api_version)
+ CAMERA_MODULE_API_VERSION_2_0, mModule->getModuleApiVersion())
<< "Wrong module API version";
/* For using this fixture in other tests only */
@@ -83,7 +83,7 @@
mDevice.clear();
if (!TEST_EXTENSION_FORKING_ENABLED) {
- ASSERT_EQ(0, HWModuleHelpers::closeModule(mModule->getRawModule()))
+ ASSERT_EQ(0, HWModuleHelpers::closeModule(mModule->getDso()))
<< "Failed to close camera HAL module";
}
}
diff --git a/tests/camera2/CameraMultiStreamTests.cpp b/tests/camera2/CameraMultiStreamTests.cpp
index bfadfea..0f8d578 100644
--- a/tests/camera2/CameraMultiStreamTests.cpp
+++ b/tests/camera2/CameraMultiStreamTests.cpp
@@ -528,7 +528,8 @@
// Find the right sizes for preview, metering, and capture streams
int64_t minFrameDuration = DEFAULT_FRAME_DURATION;
- Size processedMinSize, processedMaxSize, jpegMaxSize;
+ Size processedMinSize = {0, 0}, processedMaxSize = {0, 0};
+ Size jpegMaxSize = {0, 0};
int32_t minIdx, maxIdx;
GetMinSize(implDefData, implDefCount, &processedMinSize, &minIdx);
diff --git a/tests/camera2/CameraStreamFixture.h b/tests/camera2/CameraStreamFixture.h
index 8a8c27d..e234f7e 100644
--- a/tests/camera2/CameraStreamFixture.h
+++ b/tests/camera2/CameraStreamFixture.h
@@ -111,7 +111,7 @@
mHeight = entry.data.i32[1];
} else {
buildOutputResolutions();
- const int32_t *implDefResolutions;
+ const int32_t *implDefResolutions = NULL;
size_t implDefResolutionsCount;
int format = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED;
diff --git a/tests/camera2/camera2_utils.cpp b/tests/camera2/camera2_utils.cpp
index 930b909..d962939 100644
--- a/tests/camera2/camera2_utils.cpp
+++ b/tests/camera2/camera2_utils.cpp
@@ -580,14 +580,13 @@
mCondition.signal();
}
-int HWModuleHelpers::closeModule(const hw_module_t* module) {
+int HWModuleHelpers::closeModule(void *dso) {
int status;
-
- if (!module) {
+ if (!dso) {
return -EINVAL;
}
- status = dlclose(module->dso);
+ status = dlclose(dso);
if (status != 0) {
char const *err_str = dlerror();
ALOGE("%s dlclose failed, error: %s", __func__, err_str ?: "unknown");
diff --git a/tests/camera2/camera2_utils.h b/tests/camera2/camera2_utils.h
index 2072eb6..ab1fcfb 100644
--- a/tests/camera2/camera2_utils.h
+++ b/tests/camera2/camera2_utils.h
@@ -240,7 +240,7 @@
struct HWModuleHelpers {
/* attempt to unload the library with dlclose */
- static int closeModule(const hw_module_t* module);
+ static int closeModule(void* dso);
};
}