anestisb / android-prepare-vendor

Set of scripts to automate AOSP compatible vendor blobs generation from factory images
347 stars 155 forks source link

Sailfish is unable to connect to some CDMA networks #102

Closed aaboyd closed 6 years ago

aaboyd commented 6 years ago

I noticed with the Google Pixel that I was unable to hop on the network and found a crash by DMService that was looking for these two libraries. I believe bullhead and angler included these libraries, but not sailfish.

anestisb commented 6 years ago

Thanks for reporting this @aaboyd

The two libraries you mention are part of the DMService APK

$ ls -l system/priv-app/DMService/lib/arm/
total 0
lrwxrwxrwx 1 anestisb anestisb 26 Sep 12 19:56 libdmengine.so -> /system/lib/libdmengine.so
lrwxrwxrwx 1 anestisb anestisb 30 Sep 12 19:56 libdmjavaplugin.so -> /system/lib/libdmjavaplugin.so

So technically the correct way to include them is by adding the system/priv-app/DMService/DMService.apk to Pixel config files.

In the current configs the DMService.apk is included only in the full configs and not the naked. I remember @thestinger mentioned at some point that is not required. The bit I'm confused here is that since DMService APK was never installed which app complained about the two missing libs? Have you kept any log entries to help investigate?

At any case if you noticed a broken functionality without the DMService installed I'll revert it back to the naked config.

thestinger commented 6 years ago

I don't think DMService accomplishes anything by itself.

Sprint support requires SprintDM + DMService and the other apps and acts as a remote administration backdoor for Sprint when using them as the carrier.

It's more likely to cause problems than solve them with other carriers since OMA-DM is not mandatory with Verizon, etc. but if that stuff is around it's likely to crash without anyone to get it working properly.

aaboyd commented 6 years ago

I was using the full-config. The reason I included the libraries in the naked and full configs is because that is how angler was doing it. I used that as my model. I don't have the exact error off hand, but it is DMService that can't load a library. With the changes I made, everything works fine.

anestisb commented 6 years ago

Ok let me rephrase. For the full-configs including the DMService APK (which is the current case) will automatically pick-up the two library files and include them (due to the symlink discovery logic). If for some reason they're not included when you're using the full-config then we have a bug and we have to track it and resolve it. As such, if there is no bug, there is no reason to include the two libraries in the full-configs.

For the naked configs it appears that there is no legitimate reason to include the DMService APK without including a bunch of other stuff. As such, there is no reason to include the libraries either (again for the naked configs). If you have spotted some broken functionality or crashes when using the naked configs please open a specific bug report so we can trace it and include stuff that might be missing.

Finally, as general note, it is not recommended to use the Nexus configs as a baseline for comparison. We've spent significantly more time tidying up the Pixel configs, versus the Nexus. And yes it might be worth doing the same tide-up for Nexus, although personally I don't have the time to invest at the moment.

aaboyd commented 6 years ago

For the full-configs including the DMService APK (which is the current case) will automatically pick-up the two library files and include them (due to the symlink discovery logic).

This is what I think may not be working. I am going to re-run master and my branch and see what is different in the output. Maybe I screwed something up somewhere else. Standby for some more info

For the naked configs it appears that there is no legitimate reason to include the DMService APK without including a bunch of other stuff.

I agree, I made the mistake of using the nexus configs as my baseline. Sorry about that.

aaboyd commented 6 years ago

I ran the following ( with master checked out )

./execute-all.sh --device sailfish --buildID njh47f --full --yes --output out-master/

and I am unable to find the libdmengine or libdmjavaplugin files

~/source/android-prepare-vendor
12:40 $ find out-master/ -name "libdmjavaplugin.so"

~/source/android-prepare-vendor
12:40 $ find out-master/ -name "libdmengine.so"

I can find the DMService apk

~/source/android-prepare-vendor
12:40 $ find out-master/ -name "DMService.apk"
out-master/sailfish/njh47f/vendor/google_devices/sailfish/proprietary/priv-app/DMService/DMService.apk

but the apk itself also doesn't contain those libraries

~/source/android-prepare-vendor
12:42 $ find out-master/ -name "DMService.apk" -exec unzip -l {} \;
Archive:  out-master/sailfish/njh47f/vendor/google_devices/sailfish/proprietary/priv-app/DMService/DMService.apk
  Length      Date    Time    Name
---------  ---------- -----   ----
       51  2009-01-01 00:00   assets/dm/dmt_data/managedobjects.wbxml
      945  2009-01-01 00:00   res/drawable-xxhdpi-v4/ic_swap_vertical_circle_black_24dp.png
      959  2009-01-01 00:00   res/drawable/alert_dialog_icon.png
    36648  2009-01-01 00:00   resources.arsc
    12136  2009-01-01 00:00   AndroidManifest.xml
       30  2009-01-01 00:00   assets/dm/dmt_data/acl.dat
       42  2009-01-01 00:00   assets/dm/dmt_data/acl.txt
     2912  2009-01-01 00:00   assets/dm/dmt_data/customization.wbxml
    21831  2009-01-01 00:00   assets/dm/dmt_data/customization.xml
      124  2009-01-01 00:00   assets/dm/dmt_data/devdetail_ext.wbxml
      824  2009-01-01 00:00   assets/dm/dmt_data/devdetail_ext.xml
      179  2009-01-01 00:00   assets/dm/dmt_data/devdetail_uri.wbxml
     1119  2009-01-01 00:00   assets/dm/dmt_data/devdetail_uri.xml
      464  2009-01-01 00:00   assets/dm/dmt_data/fstab
      359  2009-01-01 00:00   assets/dm/dmt_data/managedobjects.xml
    12056  2009-01-01 00:00   assets/dm/dmt_data/root.bmdf
    21051  2009-01-01 00:00   assets/dm/dmt_data/root.mdf
      858  2009-01-01 00:00   assets/dm/dmt_data/root.wbxml
     5542  2009-01-01 00:00   assets/dm/dmt_data/root.xml
      394  2009-01-01 00:00   assets/dm/dmt_data/subscriber.wbxml
     2572  2009-01-01 00:00   assets/dm/dmt_data/subscriber.xml
   118892  2009-01-01 00:00   assets/dm/dmt_data/syncmldm.ddf
     3254  2009-01-01 00:00   assets/dm/plugin/sysplugins.ini
   162648  2009-01-01 00:00   classes.dex
      560  2009-01-01 00:00   res/layout/carrier_provisioning_info.xml
      520  2009-01-01 00:00   res/layout/textinput_dialog.xml
     4612  2009-01-01 00:00   res/xml/initial_dmt.xml
     2949  2009-01-01 00:00   META-INF/CERT.SF
     1452  2009-01-01 00:00   META-INF/CERT.RSA
     2869  2009-01-01 00:00   META-INF/MANIFEST.MF
---------                     -------
   418852                     30 files

This is my first time really digging into this project, so I may be completely off here, but where are those files actually supposed to be? Is there somewhere else I should look?

anestisb commented 6 years ago

Indeed there is a bug in the scripts. The DMService symbolic links dependencies are picked-up and included in the makefile (see vendor/google_devices/sailfish/Android.mk, or the following snippet from it), although the actual .so files are not included from the copy-across logic.

I've managed to reproduce it so I'll investigate the fix it. Thanks for reporting.

include $(CLEAR_VARS)
LOCAL_MODULE := DMService
LOCAL_MODULE_TAGS := optional
LOCAL_BUILT_MODULE_STEM := package.apk
LOCAL_MODULE_OWNER := google
LOCAL_MODULE_PATH := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)/priv-app
LOCAL_SRC_FILES := proprietary/priv-app/DMService/DMService.apk
LOCAL_REQUIRED_MODULES := libdmjavaplugin_32.so libdmengine_32.so
LOCAL_CERTIFICATE := platform
LOCAL_MODULE_CLASS := APPS
LOCAL_PRIVILEGED_MODULE := true
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_DEX_PREOPT := false
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := libdmjavaplugin_32.so
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_OWNER := google
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): TARGET := /system/lib/libdmjavaplugin.so
$(LOCAL_BUILT_MODULE): SYMLINK := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)/priv-app/DMService/lib/arm/libdmjavaplugin.so
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/Android.mk
$(LOCAL_BUILT_MODULE):
        $(hide) mkdir -p $(dir $@)
        $(hide) mkdir -p $(dir $(SYMLINK))
        $(hide) rm -rf $@
        $(hide) rm -rf $(SYMLINK)
        $(hide) ln -sf $(TARGET) $(SYMLINK)
        $(hide) touch $@
include $(CLEAR_VARS)
LOCAL_MODULE := libdmengine_32.so
LOCAL_MODULE_CLASS := FAKE
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE_OWNER := google
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): TARGET := /system/lib/libdmengine.so
$(LOCAL_BUILT_MODULE): SYMLINK := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)/priv-app/DMService/lib/arm/libdmengine.so
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/Android.mk
$(LOCAL_BUILT_MODULE):
        $(hide) mkdir -p $(dir $@)
        $(hide) mkdir -p $(dir $(SYMLINK))
        $(hide) rm -rf $@
        $(hide) rm -rf $(SYMLINK)
        $(hide) ln -sf $(TARGET) $(SYMLINK)
        $(hide) touch $@
anestisb commented 6 years ago

Creates https://github.com/anestisb/android-prepare-vendor/issues/103 to track the issue. I think we can close this pull request.