Modify core.current.stubs dist dependency based on release flag

Currently, core.current.stubs.exportable.from-source output jar file is
copied to the dist directory regardless of the value of the
RELEASE_HIDDEN_API_EXPORTABLE_STUBS release flag. However, to align with
the other artifacts in the dist directory that respects the value of
the flag, the artifact of the everything stubs should be copied to the
dist directory when the flag value is not true, instead of the artifact
of the exportable stubs.

Test: lunch sdk-trunk_staging-eng && m sdk dist && inspect ninja graph
Change-Id: Id230fce9320d2250099c179b02d1103c96c9561d
diff --git a/java/core-libraries/Android.bp b/java/core-libraries/Android.bp
index ab72e8b..25a2cf3 100644
--- a/java/core-libraries/Android.bp
+++ b/java/core-libraries/Android.bp
@@ -40,10 +40,50 @@
     system_modules: "none",
 }
 
+soong_config_module_type {
+    name: "core_current_stubs_soong_config_defaults",
+    module_type: "java_defaults",
+    config_namespace: "ANDROID",
+    bool_variables: [
+        "release_hidden_api_exportable_stubs",
+    ],
+    properties: [
+        "dist.targets",
+        "dist.dest",
+    ],
+}
+
+core_current_stubs_soong_config_defaults {
+    name: "core_current_stubs_everything_soong_config_defaults",
+    soong_config_variables: {
+        release_hidden_api_exportable_stubs: {
+            conditions_default: {
+                dist: {
+                    targets: dist_targets,
+                    dest: "core.current.stubs.jar",
+                },
+            },
+        },
+    },
+}
+
+core_current_stubs_soong_config_defaults {
+    name: "core_current_stubs_exportable_soong_config_defaults",
+    soong_config_variables: {
+        release_hidden_api_exportable_stubs: {
+            dist: {
+                targets: dist_targets,
+                dest: "core.current.stubs.jar",
+            },
+        },
+    },
+}
+
 java_library {
     name: "core.current.stubs.from-source",
     defaults: [
         "core.current.stubs.defaults",
+        "core_current_stubs_everything_soong_config_defaults",
     ],
     static_libs: [
         "art.module.public.api.stubs",
@@ -91,16 +131,13 @@
     name: "core.current.stubs.exportable.from-source",
     defaults: [
         "core.current.stubs.defaults",
+        "core_current_stubs_exportable_soong_config_defaults",
     ],
     static_libs: [
         "art.module.public.api.stubs.exportable",
         "conscrypt.module.public.api.stubs.exportable",
         "i18n.module.public.api.stubs.exportable",
     ],
-    dist: {
-        targets: dist_targets,
-        dest: "core.current.stubs.jar",
-    },
 }
 
 java_library {