Merge "hardware: interfaces: sensors: fix -Wreorder-init-list"
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 1535979..fb8d395 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -476,7 +476,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.vibrator</name>
-        <version>1.0-4</version>
+        <version>1.0-3</version>
         <interface>
             <name>IVibrator</name>
             <instance>default</instance>
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index c5acf8c..a7cbb36 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -1540,89 +1540,6 @@
     }
 }
 
-/*
- * SigningOperationsTest.HmacRfc4231TestCase6
- *
- * Validates against the test vectors from RFC 4231 test case 6.
- */
-TEST_F(SigningOperationsTest, HmacRfc4231TestCase6) {
-    string key(131, 0xaa);
-    string message = "Test Using Larger Than Block-Size Key - Hash Key First";
-
-    uint8_t sha_224_expected[] = {
-        0x95, 0xe9, 0xa0, 0xdb, 0x96, 0x20, 0x95, 0xad, 0xae, 0xbe, 0x9b, 0x2d, 0x6f, 0x0d,
-        0xbc, 0xe2, 0xd4, 0x99, 0xf1, 0x12, 0xf2, 0xd2, 0xb7, 0x27, 0x3f, 0xa6, 0x87, 0x0e,
-    };
-    uint8_t sha_256_expected[] = {
-        0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, 0x0d, 0x8a, 0x26,
-        0xaa, 0xcb, 0xf5, 0xb7, 0x7f, 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28,
-        0xc5, 0x14, 0x05, 0x46, 0x04, 0x0f, 0x0e, 0xe3, 0x7f, 0x54,
-    };
-    uint8_t sha_384_expected[] = {
-        0x4e, 0xce, 0x08, 0x44, 0x85, 0x81, 0x3e, 0x90, 0x88, 0xd2, 0xc6, 0x3a,
-        0x04, 0x1b, 0xc5, 0xb4, 0x4f, 0x9e, 0xf1, 0x01, 0x2a, 0x2b, 0x58, 0x8f,
-        0x3c, 0xd1, 0x1f, 0x05, 0x03, 0x3a, 0xc4, 0xc6, 0x0c, 0x2e, 0xf6, 0xab,
-        0x40, 0x30, 0xfe, 0x82, 0x96, 0x24, 0x8d, 0xf1, 0x63, 0xf4, 0x49, 0x52,
-    };
-    uint8_t sha_512_expected[] = {
-        0x80, 0xb2, 0x42, 0x63, 0xc7, 0xc1, 0xa3, 0xeb, 0xb7, 0x14, 0x93, 0xc1, 0xdd,
-        0x7b, 0xe8, 0xb4, 0x9b, 0x46, 0xd1, 0xf4, 0x1b, 0x4a, 0xee, 0xc1, 0x12, 0x1b,
-        0x01, 0x37, 0x83, 0xf8, 0xf3, 0x52, 0x6b, 0x56, 0xd0, 0x37, 0xe0, 0x5f, 0x25,
-        0x98, 0xbd, 0x0f, 0xd2, 0x21, 0x5d, 0x6a, 0x1e, 0x52, 0x95, 0xe6, 0x4f, 0x73,
-        0xf6, 0x3f, 0x0a, 0xec, 0x8b, 0x91, 0x5a, 0x98, 0x5d, 0x78, 0x65, 0x98,
-    };
-
-    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
-    if (SecLevel() != SecurityLevel::STRONGBOX) {
-        CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
-        CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
-        CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
-    }
-}
-
-/*
- * SigningOperationsTest.HmacRfc4231TestCase7
- *
- * Validates against the test vectors from RFC 4231 test case 7.
- */
-TEST_F(SigningOperationsTest, HmacRfc4231TestCase7) {
-    string key(131, 0xaa);
-    string message =
-        "This is a test using a larger than block-size key and a larger than "
-        "block-size data. The key needs to be hashed before being used by the HMAC "
-        "algorithm.";
-
-    uint8_t sha_224_expected[] = {
-        0x3a, 0x85, 0x41, 0x66, 0xac, 0x5d, 0x9f, 0x02, 0x3f, 0x54, 0xd5, 0x17, 0xd0, 0xb3,
-        0x9d, 0xbd, 0x94, 0x67, 0x70, 0xdb, 0x9c, 0x2b, 0x95, 0xc9, 0xf6, 0xf5, 0x65, 0xd1,
-    };
-    uint8_t sha_256_expected[] = {
-        0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, 0x27, 0x63, 0x5f,
-        0xbc, 0xd5, 0xb0, 0xe9, 0x44, 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07,
-        0x13, 0x93, 0x8a, 0x7f, 0x51, 0x53, 0x5c, 0x3a, 0x35, 0xe2,
-    };
-    uint8_t sha_384_expected[] = {
-        0x66, 0x17, 0x17, 0x8e, 0x94, 0x1f, 0x02, 0x0d, 0x35, 0x1e, 0x2f, 0x25,
-        0x4e, 0x8f, 0xd3, 0x2c, 0x60, 0x24, 0x20, 0xfe, 0xb0, 0xb8, 0xfb, 0x9a,
-        0xdc, 0xce, 0xbb, 0x82, 0x46, 0x1e, 0x99, 0xc5, 0xa6, 0x78, 0xcc, 0x31,
-        0xe7, 0x99, 0x17, 0x6d, 0x38, 0x60, 0xe6, 0x11, 0x0c, 0x46, 0x52, 0x3e,
-    };
-    uint8_t sha_512_expected[] = {
-        0xe3, 0x7b, 0x6a, 0x77, 0x5d, 0xc8, 0x7d, 0xba, 0xa4, 0xdf, 0xa9, 0xf9, 0x6e,
-        0x5e, 0x3f, 0xfd, 0xde, 0xbd, 0x71, 0xf8, 0x86, 0x72, 0x89, 0x86, 0x5d, 0xf5,
-        0xa3, 0x2d, 0x20, 0xcd, 0xc9, 0x44, 0xb6, 0x02, 0x2c, 0xac, 0x3c, 0x49, 0x82,
-        0xb1, 0x0d, 0x5e, 0xeb, 0x55, 0xc3, 0xe4, 0xde, 0x15, 0x13, 0x46, 0x76, 0xfb,
-        0x6d, 0xe0, 0x44, 0x60, 0x65, 0xc9, 0x74, 0x40, 0xfa, 0x8c, 0x6a, 0x58,
-    };
-
-    CheckHmacTestVector(key, message, Digest::SHA_2_256, make_string(sha_256_expected));
-    if (SecLevel() != SecurityLevel::STRONGBOX) {
-        CheckHmacTestVector(key, message, Digest::SHA_2_224, make_string(sha_224_expected));
-        CheckHmacTestVector(key, message, Digest::SHA_2_384, make_string(sha_384_expected));
-        CheckHmacTestVector(key, message, Digest::SHA_2_512, make_string(sha_512_expected));
-    }
-}
-
 typedef KeymasterHidlTest VerificationOperationsTest;
 
 /*
diff --git a/vibrator/1.x/example/Android.bp b/vibrator/1.3/example/Android.bp
similarity index 81%
rename from vibrator/1.x/example/Android.bp
rename to vibrator/1.3/example/Android.bp
index afbbb75..07f1c26 100644
--- a/vibrator/1.x/example/Android.bp
+++ b/vibrator/1.3/example/Android.bp
@@ -14,11 +14,11 @@
 // limitations under the License.
 
 cc_binary {
-    name: "android.hardware.vibrator@1.x-service.example",
+    name: "android.hardware.vibrator@1.3-service.example",
     vendor: true,
     relative_install_path: "hw",
-    init_rc: ["android.hardware.vibrator@1.x-service.example.rc"],
-    vintf_fragments: ["android.hardware.vibrator@1.x-service.example.xml"],
+    init_rc: ["android.hardware.vibrator@1.3-service.example.rc"],
+    vintf_fragments: ["android.hardware.vibrator@1.3-service.example.xml"],
     srcs: ["service.cpp", "Vibrator.cpp"],
     cflags: ["-Wall", "-Werror"],
     shared_libs: [
@@ -29,6 +29,5 @@
         "android.hardware.vibrator@1.1",
         "android.hardware.vibrator@1.2",
         "android.hardware.vibrator@1.3",
-        "android.hardware.vibrator@1.4",
     ],
 }
diff --git a/vibrator/1.x/example/OWNERS b/vibrator/1.3/example/OWNERS
similarity index 100%
rename from vibrator/1.x/example/OWNERS
rename to vibrator/1.3/example/OWNERS
diff --git a/vibrator/1.x/example/Vibrator.cpp b/vibrator/1.3/example/Vibrator.cpp
similarity index 86%
rename from vibrator/1.x/example/Vibrator.cpp
rename to vibrator/1.3/example/Vibrator.cpp
index 4dd1cb9..b529437 100644
--- a/vibrator/1.x/example/Vibrator.cpp
+++ b/vibrator/1.3/example/Vibrator.cpp
@@ -23,7 +23,7 @@
 namespace android {
 namespace hardware {
 namespace vibrator {
-namespace V1_4 {
+namespace V1_3 {
 namespace implementation {
 
 static constexpr uint32_t MS_PER_S = 1000;
@@ -100,25 +100,7 @@
     }
 }
 
-Return<void> Vibrator::perform_1_3(V1_3::Effect effect, EffectStrength strength,
-                                   perform_cb _hidl_cb) {
-    return perform<decltype(effect)>(effect, strength, _hidl_cb);
-}
-
-// Methods from ::android::hardware::vibrator::V1_4::IVibrator follow.
-
-Return<hidl_bitfield<Capabilities>> Vibrator::getCapabilities() {
-    return Capabilities::ON_COMPLETION_CALLBACK | Capabilities::PERFORM_COMPLETION_CALLBACK;
-}
-
-Return<Status> Vibrator::on_1_4(uint32_t timeoutMs, const sp<IVibratorCallback>& callback) {
-    mCallback = callback;
-    return on(timeoutMs);
-}
-
-Return<void> Vibrator::perform_1_4(V1_3::Effect effect, EffectStrength strength,
-                                   const sp<IVibratorCallback>& callback, perform_cb _hidl_cb) {
-    mCallback = callback;
+Return<void> Vibrator::perform_1_3(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
     return perform<decltype(effect)>(effect, strength, _hidl_cb);
 }
 
@@ -166,14 +148,6 @@
         return Status::UNSUPPORTED_OPERATION;
     } else {
         ALOGI("Enabled: %s -> %s\n", mEnabled ? "true" : "false", enabled ? "true" : "false");
-        if (mEnabled && !enabled) {
-            if (auto callback = mCallback) {
-                mCallback = nullptr;
-                if (auto ret = callback->onComplete(); !ret.isOk()) {
-                    ALOGE("Failed completion callback: %s", ret.description().c_str());
-                }
-            }
-        }
         mEnabled = enabled;
         return Status::OK;
     }
@@ -297,7 +271,7 @@
 }
 
 }  // namespace implementation
-}  // namespace V1_4
+}  // namespace V1_3
 }  // namespace vibrator
 }  // namespace hardware
 }  // namespace android
diff --git a/vibrator/1.x/example/Vibrator.h b/vibrator/1.3/example/Vibrator.h
similarity index 75%
rename from vibrator/1.x/example/Vibrator.h
rename to vibrator/1.3/example/Vibrator.h
index ff63431..5180774 100644
--- a/vibrator/1.x/example/Vibrator.h
+++ b/vibrator/1.3/example/Vibrator.h
@@ -13,21 +13,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef ANDROID_HARDWARE_VIBRATOR_V1_x_VIBRATOR_H
-#define ANDROID_HARDWARE_VIBRATOR_V1_x_VIBRATOR_H
+#ifndef ANDROID_HARDWARE_VIBRATOR_V1_3_VIBRATOR_H
+#define ANDROID_HARDWARE_VIBRATOR_V1_3_VIBRATOR_H
 
-#include <android/hardware/vibrator/1.4/IVibrator.h>
+#include <android/hardware/vibrator/1.3/IVibrator.h>
 #include <hidl/Status.h>
 
 namespace android {
 namespace hardware {
 namespace vibrator {
-namespace V1_4 {
+namespace V1_3 {
 namespace implementation {
 
 using android::hardware::vibrator::V1_0::EffectStrength;
 using android::hardware::vibrator::V1_0::Status;
-using android::hardware::vibrator::V1_3::Effect;
 
 class Vibrator : public IVibrator {
   public:
@@ -52,14 +51,7 @@
     // Methods from ::android::hardware::vibrator::V1_3::IVibrator follow.
     Return<bool> supportsExternalControl() override;
     Return<Status> setExternalControl(bool enabled) override;
-    Return<void> perform_1_3(V1_3::Effect effect, EffectStrength strength,
-                             perform_cb _hidl_cb) override;
-
-    // Methods from ::android::hardware::vibrator::V1_4::IVibrator follow.
-    Return<hidl_bitfield<Capabilities>> getCapabilities() override;
-    Return<Status> on_1_4(uint32_t timeoutMs, const sp<IVibratorCallback>& callback) override;
-    Return<void> perform_1_4(V1_3::Effect effect, EffectStrength strength,
-                             const sp<IVibratorCallback>& callback, perform_cb _hidl_cb) override;
+    Return<void> perform_1_3(Effect effect, EffectStrength strength, perform_cb _hidl_cb) override;
 
   private:
     Return<void> perform(Effect effect, EffectStrength strength, perform_cb _hidl_cb);
@@ -80,12 +72,11 @@
     bool mExternalControl{false};
     std::mutex mMutex;
     timer_t mTimer{nullptr};
-    sp<IVibratorCallback> mCallback{nullptr};
 };
 }  // namespace implementation
-}  // namespace V1_4
+}  // namespace V1_3
 }  // namespace vibrator
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_VIBRATOR_V1_x_VIBRATOR_H
+#endif  // ANDROID_HARDWARE_VIBRATOR_V1_3_VIBRATOR_H
diff --git a/vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.rc b/vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.rc
new file mode 100644
index 0000000..ed7a562
--- /dev/null
+++ b/vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.rc
@@ -0,0 +1,4 @@
+service vendor.vibrator-1-3 /vendor/bin/hw/android.hardware.vibrator@1.3-service.example
+    class hal
+    user system
+    group system
diff --git a/vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.xml b/vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.xml
similarity index 89%
rename from vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.xml
rename to vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.xml
index ebc8c4b..172aa21 100644
--- a/vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.xml
+++ b/vibrator/1.3/example/android.hardware.vibrator@1.3-service.example.xml
@@ -2,7 +2,7 @@
     <hal format="hidl">
         <name>android.hardware.vibrator</name>
         <transport>hwbinder</transport>
-        <version>1.4</version>
+        <version>1.3</version>
         <interface>
             <name>IVibrator</name>
             <instance>default</instance>
diff --git a/vibrator/1.x/example/service.cpp b/vibrator/1.3/example/service.cpp
similarity index 82%
rename from vibrator/1.x/example/service.cpp
rename to vibrator/1.3/example/service.cpp
index 13c6691..449996e 100644
--- a/vibrator/1.x/example/service.cpp
+++ b/vibrator/1.3/example/service.cpp
@@ -13,17 +13,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#define LOG_TAG "android.hardware.vibrator@1.x-service.example"
+#define LOG_TAG "android.hardware.vibrator@1.3-service.example"
 
-#include <android/hardware/vibrator/1.4/IVibrator.h>
+#include <android/hardware/vibrator/1.3/IVibrator.h>
 #include <hidl/HidlTransportSupport.h>
 
 #include "Vibrator.h"
 
 using android::hardware::configureRpcThreadpool;
 using android::hardware::joinRpcThreadpool;
-using android::hardware::vibrator::V1_4::IVibrator;
-using android::hardware::vibrator::V1_4::implementation::Vibrator;
+using android::hardware::vibrator::V1_3::IVibrator;
+using android::hardware::vibrator::V1_3::implementation::Vibrator;
 using namespace android;
 
 status_t registerVibratorService() {
diff --git a/vibrator/1.4/Android.bp b/vibrator/1.4/Android.bp
index cf31fcd..acfc795 100644
--- a/vibrator/1.4/Android.bp
+++ b/vibrator/1.4/Android.bp
@@ -3,9 +3,6 @@
 hidl_interface {
     name: "android.hardware.vibrator@1.4",
     root: "android.hardware",
-    vndk: {
-        enabled: true,
-    },
     srcs: [
         "types.hal",
         "IVibrator.hal",
diff --git a/vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.rc b/vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.rc
deleted file mode 100644
index 4893db6..0000000
--- a/vibrator/1.x/example/android.hardware.vibrator@1.x-service.example.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.vibrator-1-x /vendor/bin/hw/android.hardware.vibrator@1.x-service.example
-    class hal
-    user system
-    group system