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: 152277096
Bug: 140560012
Test: run ./generate-packages.sh with BID 6345366
Test: build aosp_taimen-userdebug on \
  rvc-dev-plus-aosp-without-vendor with the generated tarball
Change-Id: I1a715ac89aef6faf2cc88fbf7d4336e79f21e7ca
diff --git a/self-extractors/qcom/staging/Android.bp.txt b/self-extractors/qcom/staging/Android.bp.txt
new file mode 100644
index 0000000..0cc1c9b
--- /dev/null
+++ b/self-extractors/qcom/staging/Android.bp.txt
@@ -0,0 +1,417 @@
+// 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: "com.qualcomm.qti.imsrtpservice@1.0",
+    arch: {
+        arm: {
+            srcs: ["com.qualcomm.qti.imsrtpservice@1.0.so"],
+            shared_libs: [
+                "libhidlbase",
+                // "libhidltransport",
+                // "libhwbinder",
+                "liblog",
+                "libutils",
+                "libcutils",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/com.qualcomm.qti.imsrtpservice@1.0.so"],
+            shared_libs: [
+                "libhidlbase",
+                // "libhidltransport",
+                // "libhwbinder",
+                "liblog",
+                "libutils",
+                "libcutils",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+    check_elf_files: false,
+}
+
+cc_prebuilt_library_shared {
+    name: "libdiag_system",
+    arch: {
+        arm: {
+            srcs: ["libdiag_system.so"],
+            shared_libs: [
+                "liblog",
+                "libcutils",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libdiag_system.so"],
+            shared_libs: [
+                "liblog",
+                "libcutils",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libimscamera_jni",
+    arch: {
+        arm: {
+            srcs: ["libimscamera_jni.so"],
+            shared_libs: [
+                "libnativehelper",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libimscamera_jni.so"],
+            shared_libs: [
+                "libnativehelper",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "libimsmedia_jni",
+    arch: {
+        arm: {
+            srcs: ["libimsmedia_jni.so"],
+            shared_libs: [
+                "libnativehelper",
+                "libcutils",
+                "libutils",
+                "libgui",
+                "libbinder",
+                "liblog",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/libimsmedia_jni.so"],
+            shared_libs: [
+                "libnativehelper",
+                "libcutils",
+                "libutils",
+                "libgui",
+                "libbinder",
+                "liblog",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "lib-imsvideocodec",
+    arch: {
+        arm: {
+            srcs: ["lib-imsvideocodec.so"],
+            shared_libs: [
+                "libmediandk",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libnativehelper",
+                "libandroid",
+                "libui",
+                "libmedia",
+                "libbinder",
+                "libGLESv2",
+                "libgui",
+                "libdiag_system",
+                "libEGL",
+                "lib-imsvtutils",
+                "libcamera_client",
+                "lib-imsvtextutils",
+                "libnativewindow",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/lib-imsvideocodec.so"],
+            shared_libs: [
+                "libmediandk",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libnativehelper",
+                "libandroid",
+                "libui",
+                "libmedia",
+                "libbinder",
+                "libGLESv2",
+                "libgui",
+                "libdiag_system",
+                "libEGL",
+                "lib-imsvtutils",
+                "libcamera_client",
+                "lib-imsvtextutils",
+                "libnativewindow",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "lib-imsvtextutils",
+    arch: {
+        arm: {
+            srcs: ["lib-imsvtextutils.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "lib-imsvtutils",
+                "libGLESv2",
+                "libEGL",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/lib-imsvtextutils.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "lib-imsvtutils",
+                "libGLESv2",
+                "libEGL",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "lib-imsvt",
+    arch: {
+        arm: {
+            srcs: ["lib-imsvt.so"],
+            shared_libs: [
+                "libdiag_system",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libnativehelper",
+                "libandroid",
+                "libgui",
+                "libui",
+                "libbinder",
+                "lib-imsvideocodec",
+                "lib-imsvtutils",
+                "libbase",
+                "libhardware_legacy",
+                "libhardware",
+                // "libhwbinder",
+                "libhidlbase",
+                // "libhidltransport",
+                "com.qualcomm.qti.imsrtpservice@1.0",
+                "librcc",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/lib-imsvt.so"],
+            shared_libs: [
+                "libdiag_system",
+                "libcutils",
+                "libutils",
+                "liblog",
+                "libnativehelper",
+                "libandroid",
+                "libgui",
+                "libui",
+                "libbinder",
+                "lib-imsvideocodec",
+                "lib-imsvtutils",
+                "libbase",
+                "libhardware_legacy",
+                "libhardware",
+                // "libhwbinder",
+                "libhidlbase",
+                // "libhidltransport",
+                "com.qualcomm.qti.imsrtpservice@1.0",
+                "librcc",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+    check_elf_files: false,
+}
+
+cc_prebuilt_library_shared {
+    name: "lib-imsvtutils",
+    arch: {
+        arm: {
+            srcs: ["lib-imsvtutils.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/lib-imsvtutils.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
+
+cc_prebuilt_library_shared {
+    name: "librcc",
+    arch: {
+        arm: {
+            srcs: ["librcc.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+        arm64: {
+            srcs: ["lib64/librcc.so"],
+            shared_libs: [
+                "libutils",
+                "libcutils",
+                "liblog",
+                "libdiag_system",
+                "libc++",
+                "libc",
+                "libm",
+                "libdl",
+            ],
+        },
+    },
+    compile_multilib: "both",
+    owner: "qcom",
+    strip: {
+        none: true,
+    },
+}
diff --git a/self-extractors/qcom/staging/device-partial.mk b/self-extractors/qcom/staging/device-partial.mk
index 1e0eb4b..2a53a8a 100644
--- a/self-extractors/qcom/staging/device-partial.mk
+++ b/self-extractors/qcom/staging/device-partial.mk
@@ -12,11 +12,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+PRODUCT_SOONG_NAMESPACES += \
+    vendor/qcom/taimen/proprietary
+
 # AOSP packages required by the blobs
 PRODUCT_PACKAGES := \
     ims
 
 #  blob(s) necessary for Taimen hardware
+PRODUCT_PACKAGES += \
+    com.qualcomm.qti.imsrtpservice@1.0 \
+    libdiag_system \
+    libimscamera_jni \
+    libimsmedia_jni \
+    lib-imsvideocodec \
+    lib-imsvtextutils \
+    lib-imsvt \
+    lib-imsvtutils \
+    librcc \
+
 PRODUCT_COPY_FILES := \
     vendor/qcom/taimen/proprietary/ATT_profiles.xml:system/etc/cne/Nexus/ATT/ATT_profiles.xml:qcom \
     vendor/qcom/taimen/proprietary/ROW_profiles.xml:system/etc/cne/Nexus/ROW/ROW_profiles.xml:qcom \
@@ -30,21 +44,4 @@
     vendor/qcom/taimen/proprietary/com.quicinc.cne.jar:system/framework/com.quicinc.cne.jar:qcom \
     vendor/qcom/taimen/proprietary/qcrilhook.jar:system/framework/qcrilhook.jar:qcom \
     vendor/qcom/taimen/proprietary/rcsimssettings.jar:system/framework/rcsimssettings.jar:qcom \
-    vendor/qcom/taimen/proprietary/lib64/com.qualcomm.qti.imsrtpservice@1.0.so:system/lib64/com.qualcomm.qti.imsrtpservice@1.0.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/libdiag_system.so:system/lib64/libdiag_system.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/libimscamera_jni.so:system/lib64/libimscamera_jni.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/libimsmedia_jni.so:system/lib64/libimsmedia_jni.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/lib-imsvideocodec.so:system/lib64/lib-imsvideocodec.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/lib-imsvtextutils.so:system/lib64/lib-imsvtextutils.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/lib-imsvt.so:system/lib64/lib-imsvt.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/lib-imsvtutils.so:system/lib64/lib-imsvtutils.so:qcom \
-    vendor/qcom/taimen/proprietary/lib64/librcc.so:system/lib64/librcc.so:qcom \
-    vendor/qcom/taimen/proprietary/com.qualcomm.qti.imsrtpservice@1.0.so:system/lib/com.qualcomm.qti.imsrtpservice@1.0.so:qcom \
-    vendor/qcom/taimen/proprietary/libdiag_system.so:system/lib/libdiag_system.so:qcom \
-    vendor/qcom/taimen/proprietary/libimscamera_jni.so:system/lib/libimscamera_jni.so:qcom \
-    vendor/qcom/taimen/proprietary/libimsmedia_jni.so:system/lib/libimsmedia_jni.so:qcom \
-    vendor/qcom/taimen/proprietary/lib-imsvideocodec.so:system/lib/lib-imsvideocodec.so:qcom \
-    vendor/qcom/taimen/proprietary/lib-imsvtextutils.so:system/lib/lib-imsvtextutils.so:qcom \
-    vendor/qcom/taimen/proprietary/lib-imsvt.so:system/lib/lib-imsvt.so:qcom \
-    vendor/qcom/taimen/proprietary/lib-imsvtutils.so:system/lib/lib-imsvtutils.so:qcom \
-    vendor/qcom/taimen/proprietary/librcc.so:system/lib/librcc.so:qcom \
+