Remove ELF PRODUCT_COPY_FILES

We're banning ELF prebuilts in PRODUCT_COPY_FILES. Define prebuilt
modules for vendor prebuilts so we can run check_elf_file.py on them.
Use PRODUCT_PACKAGES to install ELF prebuilts.

Bug: 140560012
Test: run ./generate-packages.sh with BID 6406761
Change-Id: Idf3b250869fee88835160723d6e61f62c3a89fb9
diff --git a/self-extractors_hikey960/extract-lists.txt b/self-extractors_hikey960/extract-lists.txt
index 932ca9b..d08821a 100644
--- a/self-extractors_hikey960/extract-lists.txt
+++ b/self-extractors_hikey960/extract-lists.txt
@@ -1,18 +1,18 @@
   hisilicon)
     TO_EXTRACT="\
-            SYSTEM/lib/libc_secshared.so \
-            SYSTEM/lib/libhiion.so \
-            SYSTEM/lib/libhilog.so \
-            SYSTEM/lib/libOMX.hisi.vdec.core.so \
-            SYSTEM/lib/libOMX.hisi.video.decoder.so \
-            SYSTEM/lib/libOMX_Core.so \
-            SYSTEM/lib/libstagefrighthw.so \
-            SYSTEM/lib64/libc_secshared.so \
-            SYSTEM/lib64/libhiion.so \
-            SYSTEM/lib64/libhilog.so \
-            SYSTEM/lib64/libOMX.hisi.vdec.core.so \
-            SYSTEM/lib64/libOMX.hisi.video.decoder.so \
-            SYSTEM/lib64/libOMX_Core.so \
-            SYSTEM/lib64/libstagefrighthw.so \
+            VENDOR/lib/libc_secshared.so \
+            VENDOR/lib/libhiion.so \
+            VENDOR/lib/libhilog.so \
+            VENDOR/lib/libOMX.hisi.vdec.core.so \
+            VENDOR/lib/libOMX.hisi.video.decoder.so \
+            VENDOR/lib/libOMX_Core.so \
+            VENDOR/lib/libstagefrighthw.so \
+            VENDOR/lib64/libc_secshared.so \
+            VENDOR/lib64/libhiion.so \
+            VENDOR/lib64/libhilog.so \
+            VENDOR/lib64/libOMX.hisi.vdec.core.so \
+            VENDOR/lib64/libOMX.hisi.video.decoder.so \
+            VENDOR/lib64/libOMX_Core.so \
+            VENDOR/lib64/libstagefrighthw.so \
             "
             ;;
diff --git a/self-extractors_hikey960/hisilicon/staging/Android.bp.txt b/self-extractors_hikey960/hisilicon/staging/Android.bp.txt
new file mode 100644
index 0000000..faac74b
--- /dev/null
+++ b/self-extractors_hikey960/hisilicon/staging/Android.bp.txt
@@ -0,0 +1,253 @@
+// Copyright (C) 2020 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.
+
+soong_namespace {
+}
+
+cc_prebuilt_library_shared {
+    name: "libc_secshared",
+    arch: {
+        arm: {
+            srcs: ["libc_secshared.so"],
+            shared_libs: [
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libc_secshared.so"],
+            shared_libs: [
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libhiion",
+    arch: {
+        arm: {
+            srcs: ["libhiion.so"],
+            shared_libs: [
+                "liblog",
+                "libion",
+                "libc_secshared",
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libhiion.so"],
+            shared_libs: [
+                "liblog",
+                "libion",
+                "libc_secshared",
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libhilog",
+    arch: {
+        arm: {
+            srcs: ["libhilog.so"],
+            shared_libs: [
+                "libc_secshared",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libhilog.so"],
+            shared_libs: [
+                "libc_secshared",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libOMX_Core",
+    arch: {
+        arm: {
+            srcs: ["libOMX_Core.so"],
+            shared_libs: [
+                "liblog",
+                "libdl",
+                "libc_secshared",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libOMX_Core.so"],
+            shared_libs: [
+                "liblog",
+                "libdl",
+                "libc_secshared",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libOMX.hisi.vdec.core",
+    arch: {
+        arm: {
+            srcs: ["libOMX.hisi.vdec.core.so"],
+            shared_libs: [
+                "libion",
+                "libhiion",
+                "liblog",
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libOMX.hisi.vdec.core.so"],
+            shared_libs: [
+                "libion",
+                "libhiion",
+                "liblog",
+                "libc++",
+                "libdl",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libOMX.hisi.video.decoder",
+    arch: {
+        arm: {
+            srcs: ["libOMX.hisi.video.decoder.so"],
+            shared_libs: [
+                "libdl",
+                "libutils",
+                "liblog",
+                "libion",
+                "libhiion",
+                "libcutils",
+                "libOMX.hisi.vdec.core",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libOMX.hisi.video.decoder.so"],
+            shared_libs: [
+                "libdl",
+                "libutils",
+                "liblog",
+                "libion",
+                "libhiion",
+                "libcutils",
+                "libOMX.hisi.vdec.core",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libstagefrighthw",
+    arch: {
+        arm: {
+            srcs: ["libstagefrighthw.so"],
+            shared_libs: [
+                "liblog",
+                "libcutils",
+                "libutils",
+                "libdl",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libstagefrighthw.so"],
+            shared_libs: [
+                "liblog",
+                "libcutils",
+                "libutils",
+                "libdl",
+                "libc++",
+                "libc",
+                "libm",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    vendor: true,
+    strip: {
+        none: true,
+    },
+}
diff --git a/self-extractors_hikey960/hisilicon/staging/device-partial.mk b/self-extractors_hikey960/hisilicon/staging/device-partial.mk
index c76663a..0e32a4a 100644
--- a/self-extractors_hikey960/hisilicon/staging/device-partial.mk
+++ b/self-extractors_hikey960/hisilicon/staging/device-partial.mk
@@ -15,18 +15,13 @@
 # Blobs needed for HiKey960 video decoding hardware
 TARGET_HISI_CODEC_VERSION := 1
 
-PRODUCT_COPY_FILES  += vendor/linaro/hikey960/hisilicon/proprietary/libOMX.hisi.video.decoder.so:$(TARGET_COPY_OUT_VENDOR)/lib/libOMX.hisi.video.decoder.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libOMX.hisi.video.decoder.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libOMX.hisi.video.decoder.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libOMX.hisi.vdec.core.so:$(TARGET_COPY_OUT_VENDOR)/lib/libOMX.hisi.vdec.core.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libOMX.hisi.vdec.core.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libOMX.hisi.vdec.core.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libOMX_Core.so:$(TARGET_COPY_OUT_VENDOR)/lib/libOMX_Core.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libOMX_Core.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libOMX_Core.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libstagefrighthw.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefrighthw.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libstagefrighthw.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefrighthw.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libc_secshared.so:$(TARGET_COPY_OUT_VENDOR)/lib/libc_secshared.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libc_secshared.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libc_secshared.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libhilog.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libhilog.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libhilog.so:$(TARGET_COPY_OUT_VENDOR)/lib/libhilog.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/lib64/libhiion.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libhiion.so \
-    vendor/linaro/hikey960/hisilicon/proprietary/libhiion.so:$(TARGET_COPY_OUT_VENDOR)/lib/libhiion.so
+PRODUCT_SOONG_NAMESPACES += vendor/linaro/hikey960/hisilicon/proprietary
 
+PRODUCT_PACKAGES += \
+    libc_secshared \
+    libhiion \
+    libhilog \
+    libOMX_Core \
+    libOMX.hisi.vdec.core \
+    libOMX.hisi.video.decoder \
+    libstagefrighthw