Reorganize drm hal modules

Previously the drm and crypto plugins were separate hals.
This implied a separation of implementation libraries which
causes problems for some drm schemes. The reorganization
combines the hals into a single interface under drm.

Tests: basic gtests passing

Change-Id: I5cde6ff9f60625a0219731c4dbfcaefbd9f27f88
related-to-bug: 32815560
diff --git a/drm/1.0/Android.bp b/drm/1.0/Android.bp
new file mode 100644
index 0000000..d899114
--- /dev/null
+++ b/drm/1.0/Android.bp
@@ -0,0 +1,88 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+genrule {
+    name: "android.hardware.drm@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm@1.0",
+    srcs: [
+        "types.hal",
+        "ICryptoFactory.hal",
+        "ICryptoPlugin.hal",
+        "IDrmFactory.hal",
+        "IDrmPlugin.hal",
+        "IDrmPluginListener.hal",
+    ],
+    out: [
+        "android/hardware/drm/1.0/types.cpp",
+        "android/hardware/drm/1.0/CryptoFactoryAll.cpp",
+        "android/hardware/drm/1.0/CryptoPluginAll.cpp",
+        "android/hardware/drm/1.0/DrmFactoryAll.cpp",
+        "android/hardware/drm/1.0/DrmPluginAll.cpp",
+        "android/hardware/drm/1.0/DrmPluginListenerAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.drm@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm@1.0",
+    srcs: [
+        "types.hal",
+        "ICryptoFactory.hal",
+        "ICryptoPlugin.hal",
+        "IDrmFactory.hal",
+        "IDrmPlugin.hal",
+        "IDrmPluginListener.hal",
+    ],
+    out: [
+        "android/hardware/drm/1.0/types.h",
+        "android/hardware/drm/1.0/ICryptoFactory.h",
+        "android/hardware/drm/1.0/IHwCryptoFactory.h",
+        "android/hardware/drm/1.0/BnHwCryptoFactory.h",
+        "android/hardware/drm/1.0/BpHwCryptoFactory.h",
+        "android/hardware/drm/1.0/BsCryptoFactory.h",
+        "android/hardware/drm/1.0/ICryptoPlugin.h",
+        "android/hardware/drm/1.0/IHwCryptoPlugin.h",
+        "android/hardware/drm/1.0/BnHwCryptoPlugin.h",
+        "android/hardware/drm/1.0/BpHwCryptoPlugin.h",
+        "android/hardware/drm/1.0/BsCryptoPlugin.h",
+        "android/hardware/drm/1.0/IDrmFactory.h",
+        "android/hardware/drm/1.0/IHwDrmFactory.h",
+        "android/hardware/drm/1.0/BnHwDrmFactory.h",
+        "android/hardware/drm/1.0/BpHwDrmFactory.h",
+        "android/hardware/drm/1.0/BsDrmFactory.h",
+        "android/hardware/drm/1.0/IDrmPlugin.h",
+        "android/hardware/drm/1.0/IHwDrmPlugin.h",
+        "android/hardware/drm/1.0/BnHwDrmPlugin.h",
+        "android/hardware/drm/1.0/BpHwDrmPlugin.h",
+        "android/hardware/drm/1.0/BsDrmPlugin.h",
+        "android/hardware/drm/1.0/IDrmPluginListener.h",
+        "android/hardware/drm/1.0/IHwDrmPluginListener.h",
+        "android/hardware/drm/1.0/BnHwDrmPluginListener.h",
+        "android/hardware/drm/1.0/BpHwDrmPluginListener.h",
+        "android/hardware/drm/1.0/BsDrmPluginListener.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.drm@1.0",
+    generated_sources: ["android.hardware.drm@1.0_genc++"],
+    generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.drm@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/drm/crypto/1.0/ICryptoFactory.hal b/drm/1.0/ICryptoFactory.hal
similarity index 97%
rename from drm/crypto/1.0/ICryptoFactory.hal
rename to drm/1.0/ICryptoFactory.hal
index 4b60ccc..aeab9bc 100644
--- a/drm/crypto/1.0/ICryptoFactory.hal
+++ b/drm/1.0/ICryptoFactory.hal
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.hardware.drm.crypto@1.0;
+package android.hardware.drm@1.0;
 
 import ICryptoPlugin;
 
diff --git a/drm/crypto/1.0/ICryptoPlugin.hal b/drm/1.0/ICryptoPlugin.hal
similarity index 97%
rename from drm/crypto/1.0/ICryptoPlugin.hal
rename to drm/1.0/ICryptoPlugin.hal
index 26f0ffd..d66151e 100644
--- a/drm/crypto/1.0/ICryptoPlugin.hal
+++ b/drm/1.0/ICryptoPlugin.hal
@@ -13,9 +13,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.hardware.drm.crypto@1.0;
+package android.hardware.drm@1.0;
 
-import android.hardware.drm.crypto@1.0::types;
+import android.hardware.drm@1.0::types;
 
 /**
  * Ref: frameworks/native/include/media/hardware/CryptoAPI.h:CryptoPlugin
diff --git a/drm/drm/1.0/IDrmFactory.hal b/drm/1.0/IDrmFactory.hal
similarity index 98%
rename from drm/drm/1.0/IDrmFactory.hal
rename to drm/1.0/IDrmFactory.hal
index 1ef1d27..de53929 100644
--- a/drm/drm/1.0/IDrmFactory.hal
+++ b/drm/1.0/IDrmFactory.hal
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.hardware.drm.drm@1.0;
+package android.hardware.drm@1.0;
 
 import IDrmPlugin;
 
diff --git a/drm/drm/1.0/IDrmPlugin.hal b/drm/1.0/IDrmPlugin.hal
similarity index 99%
rename from drm/drm/1.0/IDrmPlugin.hal
rename to drm/1.0/IDrmPlugin.hal
index 881bf80..5bae22d 100644
--- a/drm/drm/1.0/IDrmPlugin.hal
+++ b/drm/1.0/IDrmPlugin.hal
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.hardware.drm.drm@1.0;
+package android.hardware.drm@1.0;
 
 import IDrmPluginListener;
 
diff --git a/drm/drm/1.0/IDrmPluginListener.hal b/drm/1.0/IDrmPluginListener.hal
similarity index 96%
rename from drm/drm/1.0/IDrmPluginListener.hal
rename to drm/1.0/IDrmPluginListener.hal
index 92010a1..15ce008 100644
--- a/drm/drm/1.0/IDrmPluginListener.hal
+++ b/drm/1.0/IDrmPluginListener.hal
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package android.hardware.drm.drm@1.0;
+package android.hardware.drm@1.0;
 
-import android.hardware.drm.drm@1.0::types;
+import android.hardware.drm@1.0::types;
 
 /**
  * Ref: frameworks/native/include/media/drm/DrmAPI.h:DrmPluginListener
diff --git a/drm/1.0/default/Android.mk b/drm/1.0/default/Android.mk
index 87a0019..ac5b90a 100644
--- a/drm/1.0/default/Android.mk
+++ b/drm/1.0/default/Android.mk
@@ -14,6 +14,8 @@
 # limitations under the License.
 
 
+############# Build legacy drm service ############
+
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
@@ -24,16 +26,14 @@
   service.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
+  android.hardware.drm@1.0 \
+  android.hidl.memory@1.0 \
   libhidlbase \
   libhidltransport \
-  liblog \
-  libhwbinder \
-  libutils \
   libhardware \
-  android.hardware.drm.drm@1.0 \
-  android.hardware.drm.crypto@1.0 \
-  android.hidl.memory@1.0 \
-
+  libhwbinder \
+  liblog \
+  libutils \
 
 LOCAL_C_INCLUDES := \
   hardware/interfaces/drm
@@ -43,3 +43,37 @@
 LOCAL_32_BIT_ONLY := true
 
 include $(BUILD_EXECUTABLE)
+
+############# Build legacy drm impl library ############
+
+include $(CLEAR_VARS)
+LOCAL_MODULE := android.hardware.drm@1.0-impl
+LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_SRC_FILES := \
+    DrmFactory.cpp \
+    DrmPlugin.cpp \
+    CryptoFactory.cpp \
+    CryptoPlugin.cpp \
+    TypeConvert.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    android.hardware.drm@1.0 \
+    android.hidl.memory@1.0 \
+    libhidlbase \
+    libhidlmemory \
+    libhidltransport \
+    libhwbinder \
+    liblog \
+    libmediadrm \
+    libstagefright_foundation \
+    libutils \
+
+LOCAL_C_INCLUDES := \
+    frameworks/native/include \
+    frameworks/av/include
+
+# TODO: The legacy DRM plugins only support 32-bit. They need
+# to be migrated to 64-bit (b/18948909)
+LOCAL_32_BIT_ONLY := true
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/crypto/1.0/default/CryptoFactory.cpp b/drm/1.0/default/CryptoFactory.cpp
similarity index 94%
rename from drm/crypto/1.0/default/CryptoFactory.cpp
rename to drm/1.0/default/CryptoFactory.cpp
index 9519d01..02084e7 100644
--- a/drm/crypto/1.0/default/CryptoFactory.cpp
+++ b/drm/1.0/default/CryptoFactory.cpp
@@ -22,7 +22,6 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace crypto {
 namespace V1_0 {
 namespace implementation {
 
@@ -30,7 +29,7 @@
         loader("/vendor/lib/mediadrm", "createCryptoFactory") {
     }
 
-    // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
+    // Methods from ::android::hardware::drm::V1_0::ICryptoFactory follow.
     Return<bool> CryptoFactory::isCryptoSchemeSupported(
             const hidl_array<uint8_t, 16>& uuid) {
         for (size_t i = 0; i < loader.factoryCount(); i++) {
@@ -68,7 +67,6 @@
 
 }  // namespace implementation
 }  // namespace V1_0
-}  // namespace crypto
 }  // namespace drm
 }  // namespace hardware
 }  // namespace android
diff --git a/drm/crypto/1.0/default/CryptoFactory.h b/drm/1.0/default/CryptoFactory.h
similarity index 78%
rename from drm/crypto/1.0/default/CryptoFactory.h
rename to drm/1.0/default/CryptoFactory.h
index 0855996..412b557 100644
--- a/drm/crypto/1.0/default/CryptoFactory.h
+++ b/drm/1.0/default/CryptoFactory.h
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
-#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
+#ifndef ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
+#define ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
 
-#include <android/hardware/drm/crypto/1.0/ICryptoFactory.h>
+#include <android/hardware/drm/1.0/ICryptoFactory.h>
 #include <hidl/Status.h>
 #include <media/hardware/CryptoAPI.h>
 #include <media/PluginLoader.h>
@@ -25,12 +25,11 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace crypto {
 namespace V1_0 {
 namespace implementation {
 
-using ::android::hardware::drm::crypto::V1_0::ICryptoFactory;
-using ::android::hardware::drm::crypto::V1_0::ICryptoPlugin;
+using ::android::hardware::drm::V1_0::ICryptoFactory;
+using ::android::hardware::drm::V1_0::ICryptoPlugin;
 using ::android::hardware::hidl_array;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -42,7 +41,7 @@
     CryptoFactory();
     virtual ~CryptoFactory() {}
 
-    // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoFactory follow.
+    // Methods from ::android::hardware::drm::V1_0::ICryptoFactory follow.
 
     Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
             override;
@@ -62,9 +61,8 @@
 
 }  // namespace implementation
 }  // namespace V1_0
-}  // namespace crypto
 }  // namespace drm
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOFACTORY_H
+#endif  // ANDROID_HARDWARE_DRM_V1_0__CRYPTOFACTORY_H
diff --git a/drm/crypto/1.0/default/CryptoPlugin.cpp b/drm/1.0/default/CryptoPlugin.cpp
similarity index 96%
rename from drm/crypto/1.0/default/CryptoPlugin.cpp
rename to drm/1.0/default/CryptoPlugin.cpp
index 2e41cb3..073f030 100644
--- a/drm/crypto/1.0/default/CryptoPlugin.cpp
+++ b/drm/1.0/default/CryptoPlugin.cpp
@@ -28,11 +28,10 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace crypto {
 namespace V1_0 {
 namespace implementation {
 
-    // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoPlugin follow
+    // Methods from ::android::hardware::drm::V1_0::ICryptoPlugin follow
     Return<bool> CryptoPlugin::requiresSecureDecoderComponent(
             const hidl_string& mime) {
         return mLegacyPlugin->requiresSecureDecoderComponent(mime);
@@ -58,7 +57,7 @@
             const hidl_array<uint8_t, 16>& keyId,
             const hidl_array<uint8_t, 16>& iv, Mode mode,
             const Pattern& pattern, const hidl_vec<SubSample>& subSamples,
-            const SharedBuffer& source, uint32_t offset,
+            const SharedBuffer& source, uint64_t offset,
             const DestinationBuffer& destination,
             decrypt_cb _hidl_cb) {
 
@@ -138,7 +137,6 @@
 
 } // namespace implementation
 }  // namespace V1_0
-}  // namespace crypto
 }  // namespace drm
 }  // namespace hardware
 }  // namespace android
diff --git a/drm/crypto/1.0/default/CryptoPlugin.h b/drm/1.0/default/CryptoPlugin.h
similarity index 76%
rename from drm/crypto/1.0/default/CryptoPlugin.h
rename to drm/1.0/default/CryptoPlugin.h
index c367d0b..f805f09 100644
--- a/drm/crypto/1.0/default/CryptoPlugin.h
+++ b/drm/1.0/default/CryptoPlugin.h
@@ -14,26 +14,25 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
-#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
+#ifndef ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
+#define ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
 
-#include <media/hardware/CryptoAPI.h>
 #include <android/hidl/memory/1.0/IMemory.h>
-#include <android/hardware/drm/crypto/1.0/ICryptoPlugin.h>
+#include <android/hardware/drm/1.0/ICryptoPlugin.h>
 #include <hidl/Status.h>
+#include <media/hardware/CryptoAPI.h>
 
 namespace android {
 namespace hardware {
 namespace drm {
-namespace crypto {
 namespace V1_0 {
 namespace implementation {
 
-using ::android::hardware::drm::crypto::V1_0::DestinationBuffer;
-using ::android::hardware::drm::crypto::V1_0::ICryptoPlugin;
-using ::android::hardware::drm::crypto::V1_0::Mode;
-using ::android::hardware::drm::crypto::V1_0::Pattern;
-using ::android::hardware::drm::crypto::V1_0::SubSample;
+using ::android::hardware::drm::V1_0::DestinationBuffer;
+using ::android::hardware::drm::V1_0::ICryptoPlugin;
+using ::android::hardware::drm::V1_0::Mode;
+using ::android::hardware::drm::V1_0::Pattern;
+using ::android::hardware::drm::V1_0::SubSample;
 using ::android::hardware::hidl_array;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -47,7 +46,7 @@
 
     ~CryptoPlugin() {delete mLegacyPlugin;}
 
-    // Methods from ::android::hardware::drm::crypto::V1_0::ICryptoPlugin
+    // Methods from ::android::hardware::drm::V1_0::ICryptoPlugin
     // follow.
 
     Return<bool> requiresSecureDecoderComponent(const hidl_string& mime)
@@ -64,7 +63,7 @@
     Return<void> decrypt(bool secure, const hidl_array<uint8_t, 16>& keyId,
             const hidl_array<uint8_t, 16>& iv, Mode mode, const Pattern& pattern,
             const hidl_vec<SubSample>& subSamples, const SharedBuffer& source,
-            uint32_t offset, const DestinationBuffer& destination,
+            uint64_t offset, const DestinationBuffer& destination,
             decrypt_cb _hidl_cb) override;
 
 private:
@@ -78,9 +77,8 @@
 
 }  // namespace implementation
 }  // namespace V1_0
-}  // namespace crypto
 }  // namespace drm
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_DRM_CRYPTO_V1_0__CRYPTOPLUGIN_H
+#endif  // ANDROID_HARDWARE_DRM_V1_0__CRYPTOPLUGIN_H
diff --git a/drm/drm/1.0/default/DrmFactory.cpp b/drm/1.0/default/DrmFactory.cpp
similarity index 95%
rename from drm/drm/1.0/default/DrmFactory.cpp
rename to drm/1.0/default/DrmFactory.cpp
index 98a8416..cba2c99 100644
--- a/drm/drm/1.0/default/DrmFactory.cpp
+++ b/drm/1.0/default/DrmFactory.cpp
@@ -22,7 +22,6 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace drm {
 namespace V1_0 {
 namespace implementation {
 
@@ -30,7 +29,7 @@
         loader("/vendor/lib/mediadrm", "createDrmFactory") {
     }
 
-    // Methods from ::android::hardware::drm::drm::V1_0::IDrmFactory follow.
+    // Methods from ::android::hardware::drm::V1_0::IDrmFactory follow.
     Return<bool> DrmFactory::isCryptoSchemeSupported (
             const hidl_array<uint8_t, 16>& uuid) {
         for (size_t i = 0; i < loader.factoryCount(); i++) {
@@ -80,6 +79,5 @@
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace drm
-}  // namespace drm
 }  // namespace hardware
 }  // namespace android
diff --git a/drm/drm/1.0/default/DrmFactory.h b/drm/1.0/default/DrmFactory.h
similarity index 80%
rename from drm/drm/1.0/default/DrmFactory.h
rename to drm/1.0/default/DrmFactory.h
index 2b88d00..78b7f6e 100644
--- a/drm/drm/1.0/default/DrmFactory.h
+++ b/drm/1.0/default/DrmFactory.h
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#ifndef ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
-#define ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
+#ifndef ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
+#define ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
 
-#include <android/hardware/drm/drm/1.0/IDrmFactory.h>
+#include <android/hardware/drm/1.0/IDrmFactory.h>
 #include <hidl/Status.h>
 #include <media/drm/DrmAPI.h>
 #include <media/PluginLoader.h>
@@ -25,12 +25,11 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace drm {
 namespace V1_0 {
 namespace implementation {
 
-using ::android::hardware::drm::drm::V1_0::IDrmFactory;
-using ::android::hardware::drm::drm::V1_0::IDrmPlugin;
+using ::android::hardware::drm::V1_0::IDrmFactory;
+using ::android::hardware::drm::V1_0::IDrmPlugin;
 using ::android::hardware::hidl_array;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -42,7 +41,7 @@
     DrmFactory();
     virtual ~DrmFactory() {}
 
-    // Methods from ::android::hardware::drm::drm::V1_0::IDrmFactory follow.
+    // Methods from ::android::hardware::drm::V1_0::IDrmFactory follow.
 
     Return<bool> isCryptoSchemeSupported(const hidl_array<uint8_t, 16>& uuid)
             override;
@@ -65,8 +64,7 @@
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace drm
-}  // namespace drm
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_DRM_DRM_V1_0__DRMFACTORY_H
+#endif  // ANDROID_HARDWARE_DRM_V1_0__DRMFACTORY_H
diff --git a/drm/drm/1.0/default/DrmPlugin.cpp b/drm/1.0/default/DrmPlugin.cpp
similarity index 99%
rename from drm/drm/1.0/default/DrmPlugin.cpp
rename to drm/1.0/default/DrmPlugin.cpp
index 0239502..9204fc5 100644
--- a/drm/drm/1.0/default/DrmPlugin.cpp
+++ b/drm/1.0/default/DrmPlugin.cpp
@@ -23,11 +23,10 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace drm {
 namespace V1_0 {
 namespace implementation {
 
-    // Methods from ::android::hardware::drm::drm::V1_0::IDrmPlugin follow.
+    // Methods from ::android::hardware::drm::V1_0::IDrmPlugin follow.
 
     Return<void> DrmPlugin::openSession(openSession_cb _hidl_cb) {
         Vector<uint8_t> legacySessionId;
@@ -422,6 +421,5 @@
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace drm
-}  // namespace drm
 }  // namespace hardware
 }  // namespace android
diff --git a/drm/drm/1.0/default/DrmPlugin.h b/drm/1.0/default/DrmPlugin.h
similarity index 87%
rename from drm/drm/1.0/default/DrmPlugin.h
rename to drm/1.0/default/DrmPlugin.h
index 2bf3b5e..dce6c0c 100644
--- a/drm/drm/1.0/default/DrmPlugin.h
+++ b/drm/1.0/default/DrmPlugin.h
@@ -14,30 +14,28 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
-#define ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
+#ifndef ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
+#define ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
 
-#include <media/drm/DrmAPI.h>
-#include <android/hardware/drm/drm/1.0/IDrmPlugin.h>
-#include <android/hardware/drm/drm/1.0/IDrmPluginListener.h>
-#include <hidl/MQDescriptor.h>
+#include <android/hardware/drm/1.0/IDrmPlugin.h>
+#include <android/hardware/drm/1.0/IDrmPluginListener.h>
 #include <hidl/Status.h>
+#include <media/drm/DrmAPI.h>
 
 namespace android {
 namespace hardware {
 namespace drm {
-namespace drm {
 namespace V1_0 {
 namespace implementation {
 
-using ::android::hardware::drm::drm::V1_0::EventType;
-using ::android::hardware::drm::drm::V1_0::IDrmPlugin;
-using ::android::hardware::drm::drm::V1_0::IDrmPluginListener;
-using ::android::hardware::drm::drm::V1_0::KeyRequestType;
-using ::android::hardware::drm::drm::V1_0::KeyStatus;
-using ::android::hardware::drm::drm::V1_0::KeyType;
-using ::android::hardware::drm::drm::V1_0::KeyValue;
-using ::android::hardware::drm::drm::V1_0::SecureStop;
+using ::android::hardware::drm::V1_0::EventType;
+using ::android::hardware::drm::V1_0::IDrmPlugin;
+using ::android::hardware::drm::V1_0::IDrmPluginListener;
+using ::android::hardware::drm::V1_0::KeyRequestType;
+using ::android::hardware::drm::V1_0::KeyStatus;
+using ::android::hardware::drm::V1_0::KeyType;
+using ::android::hardware::drm::V1_0::KeyValue;
+using ::android::hardware::drm::V1_0::SecureStop;
 using ::android::hardware::hidl_array;
 using ::android::hardware::hidl_string;
 using ::android::hardware::hidl_vec;
@@ -50,7 +48,7 @@
     DrmPlugin(android::DrmPlugin *plugin) : mLegacyPlugin(plugin) {}
     ~DrmPlugin() {delete mLegacyPlugin;}
 
-    // Methods from ::android::hardware::drm::drm::V1_0::IDrmPlugin follow.
+    // Methods from ::android::hardware::drm::V1_0::IDrmPlugin follow.
 
     Return<void> openSession(openSession_cb _hidl_cb) override;
 
@@ -165,8 +163,7 @@
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace drm
-}  // namespace drm
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_DRM_DRM_V1_0__DRMPLUGIN_H
+#endif  // ANDROID_HARDWARE_DRM_V1_0__DRMPLUGIN_H
diff --git a/drm/drm/1.0/default/TypeConvert.cpp b/drm/1.0/default/TypeConvert.cpp
similarity index 93%
rename from drm/drm/1.0/default/TypeConvert.cpp
rename to drm/1.0/default/TypeConvert.cpp
index 4bed284..52cc503 100644
--- a/drm/drm/1.0/default/TypeConvert.cpp
+++ b/drm/1.0/default/TypeConvert.cpp
@@ -19,7 +19,6 @@
 namespace android {
 namespace hardware {
 namespace drm {
-namespace drm {
 namespace V1_0 {
 namespace implementation {
 
@@ -53,6 +52,9 @@
     case android::ERROR_DRM_RESOURCE_BUSY:
         status = Status::ERROR_DRM_RESOURCE_BUSY;
         break;
+    case android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
+        status = Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
+        break;
     case android::ERROR_DRM_DEVICE_REVOKED:
         status = Status::ERROR_DRM_DEVICE_REVOKED;
         break;
@@ -68,6 +70,5 @@
 }  // namespace implementation
 }  // namespace V1_0
 }  // namespace drm
-}  // namespace drm
 }  // namespace hardware
 }  // namespace android
diff --git a/drm/crypto/1.0/default/TypeConvert.h b/drm/1.0/default/TypeConvert.h
similarity index 86%
rename from drm/crypto/1.0/default/TypeConvert.h
rename to drm/1.0/default/TypeConvert.h
index 1655bab..107fda5 100644
--- a/drm/crypto/1.0/default/TypeConvert.h
+++ b/drm/1.0/default/TypeConvert.h
@@ -14,20 +14,16 @@
  * limitations under the License.
  */
 
-#ifndef ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
-#define ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
+#ifndef ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
+#define ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
 
-#include <utils/Vector.h>
+#include <android/hardware/drm/1.0/types.h>
 #include <media/stagefright/MediaErrors.h>
-#include <media/hardware/CryptoAPI.h>
-
-#include <hidl/MQDescriptor.h>
-#include <android/hardware/drm/crypto/1.0/types.h>
+#include <utils/Vector.h>
 
 namespace android {
 namespace hardware {
 namespace drm {
-namespace crypto {
 namespace V1_0 {
 namespace implementation {
 
@@ -75,9 +71,8 @@
 
 }  // namespace implementation
 }  // namespace V1_0
-}  // namespace crypto
 }  // namespace drm
 }  // namespace hardware
 }  // namespace android
 
-#endif // ANDROID_HARDWARE_DRM_CRYPTO_V1_0_TYPECONVERT
+#endif // ANDROID_HARDWARE_DRM_V1_0_TYPECONVERT
diff --git a/drm/1.0/default/service.cpp b/drm/1.0/default/service.cpp
index 3531e03..fba56ec 100644
--- a/drm/1.0/default/service.cpp
+++ b/drm/1.0/default/service.cpp
@@ -16,8 +16,8 @@
 
 #define LOG_TAG "android.hardware.drm@1.0-service"
 
-#include <crypto/1.0/default/CryptoFactory.h>
-#include <drm/1.0/default/DrmFactory.h>
+#include <1.0/default/CryptoFactory.h>
+#include <1.0/default/DrmFactory.h>
 
 #include <hidl/HidlTransportSupport.h>
 #include <hidl/LegacySupport.h>
@@ -26,8 +26,8 @@
 using android::hardware::joinRpcThreadpool;
 using android::hardware::registerPassthroughServiceImplementation;
 
-using android::hardware::drm::crypto::V1_0::ICryptoFactory;
-using android::hardware::drm::drm::V1_0::IDrmFactory;
+using android::hardware::drm::V1_0::ICryptoFactory;
+using android::hardware::drm::V1_0::IDrmFactory;
 
 int main() {
     ALOGD("android.hardware.drm@1.0-service starting...");
diff --git a/drm/drm/1.0/types.hal b/drm/1.0/types.hal
similarity index 67%
rename from drm/drm/1.0/types.hal
rename to drm/1.0/types.hal
index e099418..33bbf9a 100644
--- a/drm/drm/1.0/types.hal
+++ b/drm/1.0/types.hal
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.drm.drm@1.0;
+package android.hardware.drm@1.0;
 
 enum Status : uint32_t {
     /**
@@ -54,7 +54,7 @@
     ERROR_DRM_INVALID_STATE,
 
     /**
-     * The Drm plugin must return BAD_VALUE whenever an illegal parameter is
+     * The DRM plugin must return BAD_VALUE whenever an illegal parameter is
      * passed to one of the interface functions.
      */
     BAD_VALUE,
@@ -74,7 +74,15 @@
     ERROR_DRM_RESOURCE_BUSY,
 
     /**
-     * The Drm Plugin must return ERROR_DRM_DEVICE_REVOKED from
+     * The DRM Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION
+     * when the output protection level enabled on the device is not
+     * sufficient to meet the requirements in the license policy.  HDCP is an
+     * example of a form of output protection.
+     */
+    ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION,
+
+    /**
+     * The DRM Plugin must return ERROR_DRM_DEVICE_REVOKED from
      * provideProvisionResponse and provideKeyResponse if the response indicates
      * that the device has been revoked. Device revocation means that the device
      * is no longer permitted to play content.
@@ -237,3 +245,92 @@
 };
 
 typedef vec<uint8_t> SecureStopId;
+
+
+/**
+ * Enumerate the supported crypto modes
+ */
+enum Mode : uint32_t {
+    UNENCRYPTED = 0, // Samples are unencrypted
+    AES_CTR     = 1, // Samples are encrypted with AES CTR mode
+    AES_CBC_CTS = 2, // Samples are encrypted with AES CBC CTS mode
+    AES_CBC     = 3, // Samples are encrypted with AES CBC mode
+};
+
+/**
+ * A subsample consists of some number of bytes of clear (unencrypted)
+ * data followed by a number of bytes of encrypted data.
+ */
+struct SubSample {
+    uint32_t numBytesOfClearData;
+    uint32_t numBytesOfEncryptedData;
+};
+
+/**
+ * A crypto Pattern is a repeating sequence of encrypted and clear blocks
+ * occuring within the bytes indicated by mNumBytesOfEncryptedDatad bytes
+ * of a subsample. Patterns are used to reduce the CPU overhead of
+ * decrypting samples. As an example, HLS uses 1:9 patterns where every
+ * 10th block is encrypted.
+ */
+struct Pattern {
+    /**
+     * The number of blocks to be encrypted in the pattern. If zero,
+     * pattern encryption is inoperative.
+     */
+    uint32_t encryptBlocks;
+
+    /**
+     * The number of blocks to be skipped (left clear) in the pattern. If
+     * zero, pattern encryption is inoperative.
+     */
+    uint32_t skipBlocks;
+};
+
+enum BufferType : uint32_t {
+    SHARED_MEMORY = 0,
+    NATIVE_HANDLE = 1,
+};
+
+/**
+ * A SharedBuffer describes a decrypt buffer which is defined by an offset and
+ * a size.  The offset is relative to the shared memory base which is established
+ * using setSharedMemoryBase().
+ */
+struct SharedBuffer {
+    /**
+     * The offset from the shared memory base
+     */
+    uint64_t offset;
+
+    /**
+     * The size of the shared buffer in bytes
+     */
+    uint64_t size;
+};
+
+
+/**
+ * A decrypt destination buffer can be either normal user-space shared
+ * memory for the non-secure decrypt case, or it can be a secure buffer
+ * which is referenced by a native-handle. The native handle is allocated
+ * by the vendor's buffer allocator.
+ */
+struct DestinationBuffer {
+    /**
+     * The type of the buffer
+     */
+    BufferType type;
+
+    /**
+     * If type == SHARED_MEMORY, the decrypted data must be written
+     * to user-space non-secure shared memory.
+     */
+    SharedBuffer nonsecureMemory;
+
+    /**
+     * If type == NATIVE_HANDLE, the decrypted data must be written
+     * to secure memory referenced by the vendor's buffer allocator.
+     */
+    handle secureMemory;
+};
diff --git a/drm/Android.bp b/drm/Android.bp
index 412e162..bbb3e4b 100644
--- a/drm/Android.bp
+++ b/drm/Android.bp
@@ -1,5 +1,4 @@
 // This is an autogenerated file, do not edit.
 subdirs = [
-    "crypto/1.0",
-    "drm/1.0",
+    "1.0",
 ]
diff --git a/drm/crypto/1.0/Android.bp b/drm/crypto/1.0/Android.bp
deleted file mode 100644
index 73eded1..0000000
--- a/drm/crypto/1.0/Android.bp
+++ /dev/null
@@ -1,64 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-genrule {
-    name: "android.hardware.drm.crypto@1.0_genc++",
-    tools: ["hidl-gen"],
-    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.crypto@1.0",
-    srcs: [
-        "types.hal",
-        "ICryptoFactory.hal",
-        "ICryptoPlugin.hal",
-    ],
-    out: [
-        "android/hardware/drm/crypto/1.0/types.cpp",
-        "android/hardware/drm/crypto/1.0/CryptoFactoryAll.cpp",
-        "android/hardware/drm/crypto/1.0/CryptoPluginAll.cpp",
-    ],
-}
-
-genrule {
-    name: "android.hardware.drm.crypto@1.0_genc++_headers",
-    tools: ["hidl-gen"],
-    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.crypto@1.0",
-    srcs: [
-        "types.hal",
-        "ICryptoFactory.hal",
-        "ICryptoPlugin.hal",
-    ],
-    out: [
-        "android/hardware/drm/crypto/1.0/types.h",
-        "android/hardware/drm/crypto/1.0/ICryptoFactory.h",
-        "android/hardware/drm/crypto/1.0/IHwCryptoFactory.h",
-        "android/hardware/drm/crypto/1.0/BnHwCryptoFactory.h",
-        "android/hardware/drm/crypto/1.0/BpHwCryptoFactory.h",
-        "android/hardware/drm/crypto/1.0/BsCryptoFactory.h",
-        "android/hardware/drm/crypto/1.0/ICryptoPlugin.h",
-        "android/hardware/drm/crypto/1.0/IHwCryptoPlugin.h",
-        "android/hardware/drm/crypto/1.0/BnHwCryptoPlugin.h",
-        "android/hardware/drm/crypto/1.0/BpHwCryptoPlugin.h",
-        "android/hardware/drm/crypto/1.0/BsCryptoPlugin.h",
-    ],
-}
-
-cc_library_shared {
-    name: "android.hardware.drm.crypto@1.0",
-    generated_sources: ["android.hardware.drm.crypto@1.0_genc++"],
-    generated_headers: ["android.hardware.drm.crypto@1.0_genc++_headers"],
-    export_generated_headers: ["android.hardware.drm.crypto@1.0_genc++_headers"],
-    shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libhwbinder",
-        "liblog",
-        "libutils",
-        "libcutils",
-        "android.hidl.base@1.0",
-    ],
-    export_shared_lib_headers: [
-        "libhidlbase",
-        "libhidltransport",
-        "libhwbinder",
-        "libutils",
-        "android.hidl.base@1.0",
-    ],
-}
diff --git a/drm/crypto/1.0/default/Android.mk b/drm/crypto/1.0/default/Android.mk
deleted file mode 100644
index 27fca98..0000000
--- a/drm/crypto/1.0/default/Android.mk
+++ /dev/null
@@ -1,46 +0,0 @@
-# Copyright (C) 2016, 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 := android.hardware.drm.crypto@1.0-impl
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
-    CryptoFactory.cpp \
-    CryptoPlugin.cpp \
-    TypeConvert.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    libhwbinder \
-    libhidlmemory \
-    libutils \
-    liblog \
-    libmediadrm \
-    libstagefright_foundation \
-    android.hardware.drm.crypto@1.0 \
-    android.hidl.memory@1.0 \
-
-LOCAL_C_INCLUDES := \
-    frameworks/native/include \
-    frameworks/av/include
-
-# TODO: The legacy DRM plugins only support 32-bit. They need
-# to be migrated to 64-bit (b/18948909)
-LOCAL_32_BIT_ONLY := true
-
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/crypto/1.0/default/TypeConvert.cpp b/drm/crypto/1.0/default/TypeConvert.cpp
deleted file mode 100644
index ed95d15..0000000
--- a/drm/crypto/1.0/default/TypeConvert.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-#include "TypeConvert.h"
-
-namespace android {
-namespace hardware {
-namespace drm {
-namespace crypto {
-namespace V1_0 {
-namespace implementation {
-
-Status toStatus(status_t legacyStatus) {
-    Status status;
-    switch(legacyStatus) {
-    case android::OK:
-        status = Status::OK;
-        break;
-    case android::ERROR_DRM_NO_LICENSE:
-        status = Status::ERROR_DRM_NO_LICENSE;
-        break;
-    case android::ERROR_DRM_LICENSE_EXPIRED:
-        status = Status::ERROR_DRM_LICENSE_EXPIRED;
-        break;
-    case android::ERROR_DRM_RESOURCE_BUSY:
-        status = Status::ERROR_DRM_RESOURCE_BUSY;
-        break;
-    case android::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION:
-        status = Status::ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION;
-        break;
-    case android::ERROR_DRM_SESSION_NOT_OPENED:
-        status = Status::ERROR_DRM_SESSION_NOT_OPENED;
-        break;
-    case android::ERROR_DRM_CANNOT_HANDLE:
-    case android::BAD_VALUE:
-        status = Status::ERROR_DRM_CANNOT_HANDLE;
-        break;
-    default:
-        ALOGW("Unable to convert legacy status: %d, defaulting to UNKNOWN",
-                legacyStatus);
-        status = Status::ERROR_UNKNOWN_CRYPTO_EXCEPTION;
-        break;
-    }
-    return status;
-}
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace crypto
-}  // namespace drm
-}  // namespace hardware
-}  // namespace android
diff --git a/drm/crypto/1.0/types.hal b/drm/crypto/1.0/types.hal
deleted file mode 100644
index 1ba2776..0000000
--- a/drm/crypto/1.0/types.hal
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Copyright (C) 2016 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.
- */
-
-package android.hardware.drm.crypto@1.0;
-
-enum Status : uint32_t {
-    /**
-     * The Crypto plugin must return OK when an operation completes without any
-     * errors.
-     */
-    OK,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_NO_LICENSE if decryption is
-     * attempted when the license keys have not been loaded into the crypto
-     * session.
-     */
-    ERROR_DRM_NO_LICENSE,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_LICENSE_EXPIRED if decryption
-     * is attempted when the license keys have expired and are no longer usable.
-     */
-    ERROR_DRM_LICENSE_EXPIRED,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_RESOURCE_BUSY when a required
-     * crypto resource cannot be allocated while attempting decryption.
-     */
-    ERROR_DRM_RESOURCE_BUSY,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION
-     * when the output protection level enabled on the device is not
-     * sufficient to meet the requirements in the license policy.  HDCP is an
-     * example of a form of output protection.
-     */
-    ERROR_DRM_INSUFFICIENT_OUTPUT_PROTECTION,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_SESSION_NOT_OPENED when
-     * decryption is attempted on a session that is not opened.
-     */
-    ERROR_DRM_SESSION_NOT_OPENED,
-
-    /**
-     * The Crypto Plugin must return ERROR_DRM_CANNOT_HANDLE when an operation
-     * is attempted that cannot be supported by the crypto system of the device.
-     */
-    ERROR_DRM_CANNOT_HANDLE,
-
-    /**
-     * The Crypto Plugin must return ERROR_UNKNOWN_CRYPTO_EXCEPTION in any
-     * fatal condition that is not covered by the other error messages.
-     */
-    ERROR_UNKNOWN_CRYPTO_EXCEPTION,
-};
-
-/**
- * Enumerate the supported crypto modes
- */
-enum Mode : uint32_t {
-    UNENCRYPTED = 0, // Samples are unencrypted
-    AES_CTR     = 1, // Samples are encrypted with AES CTR mode
-    AES_CBC_CTS = 2, // Samples are encrypted with AES CBC CTS mode
-    AES_CBC     = 3, // Samples are encrypted with AES CBC mode
-};
-
-/**
- * A subsample consists of some number of bytes of clear (unencrypted)
- * data followed by a number of bytes of encrypted data.
- */
-struct SubSample {
-    uint32_t numBytesOfClearData;
-    uint32_t numBytesOfEncryptedData;
-};
-
-/**
- * A crypto Pattern is a repeating sequence of encrypted and clear blocks
- * occuring within the bytes indicated by mNumBytesOfEncryptedDatad bytes
- * of a subsample. Patterns are used to reduce the CPU overhead of
- * decrypting samples. As an example, HLS uses 1:9 patterns where every
- * 10th block is encrypted.
- */
-struct Pattern {
-    /**
-     * The number of blocks to be encrypted in the pattern. If zero,
-     * pattern encryption is inoperative.
-     */
-    uint32_t encryptBlocks;
-
-    /**
-     * The number of blocks to be skipped (left clear) in the pattern. If
-     * zero, pattern encryption is inoperative.
-     */
-    uint32_t skipBlocks;
-};
-
-enum BufferType : uint32_t {
-    SHARED_MEMORY = 0,
-    NATIVE_HANDLE = 1,
-};
-
-/**
- * A SharedBuffer describes a decrypt buffer which is defined by an offset and
- * a size.  The offset is relative to the shared memory base which is established
- * using setSharedMemoryBase().
- */
-struct SharedBuffer {
-    /**
-     * The offset from the shared memory base
-     */
-    uint64_t offset;
-
-    /**
-     * The size of the shared buffer in bytes
-     */
-    uint64_t size;
-};
-
-
-/**
- * A decrypt destination buffer can be either normal user-space shared
- * memory for the non-secure decrypt case, or it can be a secure buffer
- * which is referenced by a native-handle. The native handle is allocated
- * by the vendor's buffer allocator.
- */
-struct DestinationBuffer {
-    /**
-     * The type of the buffer
-     */
-    BufferType type;
-
-    /**
-     * If type == SHARED_MEMORY, the decrypted data must be written
-     * to user-space non-secure shared memory.
-     */
-    SharedBuffer nonsecureMemory;
-
-    /**
-     * If type == NATIVE_HANDLE, the decrypted data must be written
-     * to secure memory referenced by the vendor's buffer allocator.
-     */
-    handle secureMemory;
-};
diff --git a/drm/drm/1.0/Android.bp b/drm/drm/1.0/Android.bp
deleted file mode 100644
index dfff435..0000000
--- a/drm/drm/1.0/Android.bp
+++ /dev/null
@@ -1,72 +0,0 @@
-// This file is autogenerated by hidl-gen. Do not edit manually.
-
-genrule {
-    name: "android.hardware.drm.drm@1.0_genc++",
-    tools: ["hidl-gen"],
-    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.drm@1.0",
-    srcs: [
-        "types.hal",
-        "IDrmFactory.hal",
-        "IDrmPlugin.hal",
-        "IDrmPluginListener.hal",
-    ],
-    out: [
-        "android/hardware/drm/drm/1.0/types.cpp",
-        "android/hardware/drm/drm/1.0/DrmFactoryAll.cpp",
-        "android/hardware/drm/drm/1.0/DrmPluginAll.cpp",
-        "android/hardware/drm/drm/1.0/DrmPluginListenerAll.cpp",
-    ],
-}
-
-genrule {
-    name: "android.hardware.drm.drm@1.0_genc++_headers",
-    tools: ["hidl-gen"],
-    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.drm.drm@1.0",
-    srcs: [
-        "types.hal",
-        "IDrmFactory.hal",
-        "IDrmPlugin.hal",
-        "IDrmPluginListener.hal",
-    ],
-    out: [
-        "android/hardware/drm/drm/1.0/types.h",
-        "android/hardware/drm/drm/1.0/IDrmFactory.h",
-        "android/hardware/drm/drm/1.0/IHwDrmFactory.h",
-        "android/hardware/drm/drm/1.0/BnHwDrmFactory.h",
-        "android/hardware/drm/drm/1.0/BpHwDrmFactory.h",
-        "android/hardware/drm/drm/1.0/BsDrmFactory.h",
-        "android/hardware/drm/drm/1.0/IDrmPlugin.h",
-        "android/hardware/drm/drm/1.0/IHwDrmPlugin.h",
-        "android/hardware/drm/drm/1.0/BnHwDrmPlugin.h",
-        "android/hardware/drm/drm/1.0/BpHwDrmPlugin.h",
-        "android/hardware/drm/drm/1.0/BsDrmPlugin.h",
-        "android/hardware/drm/drm/1.0/IDrmPluginListener.h",
-        "android/hardware/drm/drm/1.0/IHwDrmPluginListener.h",
-        "android/hardware/drm/drm/1.0/BnHwDrmPluginListener.h",
-        "android/hardware/drm/drm/1.0/BpHwDrmPluginListener.h",
-        "android/hardware/drm/drm/1.0/BsDrmPluginListener.h",
-    ],
-}
-
-cc_library_shared {
-    name: "android.hardware.drm.drm@1.0",
-    generated_sources: ["android.hardware.drm.drm@1.0_genc++"],
-    generated_headers: ["android.hardware.drm.drm@1.0_genc++_headers"],
-    export_generated_headers: ["android.hardware.drm.drm@1.0_genc++_headers"],
-    shared_libs: [
-        "libhidlbase",
-        "libhidltransport",
-        "libhwbinder",
-        "liblog",
-        "libutils",
-        "libcutils",
-        "android.hidl.base@1.0",
-    ],
-    export_shared_lib_headers: [
-        "libhidlbase",
-        "libhidltransport",
-        "libhwbinder",
-        "libutils",
-        "android.hidl.base@1.0",
-    ],
-}
diff --git a/drm/drm/1.0/default/Android.mk b/drm/drm/1.0/default/Android.mk
deleted file mode 100644
index 52e67e1..0000000
--- a/drm/drm/1.0/default/Android.mk
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2016, 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 := android.hardware.drm.drm@1.0-impl
-LOCAL_MODULE_RELATIVE_PATH := hw
-LOCAL_SRC_FILES := \
-    DrmFactory.cpp \
-    DrmPlugin.cpp \
-    TypeConvert.cpp \
-
-LOCAL_SHARED_LIBRARIES := \
-    libhidlbase \
-    libhidltransport \
-    libhwbinder \
-    libutils \
-    liblog \
-    libmediadrm \
-    libstagefright_foundation \
-    android.hardware.drm.drm@1.0 \
-
-LOCAL_C_INCLUDES := \
-    frameworks/native/include \
-    frameworks/av/include
-
-# TODO: The legacy DRM plugins only support 32-bit. They need
-# to be migrated to 64-bit (b/18948909)
-LOCAL_32_BIT_ONLY := true
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/drm/drm/1.0/default/TypeConvert.h b/drm/drm/1.0/default/TypeConvert.h
deleted file mode 100644
index 2f7875e..0000000
--- a/drm/drm/1.0/default/TypeConvert.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2016 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_DRM_DRM_V1_0_TYPECONVERT
-#define ANDROID_HARDWARE_DRM_DRM_V1_0_TYPECONVERT
-
-#include <utils/Vector.h>
-#include <media/stagefright/MediaErrors.h>
-#include <media/drm/DrmAPI.h>
-
-#include <hidl/MQDescriptor.h>
-#include <android/hardware/drm/drm/1.0/types.h>
-
-namespace android {
-namespace hardware {
-namespace drm {
-namespace drm {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::hidl_vec;
-
-template<typename T> const hidl_vec<T> toHidlVec(const Vector<T> &Vector) {
-    hidl_vec<T> vec;
-    vec.setToExternal(const_cast<T *>(Vector.array()), Vector.size());
-    return vec;
-}
-
-template<typename T> hidl_vec<T> toHidlVec(Vector<T> &Vector) {
-    hidl_vec<T> vec;
-    vec.setToExternal(Vector.editArray(), Vector.size());
-    return vec;
-}
-
-template<typename T> const Vector<T> toVector(const hidl_vec<T> & vec) {
-    Vector<T> vector;
-    vector.appendArray(vec.data(), vec.size());
-    return *const_cast<const Vector<T> *>(&vector);
-}
-
-template<typename T> Vector<T> toVector(hidl_vec<T> &vec) {
-    Vector<T> vector;
-    vector.appendArray(vec.data(), vec.size());
-    return vector;
-}
-
-Status toStatus(status_t legacyStatus);
-
-}  // namespace implementation
-}  // namespace V1_0
-}  // namespace drm
-}  // namespace drm
-}  // namespace hardware
-}  // namespace android
-
-#endif // ANDROID_HARDWARE_DRM_DRM_V1_0_TYPECONVERT