diepquynh / android_device_samsung_scx30g2-common

Common device repository for Samsung devices with Spreadtrum SC7730SE (SC7731 - scx30g2) platform
2 stars 8 forks source link

WITH_DEXPREOPT set to true, system_server crashes with SEGV_MAPERR #2

Open enriquezmark36 opened 6 years ago

enriquezmark36 commented 6 years ago

In cm 14.1, setting WITH_DEXPREOPT to true, would create odex files. The device would then boot up normally. After a short while the system_server process crashes causing a soft reboot. It goes on and on.

Coincidentally. I found a thread in xda. Which is, I'm amazed though, the exact error message I'm having:

pid: 13389, tid: 14235, name: Thread-11  >>> system_server <<<
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x78

And the same symptoms and trigger too.

Any insights? Sorry for the delay, I was supposed to post this issue this weeks before testing a possible fix.

diepquynh commented 6 years ago

Welp, the case is deodexing will derp WiFi, causing constant crashes (according to @ngoquang2708)

enriquezmark36 commented 6 years ago

I thought WITH_DEXPREOPT makes the rom odex'd not de-odex'd? O.o

On the other hand, my ulterior motive why I posted this is that I'd liked to ask if reordering the includes in lineage.mk would solve the issue? I'm sorry that I don't know if it's still applicable on Android O and above.

For example for android_device_samsung_core33g:

--- /tmp/a.mk   2018-08-17 19:28:57.257016537 +0800
+++ /tmp/b.mk   2018-08-17 19:29:21.581284622 +0800
@@ -1,3 +1,6 @@
+# Inherit device configuration
+$(call inherit-product, $(LOCAL_PATH)/core33g.mk)
+
 ## Specify phone tech before including full_phone
 $(call inherit-product, vendor/lineage/config/telephony.mk)

@@ -7,9 +10,6 @@
 # Inherit some common Lineage stuff.
 $(call inherit-product, vendor/lineage/config/common_full_phone.mk)

-# Inherit device configuration
-$(call inherit-product, $(LOCAL_PATH)/core33g.mk)
-
 ## Device identifier. This must come after all inclusions
 PRODUCT_DEVICE := core33g
 PRODUCT_NAME := lineage_core33g
diepquynh commented 6 years ago

Same. Everything in makefile will be sorted and built with its dependencies anyway

enriquezmark36 commented 6 years ago

Hmm.. that's weird. I mean yeah everything still gets to be built but I think there's a difference.

The PRODUCT_BOOT_JARS makefile variable has changed, from having something like "telephony-ext" as the first element to having "core-oj" as the first element and "telephony-ext" as the last element. I believe this has a big impact since in the core.mk from build/target/product/core_minimal.mk states that:

# The order of PRODUCT_BOOT_JARS matters.
PRODUCT_BOOT_JARS := \
    core-oj \
    core-libart \

You could try adding a line in build/core/dex_preopt_libart.mk that prints this variable to confirm the ordering changes when the includes in lineage.mk are rearranged:

--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -88,6 +88,8 @@ endef

 # note we use core-libart.jar in place of core.jar for ART.
 LIBART_TARGET_BOOT_JARS := $(patsubst core, core-libart,$(DEXPREOPT_BOOT_JARS_MODULES))
+$(info PRODUCT_BOOT_JARS = $(LIBART_TARGET_BOOT_JARS))
+
 LIBART_TARGET_BOOT_DEX_LOCATIONS := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),/$(DEXPREOPT_BOOT_JAR_DIR)/$(jar).jar)
 LIBART_TARGET_BOOT_DEX_FILES := $(foreach jar,$(LIBART_TARGET_BOOT_JARS),$(call intermediates-dir-for,JAVA_LIBRARIES,$(jar),,COMMON)/javalib.jar)

In my early testing in Nougat, well with WITH_DEXPREOPT set to true and after connecting to WiFi, it still works and no crashes. P.S. I'm so sorry if the patches doesn't work right off the bat. I'm writing the patches on the run since I sort of borked my source trees for android M to O by making them share the same .repo directory.