[PixelExperience] Add own app as system app in custom build - Android Q&A, Help & Troubleshooting

hi, i want to build my custom rom from the source of PixelExperience with my app included as system app.
I already built the rom and flashed it with success on my asus x00dt.
what i tried to include my app as system app on the rom:
- added folder ./packages/apps/MyApp
- copied my.awesome.app.apk to folder
- created Android.mk in same folder with following content
Makefile:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := MyApp
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := my.awesome.app.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)
when i build and flash the rom the app is "not installed". but i can see the folder and app under /system/app
also when i run "pm list packages" i dont see it in the list.
Could you guys help me adding the app to my custom rom?
EDIT:
I also created an entry in build\make\target\product\handheld_product.mk
PRODUCT_PACKAGES += \
MyApp
i could not find core.mk or common.mk which was mentioned in other posts (here: https://stackoverflow.com/questions/10579827/how-do-i-add-apks-in-an-aosp-build)
EDIT 2:
Seems like a signing issue. If i dont sign my app and use LOCAL_CERTIFICATE := platform it works.

Related

[Q] Building a specific apk from CM7 sources

i was trying to build framework-res.apk
i went into android_frameworks_base/core/res from terminal
theres an Android.mk file there:
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_NO_STANDARD_LIBRARIES := true
LOCAL_PACKAGE_NAME := framework-res
LOCAL_CERTIFICATE := platform
# Tell aapt to create "extending (non-application)" resource IDs,
# since these resources will be used by many apps.
LOCAL_AAPT_FLAGS := -x
LOCAL_MODULE_TAGS := optional
# Install this alongside the libraries.
LOCAL_MODULE_PATH := $(TARGET_OUT_JAVA_LIBRARIES)
# Create package-export.apk, which other packages can use to get
# PRODUCT-agnostic resource data like IDs and type definitions.
LOCAL_EXPORT_PACKAGE_RESOURCES := true
include $(BUILD_PACKAGE)
# define a global intermediate target that other module may depend on.
.PHONY: framework-res-package-target
framework-res-package-target: $(LOCAL_BUILT_MODULE)
and then i did
make framework-res
make: *** No rule to make target `framework-res'. Stop.
can u help me with the process? im just a beginner.

Compiling android - trying to add XML files to /system/etc/permissions

I'm compiling android from source. I've set up the environment, and tested the builds. Everything works fine.
My current objective is to add 10 custom xml files to /system/etc/permissions. I've tried modifying the Android.mk file in frameworks/base/data/etc to include the files, but the additions aren't appearing in the compiled system. What's strange is that the default files that were in the same folder and already in the makefile appear, so the makefile seems to be read and parsed at compile.
This is the code I'm using:
Code:
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := [B]default_file_already_present.xml[/B]
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := [B]my_custom_file.xml[/B]
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
For some reason, my_custom_file is not added, while the default_file_already_present is. Any ideas?
I've searched around, but can't find any decent documentation. I feel like I’m very close, so any help is much appreciated!
tl;dr - Adding files to system partition with makefile partially fails.
Solution!
For those who also run in to this problem:
As per Jean-Baptiste Quéru's post on a google group;
The Android makefiles are essentially split into 2 primary categories,
parsed in this order.
-the product definitions, which specify what modules need to be
installed for each product.
-the module definition, which specify how to build each module.
The build system protects itself against situation where you modify
the product definition from a module definition. PRODUCT_COPY_FILES is
part of the product definition, and can't be modify from a module
definition.
JBQ
Click to expand...
Click to collapse
What this means is that in order to copy files as is to the system image, we need to use product definitions.
What I did was first run ./build/envsetup.sh, in order to get access to commands like mgrep, etc.
I noticed that in frameworks/base/data/keyboards there was a keyboards.mk file, which got included correctly.
I made a copy and modifies it to suit my needs:
Code:
# Copyright (C) 2010 The Android Open Source Project
#
blah blah blah...
#
# This is the list of custom permissions to be injected in /system/etc/permissions
permissionsfiles := \
android.hardware.camera.front.xml \
android.hardware.usb.accessory.xml \
android.hardware.usb.host.xml \
android.hardware.wifi.direct.xml \
android.hardware.wifi.xml \
android.software.sip.voip.xml \
com.google.android.maps.xml \
com.google.android.media.effects.xml \
com.google.widevine.software.drm.xml \
handheld_core_hardware.xml \
platform_plus.xml \
features.xml
PRODUCT_COPY_FILES := $(foreach file,$(permissionsfiles),\
frameworks/base/data/etc/$(file):system/etc/permissions/$(file))
I ran "mgrep keyboards" and noted which makefiles included the keyboards.mk file, then I opened each file and duplicated that line, modifying it to instead include my custom_permissions.mk located in frameworks/base/data/etc/.
I compiled and the files were all there.
Hope this helps.

Compiling android - trying to add XML files to /system/etc/permissions

I'm compiling android from source. I've set up the environment, and tested the builds. Everything works fine.
My current objective is to add 10 custom xml files to /system/etc/permissions. I've tried modifying the Android.mk file in frameworks/base/data/etc to include the files, but the additions aren't appearing in the compiled system. What's strange is that the default files that were in the same folder and already in the makefile appear, so the makefile seems to be read and parsed at compile.
This is the code I'm using:
Code:
LOCAL_PATH := $(my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := [B]default_file_already_present.xml[/B]
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
include $(CLEAR_VARS)
LOCAL_MODULE := [B]my_custom_file.xml[/B]
LOCAL_MODULE_CLASS := ETC
LOCAL_MODULE_PATH := $(TARGET_OUT)/permissions
LOCAL_SRC_FILES := $(LOCAL_MODULE)
include $(BUILD_PREBUILT)
For some reason, my_custom_file is not added, while the default_file_already_present is. Any ideas?
I've searched around, but can't find any decent documentation. I feel like I’m very close, so any help is much appreciated!
tl;dr - Adding files to system partition with makefile partially fails.
Solution!
For those who also run in to this problem:
As per Jean-Baptiste Quéru's post on a google group;
The Android makefiles are essentially split into 2 primary categories,
parsed in this order.
-the product definitions, which specify what modules need to be
installed for each product.
-the module definition, which specify how to build each module.
The build system protects itself against situation where you modify
the product definition from a module definition. PRODUCT_COPY_FILES is
part of the product definition, and can't be modify from a module
definition.
JBQ
Click to expand...
Click to collapse
What this means is that in order to copy files as is to the system image, we need to use product definitions.
What I did was first run ./build/envsetup.sh, in order to get access to commands like mgrep, etc.
I noticed that in frameworks/base/data/keyboards there was a keyboards.mk file, which got included correctly.
I made a copy and modifies it to suit my needs:
Code:
# Copyright (C) 2010 The Android Open Source Project
#
blah blah blah...
#
# This is the list of custom permissions to be injected in /system/etc/permissions
permissionsfiles := \
android.hardware.camera.front.xml \
android.hardware.usb.accessory.xml \
android.hardware.usb.host.xml \
android.hardware.wifi.direct.xml \
android.hardware.wifi.xml \
android.software.sip.voip.xml \
com.google.android.maps.xml \
com.google.android.media.effects.xml \
com.google.widevine.software.drm.xml \
handheld_core_hardware.xml \
platform_plus.xml \
features.xml
PRODUCT_COPY_FILES := $(foreach file,$(permissionsfiles),\
frameworks/base/data/etc/$(file):system/etc/permissions/$(file))
I ran "mgrep keyboards" and noted which makefiles included the keyboards.mk file, then I opened each file and duplicated that line, modifying it to instead include my custom_permissions.mk located in frameworks/base/data/etc/.
I compiled and the files were all there.
Hope this helps.

[Q] App not visible after adding to AOSP

I am working with AOSP. I downloaded the Gingerbread 2.3.7 code and compiled successfully. Now I added an apk in the system/apps/ folder. After running make it is compiled successfully and the installed-files.txt contain the name of apk I included. But once I run the emulator after replacing the system.img, user.img and ramdisk generated in the out folder, I am unable to see the app in emulator anywhere.
Makefile
LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS)
# Module name should match apk name to be installed.
LOCAL_MODULE := ThemeChooser
LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT

Port MultiRom v32 To your G3 Device

Note:
I noticed alot more people have been using MultiRom, So I decided to make a really simple basic How to guide for people who pretty much already know what they are doing.
Step #1, you need the omni source tree, I use Omni-lp5.1.1, But to use that, you will need to make some changes to your device tree, like g3-common and qcomm_common,
Only thing you will be doing to those to device tree sections, in g3-common you will remove the "liblight" directory. and in the qcomm_common Dir, you will remove The "power" Directory.
reason for that, because its already defined in hardware.. The above is only if you decide to use Omni LP trees.
If you use the Normal Omni KitKat 4.4.4, Then you dont have to remove anything.. should work right out of the box.
If using Omni 4.4.4, you can use your device from: https://github.com/TeamWin,
if your using Omni LP you can use your own device tree that works with LP..
Ok now for the code part:
open your BoardConfig.mk
and enter this at the bottom:
Code:
# Edited for TWRP Recovery
DEVICE_RESOLUTION := 1440x2560
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TW_NO_USB_STORAGE := true
TW_INCLUDE_JB_CRYPTO := true
TW_INCLUDE_CRYPTO := true
BOARD_SUPPRESS_SECURE_ERASE := true
RECOVERY_SDCARD_ON_DATA := true
BOARD_HAS_NO_REAL_SDCARD := true
TW_BRIGHTNESS_PATH := "/sys/devices/mdp.0/qcom\x2cmdss_fb_primary.175/leds/lcd-backlight/brightness"
TW_MAX_BRIGHTNESS := 255
TW_SCREEN_BLANK_ON_BOOT := true
# TW_NO_SCREEN_TIMEOUT := false
# MultiROM
MR_INPUT_TYPE := type_b
MR_INIT_DEVICES := device/lge/d851/multirom/mr_init_devices.c
MR_RD_ADDR := 0x2200000
MR_DPI := xhdpi
MR_DPI_MUL := 1.5
MR_FSTAB := device/lge/d851/twrp.fstab
MR_KEXEC_MEM_MIN := 0x0ff00000
MR_KEXEC_DTB := true
MR_USE_MROM_FSTAB := true
MR_DPI_FONT := 420
MR_DEFAULT_BRIGHTNESS := 80
#MR_CONTINUOUS_FB_UPDATE := true
#MultiRom Hooks, So that we can run stock roms as secondary
MR_DEVICE_HOOKS := device/lge/d851/mr_hooks.c
MR_DEVICE_HOOKS_VER := 4
Of course change your device name and locations.
You will need to make changes to omni_(your device).mk (AKA cm_(your device).mk
and add this to it:
Code:
# Copy needed files to make everything work for recovery
PRODUCT_COPY_FILES += \
# device/lge/d851/kernel:kernel \
device/lge/d851/img_info:img_info \
device/lge/d851/postrecoveryboot.sh:recovery/root/sbin/postrecoveryboot.sh \
device/lge/d851/sign:recovery/root/res/sign
PRODUCT_COPY_FILES += device/lge/d851/fstab.g3:recovery/root/fstab.g3
PRODUCT_COPY_FILES += device/lge/d851/twrp.fstab:recovery/root/etc/twrp.fstab
PRODUCT_NAME := omni_d851
PRODUCT_DEVICE := d851
PRODUCT_BRAND := LG
PRODUCT_MODEL := G3
PRODUCT_MANUFACTURER := LG
Im not going to tell you how to get your own fstab. you should already know that.
You will need this for your hooks file: mr_hooks.c
I am sure you can see the location that it will go into, you can change it to meet your device spec.
Now read this for the rest of the way: https://github.com/Tasssadar/multirom/wiki/Porting-MultiROM
I already created a patch that works very well with the latest MultiRom: D851-CM_hardboot_kexec_kernel.patch
Yes the patch says D851, but its for the G3 kernel which all models use. And yes, it will work with CM based and stock based. If anything you will have to change the config file settings
to match the ones for your device config. This one is set for the d851_defconfig.. So just point it to your config when it asks.
Command to run patch from terminal: patch --verbose -p1 < patch/D851-CM_hardboot_kexec_kernel.patch
Yes when you copy it over, place it in its own dir called patch from your kernel tree.
or if you rather take an already patched kernel: 777Kernel-patched Branch "Testing"
Above kernel was patched by me with pemish from @777jon, I did remove his patch created by @Skin1980 since it didnt work well with todays MultiRom
and I added in mine.. I also made some changes to allow Sabermod 5.1 and 6.0 to compile it.
Ok this is it for me, I told you it was a quick guide for people that already know what they are doing. I am no good at teaching. I wrote this really quick so that others
can have the ability to get MultiRom running on their device (Developers)..
I will only answer questions from Developers that plan on porting to thier device and make it public.
any1 working on this?
I honestly forgot that I posted this. I do hope that some are working on this for their device.
I just dont have the time to port over to every single G3 family device......

Categories

Resources