Merge "Change payload size to size_t and add uid param"
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
index 0a907b9..fa22c47 100644
--- a/include/hardware/camera_common.h
+++ b/include/hardware/camera_common.h
@@ -391,7 +391,7 @@
  * device is present. The framework will not call set_torch_mode() to turn on
  * torch mode of a camera device if the camera device is not present. At module
  * load time, the framework will assume torch modes are in the
- * TORCH_MODE_STATUS_AVAILABLE state if the camera device is present and
+ * TORCH_MODE_STATUS_OFF state if the camera device is present and
  * android.flash.info.available is reported as true via get_camera_info() call.
  *
  * The behaviors of the camera HAL module that the framework expects in the
@@ -400,7 +400,7 @@
  *      After camera_module_callbacks::camera_device_status_change() is invoked
  *      to inform the framework that the camera device is present, the framework
  *      will assume the camera device's torch mode is in
- *      TORCH_MODE_STATUS_AVAILABLE state. The camera HAL module does not need
+ *      TORCH_MODE_STATUS_OFF state. The camera HAL module does not need
  *      to invoke camera_module_callbacks::torch_mode_status_change() unless the
  *      flash unit is unavailable to use by set_torch_mode().
  *
@@ -416,47 +416,49 @@
  *  3. open() is called to open a camera device.
  *      The camera HAL module must invoke
  *      camera_module_callbacks::torch_mode_status_change() for all flash units
- *      that have entered TORCH_MODE_STATUS_RESOURCE_BUSY state and can not be
+ *      that have entered TORCH_MODE_STATUS_NOT_AVAILABLE state and can not be
  *      turned on by calling set_torch_mode() anymore due to this open() call.
  *
  *  4. close() is called to close a camera device.
  *      The camera HAL module must invoke
  *      camera_module_callbacks::torch_mode_status_change() for all flash units
- *      that have entered TORCH_MODE_STATUS_AVAILABLE state and can be turned
+ *      that have entered TORCH_MODE_STATUS_OFF state and can be turned
  *      on by calling set_torch_mode() again because of enough resources freed
  *      up by this close() call.
  *
- *  Note that the framework calling set_torch_mode() should not trigger any
- *  callbacks except when HAL cannot keep multiple torch modes on
- *  simultaneously. In that case, HAL must notify the framework that any
- *  previously-on torch mode states have become TORCH_MODE_STATUS_OFF.
- *
+ *  Note that the framework calling set_torch_mode() successfully must trigger
+ *  TORCH_MODE_STATUS_OFF or TORCH_MODE_STATUS_ON callback for the given camera
+ *  device. Additionally it must trigger TORCH_MODE_STATUS_OFF callbacks for
+ *  other previously-on torch modes if HAL cannot keep multiple torch modes on
+ *  simultaneously.
  */
 typedef enum torch_mode_status {
-    /**
-     * The flash unit is available and the torch mode can be turned on by
-     * calling set_torch_mode(). By default, the framework will assume all
-     * flash units of all present camera devices are in this state if
-     * android.flash.info.available is reported as true via get_camera_info()
-     * call.
-     */
-    TORCH_MODE_STATUS_AVAILABLE = 0,
 
     /**
      * The flash unit is no longer available and the torch mode can not be
      * turned on by calling set_torch_mode(). If the torch mode is on, it
      * will be turned off by HAL before HAL calls torch_mode_status_change().
      */
-    TORCH_MODE_STATUS_RESOURCE_BUSY = 1,
+    TORCH_MODE_STATUS_NOT_AVAILABLE = 0,
 
     /**
-     * The previously-on torch mode has been turned off by HAL but the flash
-     * unit is still available for set_torch_mode(). This may happen after the
-     * framework turned on the torch mode of some other camera device and HAL
-     * had to turn off the torch modes of any camera devices that were
-     * previously on.
+     * A torch mode has become off and available to be turned on via
+     * set_torch_mode(). This may happen in the following
+     * cases:
+     *   1. After the resources to turn on the torch mode have become available.
+     *   2. After set_torch_mode() is called to turn off the torch mode.
+     *   3. After the framework turned on the torch mode of some other camera
+     *      device and HAL had to turn off the torch modes of any camera devices
+     *      that were previously on.
      */
-    TORCH_MODE_STATUS_OFF = 2,
+    TORCH_MODE_STATUS_AVAILABLE_OFF = 1,
+
+    /**
+     * A torch mode has become on and available to be turned off via
+     * set_torch_mode(). This can happen only after set_torch_mode() is called
+     * to turn on the torch mode.
+     */
+    TORCH_MODE_STATUS_AVAILABLE_ON = 2,
 
 } torch_mode_status_t;
 
@@ -713,18 +715,19 @@
      * set_torch_mode:
      *
      * Turn on or off the torch mode of the flash unit associated with a given
-     * camera ID. This function is blocking until the operation completes or
-     * fails.
+     * camera ID. If the operation is successful, HAL must notify the framework
+     * torch state by invoking
+     * camera_module_callbacks.torch_mode_status_change() with the new state.
      *
      * The camera device has a higher priority accessing the flash unit. When
      * there are any resource conflicts, such as open() is called to open a
      * camera device, HAL module must notify the framework through
      * camera_module_callbacks.torch_mode_status_change() that the
      * torch mode has been turned off and the torch mode state has become
-     * TORCH_MODE_STATUS_RESOURCE_BUSY. When resources to turn on torch mode
+     * TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode
      * become available again, HAL module must notify the framework through
      * camera_module_callbacks.torch_mode_status_change() that the torch mode
-     * state has become available for set_torch_mode() to be called.
+     * state has become TORCH_MODE_STATUS_OFF for set_torch_mode() to be called.
      *
      * When the framework calls set_torch_mode() to turn on the torch mode of a
      * flash unit, if HAL cannot keep multiple torch modes on simultaneously,
diff --git a/include/hardware/input.h b/include/hardware/input.h
new file mode 100644
index 0000000..dad1bc0
--- /dev/null
+++ b/include/hardware/input.h
@@ -0,0 +1,176 @@
+/*
+ * 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_INCLUDE_HARDWARE_INPUT_H
+#define ANDROID_INCLUDE_HARDWARE_INPUT_H
+
+#include <hardware/hardware.h>
+#include <stdint.h>
+
+__BEGIN_DECLS
+
+#define INPUT_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
+#define INPUT_HARDWARE_MODULE_ID "input"
+
+#define INPUT_INSTANCE_EVDEV "evdev"
+
+typedef enum input_bus {
+    INPUT_BUS_BT,
+    INPUT_BUS_USB,
+    INPUT_BUS_SERIAL,
+    INPUT_BUS_BUILTIN
+} input_bus_t;
+
+typedef struct input_host input_host_t;
+
+typedef struct input_device_handle input_device_handle_t;
+
+typedef struct input_device_identifier input_device_identifier_t;
+
+typedef struct input_device_definition input_device_definition_t;
+
+typedef struct input_report_definition input_report_definition_t;
+
+typedef struct input_report input_report_t;
+
+typedef struct input_collection input_collection_t;
+
+typedef enum {
+    INPUT_USAGE_TOUCHPAD_X,
+    INPUT_USAGE_TOUCHPAD_Y,
+    // etc
+} input_usage_t;
+
+typedef enum {
+    INPUT_COLLECTION_ID_TOUCH,
+    INPUT_COLLECTION_ID_KEYBOARD,
+    INPUT_COLLECTION_ID_MOUSE,
+    INPUT_COLLECTION_ID_TOUCHPAD,
+    // etc
+} input_collection_id_t;
+
+typedef struct input_message input_message_t;
+
+typedef struct input_host_callbacks {
+
+    /**
+     * Creates a device identifier with the given properties.
+     * The unique ID should be a string that precisely identifies a given piece of hardware. For
+     * example, an input device connected via Bluetooth could use its MAC address as its unique ID.
+     */
+    input_device_identifier_t* (*create_device_identifier)(input_host_t* host,
+            const char* name, int32_t product_id, int32_t vendor_id,
+            input_bus_t bus, const char* unique_id);
+
+    /**
+     * Allocates the device definition which will describe the input capabilities of a device. A
+     * device definition may be used to register as many devices as desired.
+     */
+    input_device_definition_t* (*create_device_definition)(input_host_t* host);
+
+    /**
+     * Allocate either an input report, which the HAL will use to tell the host of incoming input
+     * events, or an output report, which the host will use to tell the HAL of desired state
+     * changes (e.g. setting an LED).
+     */
+    input_report_definition_t* (*create_input_report_definition)(input_host_t* host);
+    input_report_definition_t* (*create_output_report_definition)(input_host_t* host);
+
+    /**
+     * Append the report to the given input device.
+     */
+    void (*input_device_definition_add_report)(input_host_t* host,
+            input_device_definition_t* d, input_report_definition_t* r);
+
+    /**
+     * Add a collection with the given arity and ID. A collection describes a set
+     * of logically grouped properties such as the X and Y coordinates of a single finger touch or
+     * the set of keys on a keyboard. The arity declares how many repeated instances of this
+     * collection will appear in whatever report it is attached to. The ID describes the type of
+     * grouping being represented by the collection. For example, a touchscreen capable of
+     * reporting up to 2 fingers simultaneously might have a collection with the X and Y
+     * coordinates, an arity of 2, and an ID of INPUT_COLLECTION_USAGE_TOUCHSCREEN. Any given ID
+     * may only be present once for a given report.
+     */
+    void (*input_report_definition_add_collection)(input_host_t* host,
+            input_report_definition_t* report, input_collection_id_t id, int32_t arity);
+
+    /**
+     * Declare an int usage with the given properties. The report and collection defines where the
+     * usage is being declared.
+     */
+    void (*input_report_definition_declare_usage_int)(input_host_t* host,
+            input_report_definition_t* report, input_collection_id_t id,
+            input_usage_t usage, int32_t min, int32_t max, float resolution);
+
+    /**
+     * Declare a set of boolean usages with the given properties.  The report and collection
+     * defines where the usages are being declared.
+     */
+    void (*input_report_definition_declare_usages_bool)(input_host_t* host,
+            input_report_definition_t* report, input_collection_id_t id,
+            input_usage_t* usage, size_t usage_count);
+
+
+    /**
+     * Register a given input device definition. This notifies the host that an input device has
+     * been connected and gives a description of all its capabilities.
+     */
+    input_device_handle_t* (*register_device)(input_host_t* host,
+            input_device_identifier_t* id, input_device_definition_t* d);
+
+    /** Unregister the given device */
+    void (*unregister_device)(input_host_t* host, input_device_handle_t* handle);
+
+    /**
+     * Allocate a report that will contain all of the state as described by the given report.
+     */
+    input_report_t* (*input_allocate_report)(input_host_t* host, input_report_definition_t* r);
+
+    void (*report_event)(input_host_t* host, input_device_handle_t* d, input_report_t* report);
+} input_host_callbacks_t;
+
+typedef struct input_module input_module_t;
+
+struct input_module {
+    /**
+     * Common methods of the input module. This *must* be the first member
+     * of input_module as users of this structure will cast a hw_module_t
+     * to input_module pointer in contexts where it's known
+     * the hw_module_t references a input_module.
+     */
+    struct hw_module_t common;
+
+    /**
+     * Initialize the module with host callbacks. At this point the HAL should start up whatever
+     * infrastructure it needs to in order to process input events.
+     */
+    void (*init)(const input_module_t* module, input_host_t* host, input_host_callbacks_t cb);
+
+    /**
+     * Sends an output report with a new set of state the host would like the given device to
+     * assume.
+     */
+    void (*notify_report)(input_report_t* report);
+};
+
+static inline int input_open(const struct hw_module_t** module, const char* type) {
+    return hw_get_module_by_class(INPUT_HARDWARE_MODULE_ID, type, module);
+}
+
+__END_DECLS
+
+#endif  /* ANDROID_INCLUDE_HARDWARE_INPUT_H */
diff --git a/include/hardware/keymaster0.h b/include/hardware/keymaster0.h
new file mode 100644
index 0000000..f020e5b
--- /dev/null
+++ b/include/hardware/keymaster0.h
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2011 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_KEYMASTER_0_H
+#define ANDROID_HARDWARE_KEYMASTER_0_H
+
+#include <hardware/keymaster_common.h>
+
+__BEGIN_DECLS
+
+/**
+ * Keymaster0 device definition.
+ */
+struct keymaster0_device {
+    /**
+     * Common methods of the keymaster device.  This *must* be the first member of
+     * keymaster0_device as users of this structure will cast a hw_device_t to
+     * keymaster0_device pointer in contexts where it's known the hw_device_t references a
+     * keymaster0_device.
+     */
+    struct hw_device_t common;
+
+    /**
+     * THIS IS DEPRECATED. Use the new "module_api_version" and "hal_api_version"
+     * fields in the keymaster_module initialization instead.
+     */
+    uint32_t client_version;
+
+    /**
+     * See flags defined for keymaster0_device::flags in keymaster_common.h
+     */
+    uint32_t flags;
+
+    void* context;
+
+    /**
+     * Generates a public and private key. The key-blob returned is opaque
+     * and must subsequently provided for signing and verification.
+     *
+     * Returns: 0 on success or an error code less than 0.
+     */
+    int (*generate_keypair)(const struct keymaster0_device* dev,
+            const keymaster_keypair_t key_type, const void* key_params,
+            uint8_t** key_blob, size_t* key_blob_length);
+
+    /**
+     * Imports a public and private key pair. The imported keys will be in
+     * PKCS#8 format with DER encoding (Java standard). The key-blob
+     * returned is opaque and will be subsequently provided for signing
+     * and verification.
+     *
+     * Returns: 0 on success or an error code less than 0.
+     */
+    int (*import_keypair)(const struct keymaster0_device* dev,
+            const uint8_t* key, const size_t key_length,
+            uint8_t** key_blob, size_t* key_blob_length);
+
+    /**
+     * Gets the public key part of a key pair. The public key must be in
+     * X.509 format (Java standard) encoded byte array.
+     *
+     * Returns: 0 on success or an error code less than 0.
+     * On error, x509_data should not be allocated.
+     */
+    int (*get_keypair_public)(const struct keymaster0_device* dev,
+            const uint8_t* key_blob, const size_t key_blob_length,
+            uint8_t** x509_data, size_t* x509_data_length);
+
+    /**
+     * Deletes the key pair associated with the key blob.
+     *
+     * This function is optional and should be set to NULL if it is not
+     * implemented.
+     *
+     * Returns 0 on success or an error code less than 0.
+     */
+    int (*delete_keypair)(const struct keymaster0_device* dev,
+            const uint8_t* key_blob, const size_t key_blob_length);
+
+    /**
+     * Deletes all keys in the hardware keystore. Used when keystore is
+     * reset completely.
+     *
+     * This function is optional and should be set to NULL if it is not
+     * implemented.
+     *
+     * Returns 0 on success or an error code less than 0.
+     */
+    int (*delete_all)(const struct keymaster0_device* dev);
+
+    /**
+     * Signs data using a key-blob generated before. This can use either
+     * an asymmetric key or a secret key.
+     *
+     * Returns: 0 on success or an error code less than 0.
+     */
+    int (*sign_data)(const struct keymaster0_device* dev,
+            const void* signing_params,
+            const uint8_t* key_blob, const size_t key_blob_length,
+            const uint8_t* data, const size_t data_length,
+            uint8_t** signed_data, size_t* signed_data_length);
+
+    /**
+     * Verifies data signed with a key-blob. This can use either
+     * an asymmetric key or a secret key.
+     *
+     * Returns: 0 on successful verification or an error code less than 0.
+     */
+    int (*verify_data)(const struct keymaster0_device* dev,
+            const void* signing_params,
+            const uint8_t* key_blob, const size_t key_blob_length,
+            const uint8_t* signed_data, const size_t signed_data_length,
+            const uint8_t* signature, const size_t signature_length);
+};
+typedef struct keymaster0_device keymaster0_device_t;
+
+
+/* Convenience API for opening and closing keymaster devices */
+
+static inline int keymaster0_open(const struct hw_module_t* module,
+        keymaster0_device_t** device)
+{
+    int rc = module->methods->open(module, KEYSTORE_KEYMASTER,
+            (struct hw_device_t**) device);
+
+    return rc;
+}
+
+static inline int keymaster0_close(keymaster0_device_t* device)
+{
+    return device->common.close(&device->common);
+}
+
+__END_DECLS
+
+#endif  // ANDROID_HARDWARE_KEYMASTER_0_H
diff --git a/include/hardware/keymaster.h b/include/hardware/keymaster1.h
similarity index 88%
rename from include/hardware/keymaster.h
rename to include/hardware/keymaster1.h
index db66a74..dae3b8e 100644
--- a/include/hardware/keymaster.h
+++ b/include/hardware/keymaster1.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * 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.
@@ -14,57 +14,18 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_HARDWARE_KEYMASTER_H
-#define ANDROID_HARDWARE_KEYMASTER_H
+#ifndef ANDROID_HARDWARE_KEYMASTER1_H
+#define ANDROID_HARDWARE_KEYMASTER1_H
 
-#include <stdint.h>
-#include <sys/cdefs.h>
-#include <sys/types.h>
-
-#include <hardware/hardware.h>
+#include <hardware/keymaster_common.h>
 #include <hardware/keymaster_defs.h>
 
 __BEGIN_DECLS
 
 /**
- * The id of this module
+ * Keymaster1 device definition
  */
-#define KEYSTORE_HARDWARE_MODULE_ID "keystore"
-
-#define KEYSTORE_KEYMASTER "keymaster"
-
-/**
- * Settings for "module_api_version" and "hal_api_version"
- * fields in the keymaster_module initialization.
- */
-#define KEYMASTER_HEADER_VERSION 4
-
-#define KEYMASTER_MODULE_API_VERSION_0_2 HARDWARE_MODULE_API_VERSION(0, 2)
-#define KEYMASTER_DEVICE_API_VERSION_0_2 \
-    HARDWARE_DEVICE_API_VERSION_2(0, 2, KEYMASTER_HEADER_VERSION)
-
-#define KEYMASTER_MODULE_API_VERSION_0_3 HARDWARE_MODULE_API_VERSION(0, 3)
-#define KEYMASTER_DEVICE_API_VERSION_0_3 \
-    HARDWARE_DEVICE_API_VERSION_2(0, 3, KEYMASTER_HEADER_VERSION)
-
-#define KEYMASTER_MODULE_API_VERSION_0_4 HARDWARE_MODULE_API_VERSION(0, 4)
-#define KEYMASTER_DEVICE_API_VERSION_0_4 \
-    HARDWARE_DEVICE_API_VERSION_2(0, 4, KEYMASTER_HEADER_VERSION)
-
-struct keystore_module {
-    /**
-     * Common methods of the keystore module.  This *must* be the first member of
-     * keystore_module as users of this structure will cast a hw_module_t to
-     * keystore_module pointer in contexts where it's known the hw_module_t references a
-     * keystore_module.
-     */
-    hw_module_t common;
-};
-
-/**
- * The parameters that can be set for a given keymaster implementation.
- */
-struct keymaster_device {
+struct keymaster1_device {
     /**
      * Common methods of the keymaster device.  This *must* be the first member of
      * keymaster_device as users of this structure will cast a hw_device_t to
@@ -80,7 +41,7 @@
     uint32_t client_version;
 
     /**
-     * See flags defined for keymaster_device::flags above.
+     * See flags defined for keymaster0_devices::flags in keymaster_common.h
      */
     uint32_t flags;
 
@@ -92,7 +53,7 @@
      *
      * Returns: 0 on success or an error code less than 0.
      */
-    int (*generate_keypair)(const struct keymaster_device* dev, const keymaster_keypair_t key_type,
+    int (*generate_keypair)(const struct keymaster1_device* dev, const keymaster_keypair_t key_type,
                             const void* key_params, uint8_t** key_blob, size_t* key_blob_length);
 
     /**
@@ -102,7 +63,7 @@
      *
      * Returns: 0 on success or an error code less than 0.
      */
-    int (*import_keypair)(const struct keymaster_device* dev, const uint8_t* key,
+    int (*import_keypair)(const struct keymaster1_device* dev, const uint8_t* key,
                           const size_t key_length, uint8_t** key_blob, size_t* key_blob_length);
 
     /**
@@ -112,7 +73,7 @@
      * Returns: 0 on success or an error code less than 0.  On error, x509_data
      * should not be allocated.
      */
-    int (*get_keypair_public)(const struct keymaster_device* dev, const uint8_t* key_blob,
+    int (*get_keypair_public)(const struct keymaster1_device* dev, const uint8_t* key_blob,
                               const size_t key_blob_length, uint8_t** x509_data,
                               size_t* x509_data_length);
 
@@ -124,7 +85,7 @@
      *
      * Returns 0 on success or an error code less than 0.
      */
-    int (*delete_keypair)(const struct keymaster_device* dev, const uint8_t* key_blob,
+    int (*delete_keypair)(const struct keymaster1_device* dev, const uint8_t* key_blob,
                           const size_t key_blob_length);
 
     /**
@@ -136,7 +97,7 @@
      *
      * Returns 0 on success or an error code less than 0.
      */
-    int (*delete_all)(const struct keymaster_device* dev);
+    int (*delete_all)(const struct keymaster1_device* dev);
 
     /**
      * \deprecated Signs data using a key-blob generated before. This can use either an asymmetric
@@ -144,7 +105,7 @@
      *
      * Returns: 0 on success or an error code less than 0.
      */
-    int (*sign_data)(const struct keymaster_device* dev, const void* signing_params,
+    int (*sign_data)(const struct keymaster1_device* dev, const void* signing_params,
                      const uint8_t* key_blob, const size_t key_blob_length, const uint8_t* data,
                      const size_t data_length, uint8_t** signed_data, size_t* signed_data_length);
 
@@ -154,7 +115,7 @@
      *
      * Returns: 0 on successful verification or an error code less than 0.
      */
-    int (*verify_data)(const struct keymaster_device* dev, const void* signing_params,
+    int (*verify_data)(const struct keymaster1_device* dev, const void* signing_params,
                        const uint8_t* key_blob, const size_t key_blob_length,
                        const uint8_t* signed_data, const size_t signed_data_length,
                        const uint8_t* signature, const size_t signature_length);
@@ -169,7 +130,7 @@
      *
      * \param[out] algorithms_length Length of \p algorithms.
      */
-    keymaster_error_t (*get_supported_algorithms)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_algorithms)(const struct keymaster1_device* dev,
                                                   keymaster_algorithm_t** algorithms,
                                                   size_t* algorithms_length);
 
@@ -185,7 +146,7 @@
      *
      * \param[out] modes_length Length of \p modes.
      */
-    keymaster_error_t (*get_supported_block_modes)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_block_modes)(const struct keymaster1_device* dev,
                                                    keymaster_algorithm_t algorithm,
                                                    keymaster_purpose_t purpose,
                                                    keymaster_block_mode_t** modes,
@@ -204,7 +165,7 @@
      *
      * \param[out] modes_length Length of \p modes.
      */
-    keymaster_error_t (*get_supported_padding_modes)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_padding_modes)(const struct keymaster1_device* dev,
                                                      keymaster_algorithm_t algorithm,
                                                      keymaster_purpose_t purpose,
                                                      keymaster_padding_t** modes,
@@ -223,7 +184,7 @@
      *
      * \param[out] digests_length Length of \p digests.
      */
-    keymaster_error_t (*get_supported_digests)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_digests)(const struct keymaster1_device* dev,
                                                keymaster_algorithm_t algorithm,
                                                keymaster_purpose_t purpose,
                                                keymaster_digest_t** digests,
@@ -242,7 +203,7 @@
      *
      * \param[out] formats_length Length of \p formats.
      */
-    keymaster_error_t (*get_supported_import_formats)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_import_formats)(const struct keymaster1_device* dev,
                                                       keymaster_algorithm_t algorithm,
                                                       keymaster_key_format_t** formats,
                                                       size_t* formats_length);
@@ -260,7 +221,7 @@
      *
      * \param[out] formats_length Length of \p formats.
      */
-    keymaster_error_t (*get_supported_export_formats)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_supported_export_formats)(const struct keymaster1_device* dev,
                                                       keymaster_algorithm_t algorithm,
                                                       keymaster_key_format_t** formats,
                                                       size_t* formats_length);
@@ -278,7 +239,7 @@
      *
      * \param[in] data_length Length of \p data.
      */
-    keymaster_error_t (*add_rng_entropy)(const struct keymaster_device* dev, const uint8_t* data,
+    keymaster_error_t (*add_rng_entropy)(const struct keymaster1_device* dev, const uint8_t* data,
                                          size_t data_length);
 
     /**
@@ -336,7 +297,7 @@
      * keymaster_free_characteristics().  Note that KM_TAG_ROOT_OF_TRUST, KM_TAG_APPLICATION_ID and
      * KM_TAG_APPLICATION_DATA are never returned.
      */
-    keymaster_error_t (*generate_key)(const struct keymaster_device* dev,
+    keymaster_error_t (*generate_key)(const struct keymaster1_device* dev,
                                       const keymaster_key_param_t* params, size_t params_count,
                                       keymaster_key_blob_t* key_blob,
                                       keymaster_key_characteristics_t** characteristics);
@@ -361,7 +322,7 @@
      *
      * \param[out] characteristics The key characteristics.
      */
-    keymaster_error_t (*get_key_characteristics)(const struct keymaster_device* dev,
+    keymaster_error_t (*get_key_characteristics)(const struct keymaster1_device* dev,
                                                  const keymaster_key_blob_t* key_blob,
                                                  const keymaster_blob_t* client_id,
                                                  const keymaster_blob_t* app_data,
@@ -396,7 +357,7 @@
      * hw_enforced and sw_enforced lists.  The caller takes ownership and must call
      * keymaster_free_characteristics() to free.
      */
-    keymaster_error_t (*rescope)(const struct keymaster_device* dev,
+    keymaster_error_t (*rescope)(const struct keymaster1_device* dev,
                                  const keymaster_key_param_t* new_params, size_t new_params_count,
                                  const keymaster_key_blob_t* key_blob,
                                  const keymaster_blob_t* client_id,
@@ -456,7 +417,7 @@
      * NULL, in which case no characteristics will be returned.  If non-NULL, the caller assumes
      * ownership and must deallocate with keymaster_free_characteristics().
      */
-    keymaster_error_t (*import_key)(const struct keymaster_device* dev,
+    keymaster_error_t (*import_key)(const struct keymaster1_device* dev,
                                     const keymaster_key_param_t* params, size_t params_count,
                                     keymaster_key_format_t key_format, const uint8_t* key_data,
                                     size_t key_data_length, keymaster_key_blob_t* key_blob,
@@ -475,7 +436,7 @@
      *
      * \param[out] export_data_length The length of \p export_data.
      */
-    keymaster_error_t (*export_key)(const struct keymaster_device* dev,
+    keymaster_error_t (*export_key)(const struct keymaster1_device* dev,
                                     keymaster_key_format_t export_format,
                                     const keymaster_key_blob_t* key_to_export,
                                     const keymaster_blob_t* client_id,
@@ -494,7 +455,7 @@
      *
      * \param[in] key The key to be deleted.
      */
-    keymaster_error_t (*delete_key)(const struct keymaster_device* dev,
+    keymaster_error_t (*delete_key)(const struct keymaster1_device* dev,
                                     const keymaster_key_blob_t* key);
 
     /**
@@ -508,7 +469,7 @@
      *
      * Returns 0 on success or an error code less than 0.
      */
-    int (*delete_all_keys)(const struct keymaster_device* dev);
+    int (*delete_all_keys)(const struct keymaster1_device* dev);
 
     /**
      * Begins a cryptographic operation using the specified key.  If all is well, begin() will
@@ -549,7 +510,7 @@
      * \param[out] operation_handle The newly-created operation handle which must be passed to
      * update(), finish() or abort().
      */
-    keymaster_error_t (*begin)(const struct keymaster_device* dev, keymaster_purpose_t purpose,
+    keymaster_error_t (*begin)(const struct keymaster1_device* dev, keymaster_purpose_t purpose,
                                const keymaster_key_blob_t* key, const keymaster_key_param_t* params,
                                size_t params_count, keymaster_key_param_t** out_params,
                                size_t* out_params_count,
@@ -593,7 +554,7 @@
      * Note that update() may not provide any output, in which case *output_length will be zero, and
      * *output may be either NULL or zero-length (so the caller should always free() it).
      */
-    keymaster_error_t (*update)(const struct keymaster_device* dev,
+    keymaster_error_t (*update)(const struct keymaster1_device* dev,
                                 keymaster_operation_handle_t operation_handle,
                                 const keymaster_key_param_t* params, size_t params_count,
                                 const uint8_t* input, size_t input_length, size_t* input_consumed,
@@ -626,7 +587,7 @@
      * If the operation being finished is a signature verification or an AEAD-mode decryption and
      * verification fails then finish() will return KM_ERROR_VERIFICATION_FAILED.
      */
-    keymaster_error_t (*finish)(const struct keymaster_device* dev,
+    keymaster_error_t (*finish)(const struct keymaster1_device* dev,
                                 keymaster_operation_handle_t operation_handle,
                                 const keymaster_key_param_t* params, size_t params_count,
                                 const uint8_t* signature, size_t signature_length, uint8_t** output,
@@ -636,21 +597,21 @@
      * Aborts a cryptographic operation begun with begin(), freeing all internal resources and
      * invalidating operation_handle.
      */
-    keymaster_error_t (*abort)(const struct keymaster_device* dev,
+    keymaster_error_t (*abort)(const struct keymaster1_device* dev,
                                keymaster_operation_handle_t operation_handle);
 };
-typedef struct keymaster_device keymaster_device_t;
+typedef struct keymaster1_device keymaster1_device_t;
 
 /* Convenience API for opening and closing keymaster devices */
 
-static inline int keymaster_open(const struct hw_module_t* module, keymaster_device_t** device) {
+static inline int keymaster1_open(const struct hw_module_t* module, keymaster1_device_t** device) {
     return module->methods->open(module, KEYSTORE_KEYMASTER, (struct hw_device_t**)device);
 }
 
-static inline int keymaster_close(keymaster_device_t* device) {
+static inline int keymaster1_close(keymaster1_device_t* device) {
     return device->common.close(&device->common);
 }
 
 __END_DECLS
 
-#endif  // ANDROID_HARDWARE_KEYMASTER_H
+#endif  // ANDROID_HARDWARE_KEYMASTER1_H
diff --git a/include/hardware/keymaster_common.h b/include/hardware/keymaster_common.h
new file mode 100644
index 0000000..772d7e4
--- /dev/null
+++ b/include/hardware/keymaster_common.h
@@ -0,0 +1,185 @@
+/*
+ * 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_KEYMASTER_COMMON_H
+#define ANDROID_HARDWARE_KEYMASTER_COMMON_H
+
+#include <stdint.h>
+#include <sys/cdefs.h>
+#include <sys/types.h>
+
+#include <hardware/hardware.h>
+
+__BEGIN_DECLS
+
+/**
+ * The id of this module
+ */
+#define KEYSTORE_HARDWARE_MODULE_ID "keystore"
+
+#define KEYSTORE_KEYMASTER "keymaster"
+
+
+/**
+ * Settings for "module_api_version" and "hal_api_version"
+ * fields in the keymaster_module initialization.
+ */
+
+/**
+ * Keymaster 0.X module version provide the same APIs, but later versions add more options
+ * for algorithms and flags.
+ */
+#define KEYMASTER_MODULE_API_VERSION_0_2 HARDWARE_MODULE_API_VERSION(0, 2)
+#define KEYMASTER_DEVICE_API_VERSION_0_2 HARDWARE_DEVICE_API_VERSION(0, 2)
+
+#define KEYMASTER_MODULE_API_VERSION_0_3 HARDWARE_MODULE_API_VERSION(0, 3)
+#define KEYMASTER_DEVICE_API_VERSION_0_3 HARDWARE_DEVICE_API_VERSION(0, 3)
+
+/**
+ * Keymaster 1.0 module version provides a completely different API, incompatible with 0.X.
+ */
+#define KEYMASTER_MODULE_API_VERSION_1_0 HARDWARE_MODULE_API_VERSION(1, 0)
+#define KEYMASTER_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0)
+
+struct keystore_module {
+    /**
+     * Common methods of the keystore module.  This *must* be the first member of keystore_module as
+     * users of this structure will cast a hw_module_t to keystore_module pointer in contexts where
+     * it's known the hw_module_t references a keystore_module.
+     */
+    hw_module_t common;
+
+    /* There are no keystore module methods other than the common ones. */
+};
+
+/**
+ * Flags for keymaster0_device::flags
+ */
+enum {
+    /*
+     * Indicates this keymaster implementation does not have hardware that
+     * keeps private keys out of user space.
+     *
+     * This should not be implemented on anything other than the default
+     * implementation.
+     */
+    KEYMASTER_SOFTWARE_ONLY = 1 << 0,
+
+    /*
+     * This indicates that the key blobs returned via all the primitives
+     * are sufficient to operate on their own without the trusted OS
+     * querying userspace to retrieve some other data. Key blobs of
+     * this type are normally returned encrypted with a
+     * Key Encryption Key (KEK).
+     *
+     * This is currently used by "vold" to know whether the whole disk
+     * encryption secret can be unwrapped without having some external
+     * service started up beforehand since the "/data" partition will
+     * be unavailable at that point.
+     */
+    KEYMASTER_BLOBS_ARE_STANDALONE = 1 << 1,
+
+    /*
+     * Indicates that the keymaster module supports DSA keys.
+     */
+    KEYMASTER_SUPPORTS_DSA = 1 << 2,
+
+    /*
+     * Indicates that the keymaster module supports EC keys.
+     */
+    KEYMASTER_SUPPORTS_EC = 1 << 3,
+};
+
+/**
+ * Asymmetric key pair types.
+ */
+typedef enum {
+    TYPE_RSA = 1,
+    TYPE_DSA = 2,
+    TYPE_EC = 3,
+} keymaster_keypair_t;
+
+/**
+ * Parameters needed to generate an RSA key.
+ */
+typedef struct {
+    uint32_t modulus_size;
+    uint64_t public_exponent;
+} keymaster_rsa_keygen_params_t;
+
+/**
+ * Parameters needed to generate a DSA key.
+ */
+typedef struct {
+    uint32_t key_size;
+    uint32_t generator_len;
+    uint32_t prime_p_len;
+    uint32_t prime_q_len;
+    const uint8_t* generator;
+    const uint8_t* prime_p;
+    const uint8_t* prime_q;
+} keymaster_dsa_keygen_params_t;
+
+/**
+ * Parameters needed to generate an EC key.
+ *
+ * Field size is the only parameter in version 2. The sizes correspond to these required curves:
+ *
+ * 192 = NIST P-192
+ * 224 = NIST P-224
+ * 256 = NIST P-256
+ * 384 = NIST P-384
+ * 521 = NIST P-521
+ *
+ * The parameters for these curves are available at: http://www.nsa.gov/ia/_files/nist-routines.pdf
+ * in Chapter 4.
+ */
+typedef struct {
+    uint32_t field_size;
+} keymaster_ec_keygen_params_t;
+
+
+/**
+ * Digest type.
+ */
+typedef enum {
+    DIGEST_NONE,
+} keymaster_digest_algorithm_t;
+
+/**
+ * Type of padding used for RSA operations.
+ */
+typedef enum {
+    PADDING_NONE,
+} keymaster_rsa_padding_t;
+
+
+typedef struct {
+    keymaster_digest_algorithm_t digest_type;
+} keymaster_dsa_sign_params_t;
+
+typedef struct {
+    keymaster_digest_algorithm_t digest_type;
+} keymaster_ec_sign_params_t;
+
+typedef struct {
+    keymaster_digest_algorithm_t digest_type;
+    keymaster_rsa_padding_t padding_type;
+} keymaster_rsa_sign_params_t;
+
+__END_DECLS
+
+#endif  // ANDROID_HARDWARE_KEYMASTER_COMMON_H
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index 9c6ad9d..2e93dc6 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -25,57 +25,6 @@
 extern "C" {
 #endif  // defined(__cplusplus)
 
-/*!
- * \deprecated Flags for keymaster_device::flags
- *
- * keymaster_device::flags is deprecated and will be removed in the
- * next version of the API in favor of the more detailed information
- * available from TODO:
- */
-enum {
-    /*
-     * Indicates this keymaster implementation does not have hardware that
-     * keeps private keys out of user space.
-     *
-     * This should not be implemented on anything other than the default
-     * implementation.
-     */
-    KEYMASTER_SOFTWARE_ONLY = 1 << 0,
-
-    /*
-     * This indicates that the key blobs returned via all the primitives
-     * are sufficient to operate on their own without the trusted OS
-     * querying userspace to retrieve some other data. Key blobs of
-     * this type are normally returned encrypted with a
-     * Key Encryption Key (KEK).
-     *
-     * This is currently used by "vold" to know whether the whole disk
-     * encryption secret can be unwrapped without having some external
-     * service started up beforehand since the "/data" partition will
-     * be unavailable at that point.
-     */
-    KEYMASTER_BLOBS_ARE_STANDALONE = 1 << 1,
-
-    /*
-     * Indicates that the keymaster module supports DSA keys.
-     */
-    KEYMASTER_SUPPORTS_DSA = 1 << 2,
-
-    /*
-     * Indicates that the keymaster module supports EC keys.
-     */
-    KEYMASTER_SUPPORTS_EC = 1 << 3,
-};
-
-/**
- * \deprecated Asymmetric key pair types.
- */
-typedef enum {
-    TYPE_RSA = 1,
-    TYPE_DSA = 2,
-    TYPE_EC = 3,
-} keymaster_keypair_t;
-
 /**
  * Authorization tags each have an associated type.  This enumeration facilitates tagging each with
  * a type, by using the high four bits (of an implied 32-bit unsigned enum value) to specify up to
@@ -107,7 +56,7 @@
     KM_TAG_KEY_SIZE = KM_INT | 3,         /* Key size in bits. */
     KM_TAG_BLOCK_MODE = KM_ENUM | 4,      /* keymaster_block_mode_t. */
     KM_TAG_DIGEST = KM_ENUM | 5,          /* keymaster_digest_t. */
-    KM_TAG_MAC_LENGTH = KM_INT | 6,       /* MAC length in bits. */
+    KM_TAG_MAC_LENGTH = KM_INT | 6,       /* MAC or AEAD authentication tag length in bits. */
     KM_TAG_PADDING = KM_ENUM | 7,         /* keymaster_padding_t. */
     KM_TAG_RETURN_UNAUTHED = KM_BOOL | 8, /* Allow AEAD decryption to return plaintext before it has
                                              been authenticated.  WARNING: Not recommended. */
@@ -183,9 +132,7 @@
 
 /**
  * Algorithms that may be provided by keymaster implementations.  Those that must be provided by all
- * implementations are tagged as "required".  Note that where the values in this enumeration overlap
- * with the values for the deprecated keymaster_keypair_t, the same algorithm must be
- * specified. This type is new in 0_4 and replaces the deprecated keymaster_keypair_t.
+ * implementations are tagged as "required".
  */
 typedef enum {
     /* Asymmetric algorithms. */
@@ -271,7 +218,6 @@
  */
 typedef enum {
     KM_DIGEST_NONE = 0,           /* new, required */
-    DIGEST_NONE = KM_DIGEST_NONE, /* For 0_2 compatibility */
     KM_DIGEST_MD5 = 1,            /* new, for compatibility with old protocols only */
     KM_DIGEST_SHA1 = 2,           /* new */
     KM_DIGEST_SHA_2_224 = 3,      /* new */
@@ -433,68 +379,6 @@
     KM_ERROR_UNKNOWN_ERROR = -1000,
 } keymaster_error_t;
 
-/**
- * \deprecated Parameters needed to generate an RSA key.
- */
-typedef struct {
-    uint32_t modulus_size; /* bits */
-    uint64_t public_exponent;
-} keymaster_rsa_keygen_params_t;
-
-/**
- * \deprecated Parameters needed to generate a DSA key.
- */
-typedef struct {
-    uint32_t key_size; /* bits */
-    uint32_t generator_len;
-    uint32_t prime_p_len;
-    uint32_t prime_q_len;
-    const uint8_t* generator;
-    const uint8_t* prime_p;
-    const uint8_t* prime_q;
-} keymaster_dsa_keygen_params_t;
-
-/**
- * \deprecated Parameters needed to generate an EC key.
- *
- * Field size is the only parameter in version 4. The sizes correspond to these required curves:
- *
- * 192 = NIST P-192
- * 224 = NIST P-224
- * 256 = NIST P-256
- * 384 = NIST P-384
- * 521 = NIST P-521
- *
- * The parameters for these curves are available at: http://www.nsa.gov/ia/_files/nist-routines.pdf
- * in Chapter 4.
- */
-typedef struct { uint32_t field_size; /* bits */ } keymaster_ec_keygen_params_t;
-
-/**
- * \deprecated Type of padding used for RSA operations.
- */
-typedef enum {
-    PADDING_NONE,
-} keymaster_rsa_padding_t;
-
-/**
- * \deprecated
- */
-typedef struct { keymaster_digest_t digest_type; } keymaster_dsa_sign_params_t;
-
-/**
- * \deprecated
- */
-typedef struct { keymaster_digest_t digest_type; } keymaster_ec_sign_params_t;
-
-/**
- *\deprecated
- */
-typedef struct {
-    keymaster_digest_t digest_type;
-    keymaster_rsa_padding_t padding_type;
-} keymaster_rsa_sign_params_t;
-
 /* Convenience functions for manipulating keymaster tag types */
 
 static inline keymaster_tag_type_t keymaster_tag_get_type(keymaster_tag_t tag) {
diff --git a/modules/Android.mk b/modules/Android.mk
index 13a0b5b..9f7e5f0 100644
--- a/modules/Android.mk
+++ b/modules/Android.mk
@@ -1,4 +1,4 @@
 hardware_modules := gralloc hwcomposer audio nfc nfc-nci local_time \
 	power usbaudio audio_remote_submix camera usbcamera consumerir sensors vibrator \
-	tv_input fingerprint
+	tv_input fingerprint input
 include $(call all-named-subdir-makefiles,$(hardware_modules))
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/ExampleCamera.cpp
index ca28b99..d873321 100644
--- a/modules/camera/ExampleCamera.cpp
+++ b/modules/camera/ExampleCamera.cpp
@@ -92,7 +92,7 @@
 
     /* android.scaler */
     int32_t android_scaler_available_formats[] = {
-            HAL_PIXEL_FORMAT_RAW_SENSOR,
+            HAL_PIXEL_FORMAT_RAW16,
             HAL_PIXEL_FORMAT_BLOB,
             HAL_PIXEL_FORMAT_RGBA_8888,
             HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp
index 90ad30b..e0099b6 100644
--- a/modules/camera/Stream.cpp
+++ b/modules/camera/Stream.cpp
@@ -117,10 +117,6 @@
         return "RGB 888";
     case HAL_PIXEL_FORMAT_RGB_565:
         return "RGB 565";
-    case HAL_PIXEL_FORMAT_sRGB_A_8888:
-        return "sRGB A 8888";
-    case HAL_PIXEL_FORMAT_sRGB_X_8888:
-        return "sRGB B 8888";
     case HAL_PIXEL_FORMAT_Y8:
         return "Y8";
     case HAL_PIXEL_FORMAT_Y16:
@@ -133,8 +129,10 @@
         return "NV21";
     case HAL_PIXEL_FORMAT_YCbCr_422_I:
         return "YUY2";
-    case HAL_PIXEL_FORMAT_RAW_SENSOR:
-        return "RAW SENSOR";
+    case HAL_PIXEL_FORMAT_RAW10:
+        return "RAW10";
+    case HAL_PIXEL_FORMAT_RAW16:
+        return "RAW16";
     case HAL_PIXEL_FORMAT_BLOB:
         return "BLOB";
     case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index bdc789d..a9fbc80 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -217,7 +217,7 @@
             bpp = 3;
             break;
         case HAL_PIXEL_FORMAT_RGB_565:
-        case HAL_PIXEL_FORMAT_RAW_SENSOR:
+        case HAL_PIXEL_FORMAT_RAW16:
             bpp = 2;
             break;
         default:
diff --git a/modules/input/Android.mk b/modules/input/Android.mk
new file mode 100644
index 0000000..3011b2e
--- /dev/null
+++ b/modules/input/Android.mk
@@ -0,0 +1,19 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/modules/input/evdev/Android.mk b/modules/input/evdev/Android.mk
new file mode 100644
index 0000000..ad05af3
--- /dev/null
+++ b/modules/input/evdev/Android.mk
@@ -0,0 +1,29 @@
+# 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := input.evdev.default
+LOCAL_MODULE_RELATIVE_PATH := hw
+
+LOCAL_SRC_FILES := \
+    EvdevModule.cpp
+
+LOCAL_SHARED_LIBRARIES := liblog
+
+LOCAL_MODULE_TAGS := optional
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/modules/input/evdev/EvdevModule.cpp b/modules/input/evdev/EvdevModule.cpp
new file mode 100644
index 0000000..f56842a
--- /dev/null
+++ b/modules/input/evdev/EvdevModule.cpp
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+#define LOG_NDEBUG 0
+#define LOG_TAG "EvdevModule"
+
+#include <assert.h>
+#include <hardware/hardware.h>
+#include <hardware/input.h>
+
+namespace input {
+
+extern "C" {
+
+static int dummy_open(const hw_module_t __unused *module, const char __unused *id,
+                            hw_device_t __unused **device) {
+    assert(false);
+    return 0;
+}
+
+static void input_init(const input_module_t* module,
+        input_host_t* host, input_host_callbacks_t cb) {
+    return;
+}
+
+static void input_notify_report(input_report_t* r) {
+    return;
+}
+
+static struct hw_module_methods_t input_module_methods = {
+    .open = dummy_open,
+};
+
+input_module_t HAL_MODULE_INFO_SYM = {
+    .common = {
+        .tag                = HARDWARE_MODULE_TAG,
+        .module_api_version = INPUT_MODULE_API_VERSION_1_0,
+        .hal_api_version    = HARDWARE_HAL_API_VERSION,
+        .id                 = INPUT_HARDWARE_MODULE_ID,
+        .name               = "Input evdev HAL",
+        .author             = "The Android Open Source Project",
+        .methods            = &input_module_methods,
+        .dso                = NULL,
+        .reserved           = {0},
+    },
+
+    .init = input_init,
+    .notify_report = input_notify_report,
+};
+
+}  // extern "C"
+
+}  // namespace input
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index a3fefa3..f56866e 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -98,10 +98,6 @@
         return "RGB 888";
     case HAL_PIXEL_FORMAT_RGB_565:
         return "RGB 565";
-    case HAL_PIXEL_FORMAT_sRGB_A_8888:
-        return "sRGB A 8888";
-    case HAL_PIXEL_FORMAT_sRGB_X_8888:
-        return "sRGB B 8888";
     case HAL_PIXEL_FORMAT_Y8:
         return "Y8";
     case HAL_PIXEL_FORMAT_Y16:
@@ -114,8 +110,10 @@
         return "NV21";
     case HAL_PIXEL_FORMAT_YCbCr_422_I:
         return "YUY2";
-    case HAL_PIXEL_FORMAT_RAW_SENSOR:
-        return "RAW SENSOR";
+    case HAL_PIXEL_FORMAT_RAW10:
+        return "RAW10";
+    case HAL_PIXEL_FORMAT_RAW16:
+        return "RAW16";
     case HAL_PIXEL_FORMAT_BLOB:
         return "BLOB";
     case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index ded3e92..82a1145 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -94,7 +94,7 @@
 
     /* android.scaler */
     int32_t android_scaler_available_formats[] = {
-            HAL_PIXEL_FORMAT_RAW_SENSOR,
+            HAL_PIXEL_FORMAT_RAW16,
             HAL_PIXEL_FORMAT_BLOB,
             HAL_PIXEL_FORMAT_RGBA_8888,
             HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
diff --git a/tests/camera2/CameraMetadataTests.cpp b/tests/camera2/CameraMetadataTests.cpp
index 94fa911..da5b748 100644
--- a/tests/camera2/CameraMetadataTests.cpp
+++ b/tests/camera2/CameraMetadataTests.cpp
@@ -169,7 +169,7 @@
         if (rawResolutionsCount > 0) {
             EXPECT_TRUE(
                 HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
-                        HAL_PIXEL_FORMAT_RAW_SENSOR));
+                        HAL_PIXEL_FORMAT_RAW16));
         }
 
         // Required processed sizes.
diff --git a/tests/camera2/CameraStreamTests.cpp b/tests/camera2/CameraStreamTests.cpp
index 69ee274..a3b8c47 100644
--- a/tests/camera2/CameraStreamTests.cpp
+++ b/tests/camera2/CameraStreamTests.cpp
@@ -166,15 +166,15 @@
         /*mHeapCount*/ 3
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 1
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 2
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 3
     },
 };
diff --git a/tests/camera2/camera2.cpp b/tests/camera2/camera2.cpp
index 72b7b61..8d637d4 100644
--- a/tests/camera2/camera2.cpp
+++ b/tests/camera2/camera2.cpp
@@ -305,7 +305,7 @@
             }
 
             camera_metadata_ro_entry_t availableSizes;
-            if (format == HAL_PIXEL_FORMAT_RAW_SENSOR) {
+            if (format == HAL_PIXEL_FORMAT_RAW16) {
                 res = find_camera_metadata_ro_entry(mStaticInfo,
                         ANDROID_SCALER_AVAILABLE_RAW_SIZES,
                         &availableSizes);
@@ -445,7 +445,7 @@
         const int32_t *rawResolutions;
         size_t   rawResolutionsCount;
 
-        int format = HAL_PIXEL_FORMAT_RAW_SENSOR;
+        int format = HAL_PIXEL_FORMAT_RAW16;
 
         getResolutionList(format,
                 &rawResolutions, &rawResolutionsCount);
@@ -457,7 +457,7 @@
                       << test_info->test_case_name() << "."
                       << test_info->name()
                       << " because the optional format was not available: "
-                      << "RAW_SENSOR" << std::endl;
+                      << "RAW16" << std::endl;
             return;
         }
 
@@ -581,7 +581,7 @@
         const int32_t *rawResolutions;
         size_t    rawResolutionsCount;
 
-        int format = HAL_PIXEL_FORMAT_RAW_SENSOR;
+        int format = HAL_PIXEL_FORMAT_RAW16;
 
         getResolutionList(format,
                 &rawResolutions, &rawResolutionsCount);
@@ -593,7 +593,7 @@
                       << test_info->test_case_name() << "."
                       << test_info->name()
                       << " because the optional format was not available: "
-                      << "RAW_SENSOR" << std::endl;
+                      << "RAW16" << std::endl;
             return;
         }
 
diff --git a/tests/keymaster/keymaster_test.cpp b/tests/keymaster/keymaster_test.cpp
index 6b76ccb..e5e1dfd 100644
--- a/tests/keymaster/keymaster_test.cpp
+++ b/tests/keymaster/keymaster_test.cpp
@@ -35,7 +35,7 @@
 
 #include <UniquePtr.h>
 
-#include <hardware/keymaster.h>
+#include <hardware/keymaster0.h>
 
 namespace android {
 
@@ -92,13 +92,13 @@
 
 class UniqueKey : public UniqueBlob {
 public:
-    UniqueKey(keymaster_device_t** dev, uint8_t* bytes, size_t length) :
+    UniqueKey(keymaster0_device_t** dev, uint8_t* bytes, size_t length) :
             UniqueBlob(bytes, length), mDevice(dev) {
     }
 
     ~UniqueKey() {
         if (mDevice != NULL && *mDevice != NULL) {
-            keymaster_device_t* dev = *mDevice;
+            keymaster0_device_t* dev = *mDevice;
             if (dev->delete_keypair != NULL) {
                 dev->delete_keypair(dev, get(), length());
             }
@@ -106,7 +106,7 @@
     }
 
 private:
-    keymaster_device_t** mDevice;
+    keymaster0_device_t** mDevice;
 };
 
 class UniqueReadOnlyBlob {
@@ -341,7 +341,7 @@
 
         std::cout << "Using keymaster module: " << mod->name << std::endl;
 
-        ASSERT_EQ(0, keymaster_open(mod, &sDevice))
+        ASSERT_EQ(0, keymaster0_open(mod, &sDevice))
                 << "Should be able to open the keymaster device";
 
         ASSERT_EQ(KEYMASTER_MODULE_API_VERSION_0_2, mod->module_api_version)
@@ -364,14 +364,14 @@
     }
 
     static void TearDownTestCase() {
-        ASSERT_EQ(0, keymaster_close(sDevice));
+        ASSERT_EQ(0, keymaster0_close(sDevice));
     }
 
 protected:
-    static keymaster_device_t* sDevice;
+    static keymaster0_device_t* sDevice;
 };
 
-keymaster_device_t* KeymasterBaseTest::sDevice = NULL;
+keymaster0_device_t* KeymasterBaseTest::sDevice = NULL;
 
 class KeymasterTest : public KeymasterBaseTest {
 };