Merge "Do not pass TARGET_FLATTEN_APEX to soong"
diff --git a/core/board_config_wifi.mk b/core/board_config_wifi.mk
index 8289bf2..3c27d59 100644
--- a/core/board_config_wifi.mk
+++ b/core/board_config_wifi.mk
@@ -80,4 +80,7 @@
 endif
 ifeq ($(strip $(TARGET_USES_AOSP_FOR_WLAN)),true)
     $(call soong_config_set,wifi,target_uses_aosp_for_wlan,true)
-endif
\ No newline at end of file
+endif
+ifdef WIFI_FEATURE_IMU_DETECTION
+    $(call soong_config_set,wifi,feature_imu_detection,$(WIFI_FEATURE_IMU_DETECTION))
+endif
diff --git a/core/release_config.mk b/core/release_config.mk
index 1a2d480..b72ee89 100644
--- a/core/release_config.mk
+++ b/core/release_config.mk
@@ -21,7 +21,7 @@
 # defining the build flag values.
 #
 # (If you're thinking about aconfig flags, there is one build flag,
-# RELEASE_DEVICE_CONFIG_VALUE_SETS, that sets which device_config_value_set
+# RELEASE_ACONFIG_VALUE_SETS, that sets which aconfig_value_set
 # module to use to set the aconfig flag values.)
 #
 # The short release config names *can* appear multiple times, to allow
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 82d7932..0d5799c 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -316,7 +316,7 @@
 $(call add_json_list, BuildVersionTags,    $(BUILD_VERSION_TAGS))
 
 $(call add_json_str, ReleaseVersion,    $(_RELEASE_VERSION))
-$(call add_json_list, ReleaseDeviceConfigValueSets,    $(RELEASE_DEVICE_CONFIG_VALUE_SETS))
+$(call add_json_list, ReleaseAconfigValueSets,    $(RELEASE_ACONFIG_VALUE_SETS))
 
 $(call json_end)
 
diff --git a/tools/aconfig/Android.bp b/tools/aconfig/Android.bp
index 25424c5..aa43785 100644
--- a/tools/aconfig/Android.bp
+++ b/tools/aconfig/Android.bp
@@ -44,31 +44,31 @@
 
 // integration tests: java
 
-device_config_definitions {
+aconfig_declarations {
     name: "aconfig.test.flags",
-    namespace: "com.android.aconfig.test",
+    package: "com.android.aconfig.test",
     srcs: ["tests/test.aconfig"],
 }
 
-device_config_values {
+aconfig_values {
     name: "aconfig.test.flag.values",
-    namespace: "com.android.aconfig.test",
+    package: "com.android.aconfig.test",
     srcs: [
         "tests/first.values",
         "tests/second.values",
     ],
 }
 
-device_config_value_set {
+aconfig_value_set {
     name: "aconfig.test.flag.value_set",
     values: [
         "aconfig.test.flag.values",
     ],
 }
 
-java_device_config_definitions_library {
+java_aconfig_library {
     name: "aconfig_test_java",
-    device_config_definitions: "aconfig.test.flags",
+    aconfig_declarations: "aconfig.test.flags",
 }
 
 android_test {
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index f00c1a9..5d102cd 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -35,6 +35,7 @@
 import shutil
 import subprocess
 import sys
+import stat
 import tempfile
 import threading
 import time
@@ -2114,6 +2115,26 @@
     shutil.copyfileobj(in_file, out_file)
 
 
+def UnzipSingleFile(input_zip: zipfile.ZipFile, info: zipfile.ZipInfo, dirname: str):
+  # According to https://stackoverflow.com/questions/434641/how-do-i-set-permissions-attributes-on-a-file-in-a-zip-file-using-pythons-zip/6297838#6297838
+  # higher bits of |external_attr| are unix file permission and types
+  unix_filetype = info.external_attr >> 16
+
+  def CheckMask(a, mask):
+    return (a & mask) == mask
+
+  def IsSymlink(a):
+    return CheckMask(a, stat.S_IFLNK)
+  # python3.11 zipfile implementation doesn't handle symlink correctly
+  if not IsSymlink(unix_filetype):
+    return input_zip.extract(info, dirname)
+  if dirname is None:
+    dirname = os.getcwd()
+  target = os.path.join(dirname, info.filename)
+  os.makedirs(os.path.dirname(target), exist_ok=True)
+  os.symlink(input_zip.read(info).decode(), target)
+
+
 def UnzipToDir(filename, dirname, patterns=None):
   """Unzips the archive to the given directory.
 
@@ -2159,9 +2180,11 @@
       # There isn't any matching files. Don't unzip anything.
       if not filtered:
         return
-      input_zip.extractall(dirname, filtered)
+      for info in filtered:
+        UnzipSingleFile(input_zip, info, dirname)
     else:
-      input_zip.extractall(dirname, entries)
+      for info in entries:
+        UnzipSingleFile(input_zip, info, dirname)
 
 
 def UnzipTemp(filename, patterns=None):