vndk-def: Separate {sp-hal,sp-ndk}-vndk-stable

This commit separates the vndk-stable set, which was printed by vndk
subcommand, into sp-hal-vndk-stable and sp-ndk-vndk-stable.  This will
make it easier to diagnose the shared library usages.

Note: The sp-lib subcommand was printing separated vndk-stable sets even
before this commit.  This commit unifies the output format of vndk and
sp-lib subcommands.

Test: Run vndk subcommand over sailfish image.
Change-Id: I5b64d4359da8aa344dc87a5b3a8469c0030c115c
diff --git a/vndk/tools/definition-tool/README.md b/vndk/tools/definition-tool/README.md
index bad020f..6d60f15 100644
--- a/vndk/tools/definition-tool/README.md
+++ b/vndk/tools/definition-tool/README.md
@@ -16,67 +16,87 @@
         --vendor ${ANDROID_PRODUCT_OUT}/vendor \
         --load-generic-refs generic_arm64
 
-This command will print 7 different lists:
+This command will print shared libraries that belong to the following sets:
 
-* **vndk-stable**
+1. **sp-ndk**
 
-  - This list contains the pre-defined vndk-stable libraries.
+    - This contains the pre-defined SP-NDK libraries.
 
-  - The libraries with long-term API/ABI stability/compatibility commitment.
+    - The libraries will be installed to `/system/lib[64]`
 
-  - The libraries will be installed to /system/lib[64]/vndk-stable
+2. **sp-ndk-vndk-stable**
 
-* **sp-hal**
+    - This contains the SP-NDK dependencies.
 
-  - This list contains the pre-defined SP-HAL libraries and their dependencies.
+    - The libraries with long-term API/ABI stability/compatibility commitment.
 
-  - The libraries will be installed to /vendor/lib[64]/sameprocess
+    - The libraries will be installed to `/system/lib[64]/vndk-stable`
 
-* **vndk-core**
+3. **sp-hal**
 
-  - This list contains the shared libraries used by both the framework and
-    vendor code.
+    - This contains the pre-defined SP-HAL libraries.
 
-  - The libraries must be either intact or inward-customized.
+    - The libraries will be installed to `/vendor/lib[64]/sameprocess`
 
-  - The libraries will be installed to /system/lib[64]/vndk-$FWK
+4. **sp-hal-dep**
 
-* **vndk-indirect**
+    - This contains the SP-HAL non-AOSP dependencies.
 
-  - This list contains the shared libraries which are indirectly used by
-    aforementioned vndk-core but not directly used by vendor code.
+    - The libraries will be installed to `/vendor/lib[64]/sameprocess`
 
-  - The libraries must be either intact or inward-customized.
+5. **sp-hal-vndk-stable**
 
-  - The libraries will be installed to /system/lib[64]/vndk-$FWK
+    - This contains the SP-HAL AOSP dependencies.
 
-* **vndk-fwd-ext**
+    - The libraries with long-term API/ABI stability/compatibility commitment.
 
-  - This list contains the vndk-core/vndk-indirect overlays for *the framework*.
+    - The libraries will be installed to `/system/lib[64]/vndk-stable`
 
-  - The libraries must be either outward-customized or extended.  In other
-    words, the libraries in this list might use or define non-AOSP APIs.
+6. **vndk-core**
 
-  - The libraries will be installed to /system/lib[64]/vndk-$FWK-ext
+    - This contains the shared libraries used by both the framework and
+      vendor code.
 
-* **vndk-vnd-ext**
+    - The libraries must be either intact or inward-customized.
 
-  - This list contains the vndk-core overlays for *vendor code*.
+    - The libraries will be installed to `/system/lib[64]/vndk-$FWK`
 
-  - The libraries must be either outward-customized or extended.  In other
-    words, the libraries in this list might use or define non-AOSP APIs.
+7. **vndk-indirect**
 
-  - The libraries will be installed to /vendor/lib[64]/vndk-$VND-ext
+    - This contains the shared libraries which are indirectly used by
+      aforementioned vndk-core but not directly used by vendor code.
 
-- **extra-vendor**
+    - The libraries must be either intact or inward-customized.
 
-  - This list contains the extra libraries that have to be copied from
-    /system/lib[64] to /vendor/lib[64].
+    - The libraries will be installed to `/system/lib[64]/vndk-$FWK`
 
-  - The libraries in this list are usually the non-AOSP dependencies of
-    vndk-vnd-ext or other vendor code.
+8. **vndk-fwd-ext**
 
-  - The libraries will be installed to /vendor/lib[64]
+    - This contains the vndk-core/vndk-indirect overlays for *the framework*.
+
+    - The libraries must be either outward-customized or extended.  In other
+      words, the libraries in this list might use or define non-AOSP APIs.
+
+    - The libraries will be installed to `/system/lib[64]/vndk-$FWK-ext`
+
+9. **vndk-vnd-ext**
+
+    - This contains the vndk-core overlays for *vendor code*.
+
+    - The libraries must be either outward-customized or extended.  In other
+      words, the libraries in this list might use or define non-AOSP APIs.
+
+    - The libraries will be installed to `/vendor/lib[64]/vndk-$VND-ext`
+
+10. **extra-vendor**
+
+    - This contains the extra libraries that have to be copied from
+      `/system/lib[64]` to `/vendor/lib[64]`.
+
+    - The libraries in this list are usually the non-AOSP dependencies of
+      vndk-vnd-ext or other vendor code.
+
+    - The libraries will be installed to `/vendor/lib[64]`
 
 
 # Sub Directory Tagging
@@ -229,21 +249,7 @@
         --system ${ANDROID_PRODUCT_OUT}/system \
         --vendor ${ANDROID_PRODUCT_OUT}/vendor
 
-The output consists of following categories:
-
-* **sp-hal** -- Pre-defined same-process HALs.
-
-* **sp-hal-dep** -- Shared libraries that are used by SP-HALs.  These libraries
-  have to be installed into /vendor/lib[64]/sameprocess as well.
-
-* **sp-hal-vndk-stable** -- VNDK stable libraries that are used by SP-HAL.
-
-* **sp-ndk** -- Pre-defined same-process NDK libraries.
-
-* **sp-ndk-vndk-stable** -- Shared libraries that are used by SP-NDKs.
-
-**vndk-stable** is the union set of **sp-hal-vndk-stable** and
-**sp-ndk-vndk-stable**.
+The output format is identical to the one described in [Usage](#usage) section.
 
 
 ## Python 2 Support
diff --git a/vndk/tools/definition-tool/vndk_definition_tool.py b/vndk/tools/definition-tool/vndk_definition_tool.py
index a5627a4..c93faa7 100755
--- a/vndk/tools/definition-tool/vndk_definition_tool.py
+++ b/vndk/tools/definition-tool/vndk_definition_tool.py
@@ -1844,27 +1844,31 @@
                     (vndk.vndk_core, vndk.vndk_indirect, vndk.vndk_fwk_ext,
                      vndk.vndk_vnd_ext))
 
+        # SP-NDK
+        for lib in sorted_lib_path_list(sp_ndk):
+            print('sp-ndk:', lib)
+        for lib in sorted_lib_path_list(sp_ndk_vndk_stable):
+            print('sp-ndk-vndk-stable:', lib)
+
+        # SP-HAL
         for lib in sorted_lib_path_list(sp_hal):
             print('sp-hal:', lib)
-
         for lib in sorted_lib_path_list(sp_hal_dep):
             print('sp-hal-dep:', lib)
+        for lib in sorted_lib_path_list(sp_hal_vndk_stable):
+            print('sp-hal-vndk-stable:', lib)
 
-        for lib in sorted_lib_path_list(vndk_stable):
-            print('vndk-stable:', lib)
-
+        # VNDK (framework)
         for lib in sorted_lib_path_list(vndk.vndk_core):
             print('vndk-core:', lib)
-
         for lib in sorted_lib_path_list(vndk.vndk_indirect):
             print('vndk-indirect:', lib)
-
         for lib in sorted_lib_path_list(vndk.vndk_fwk_ext):
             print('vndk-fwk-ext:', lib)
 
+        # VNDK (vendor)
         for lib in sorted_lib_path_list(vndk.vndk_vnd_ext):
             print('vndk-vnd-ext:', lib)
-
         for lib in sorted_lib_path_list(vndk.extra_vendor_libs):
             print('extra-vendor-lib:', lib)
 
@@ -2042,6 +2046,13 @@
         sp_hal, sp_hal_dep, sp_hal_vndk_stable, sp_ndk, sp_ndk_vndk_stable = \
                 graph.compute_sp_lib(generic_refs)
 
+        # SP-NDK
+        for lib in sorted_lib_path_list(sp_ndk):
+            print('sp-ndk:', lib)
+        for lib in sorted_lib_path_list(sp_ndk_vndk_stable):
+            print('sp-ndk-vndk-stable:', lib)
+
+        # SP-HAL
         for lib in sorted_lib_path_list(sp_hal):
             print('sp-hal:', lib)
         for lib in sorted_lib_path_list(sp_hal_dep):
@@ -2049,11 +2060,6 @@
         for lib in sorted_lib_path_list(sp_hal_vndk_stable):
             print('sp-hal-vndk-stable:', lib)
 
-        for lib in sorted_lib_path_list(sp_ndk):
-            print('sp-ndk:', lib)
-        for lib in sorted_lib_path_list(sp_ndk_vndk_stable):
-            print('sp-ndk-vndk-stable:', lib)
-
         return 0