BCR icon indicating copy to clipboard operation
BCR copied to clipboard

Add `Android.mk` for building the app together with the rest of the system

Open SigmaBonder opened this issue 2 years ago • 7 comments
trafficstars

If it's maintained in the repo, it won't have to be kept up to date manually (obviously) or - what's worse - the app wouldn't have to be compiled separately.

SigmaBonder avatar Dec 08 '22 10:12 SigmaBonder

I will be working on putting this app while building my custom ROM. I will initially place the apk with permissions xml file, if it works I will change the apk to codebase and create the android.mk file.

MuhammadZohair avatar Jan 10 '23 06:01 MuhammadZohair

I just integrated BCR in my custom grapheneOS13 ROM. Starting from the release zip file you can quickly integrate the app in this way: (where ~/myandroid is the Android source folder, ~/BCR-release the unzipped BCR release file) mkdir -p ~/myandroid/platform/external/BCR/prebuilt cp ~/BCR-release/system/etc/permissions/privapp-permissions-com.chiller3.bcr.xml ~/myandroid/platform/external/BCR/com.chiller3.bcr_permission.xml cp ~/BCR-release/system/priv-app/com.chiller3.bcr/app-release.apk ~/myandroid/platform/external/BCR/prebuilt/BCR.apk create ~/myandroid/platform/external/BCR/Android.mk:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)
LOCAL_MODULE := com.chiller3.bcr_permission.xml
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_TAGS := optional
LOCAL_PRODUCT_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_ETC)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)

include $(CLEAR_VARS)
LOCAL_MODULE := BCR
LOCAL_MODULE_CLASS := APPS
LOCAL_PRIVILEGED_MODULE := true
LOCAL_PRODUCT_MODULE := true
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := prebuilt/BCR.apk
LOCAL_OPTIONAL_USES_LIBRARIES := androidx.window.extensions androidx.window.sidecar
LOCAL_REQUIRED_MODULES := com.chiller3.bcr_permission.xml
include $(BUILD_PREBUILT)

then add BCR to the build target, for example in Android 13 you can add it in ~/myandroid/build/target/product/handheld_product.mk under PRODUCT_PACKAGES

Gibbio avatar Jan 10 '23 09:01 Gibbio

I did almost the same for my OS but the OS is now in bootloop maybe there is a permission which I am missing

MuhammadZohair avatar Jan 10 '23 12:01 MuhammadZohair

This issue is not about adding BCR's prebuilt APK to a custom AOSP build, which is simple. It's about building it with the rest of the OS. If you have troubles integrating it with your builds in prebuilt form, I would suggest to ask for help somewhere else, in order to not water down this particular issue. Thanks!

SigmaBonder avatar Jan 10 '23 12:01 SigmaBonder

@SigmaBonder Would you mind sharing your Android.mk file and instructions for including BCR in the build process?

Xeboc avatar Jul 09 '23 19:07 Xeboc

I haven't tried to do this, yet, actually. I'm not sure that building it together brings that many benefits anymore. But if you want to do this, I believe that you should look into Soong build system instead (Android.bp files). I've seen that it got better over time and it might actually be possible to do it, even though it won't be as easy as Gradle.

SigmaBonder avatar Jul 11 '23 08:07 SigmaBonder