Tag Archives: android development

Easy way to add custom packages to a LineageOS4MicroG ROM

So you have figured out how to build your own custom ROM using Docker…if not click here.
Once you have become an expert at it you would want to add a custom touch to the build. I realized that I was downloading a few apps which I wanted to use. For example – twitter, whatsapp, nextcloud and so on. Now remember these are apps which are not going to be installed by default as they are owned by different organizations and due to licensing issues they cannot and will not be a part of any Lineage ROM that you will download officially from the web. So what do you do?

Simple you add the apk’s to your custom build. Remember as long as you are not going to going to distribute it online you should be ok because as mentioned these applications are licensed to different organizations and not open source.

Steps to add a custom apk to your ROM.

Please note : This method works on the docker setup environment.

Step 1:

Download the apk (s) of your choice. For e.g. say I downloaded nextcloud , Nextcloud notes and twitter apks.

Step 2:

Create a folder with the apk name for e.g. NextCloud or Notes. Something short and simple.

Step 3:

Copy paste the downloaded apk into the folder. Remember to download the correct apk to the designated folder 🙂

Step 4:
Change the name of the apk file. For e.g. the name of the NextCloud apk is com.nextcloud.client_3.3.0-30030099_minAPI14(arm64-v8a,armeabi,armeabi-v7a,x86,x86_64)(nodpi)_apkmirror.com.apk!!!! (download it yourself if you think I am joking)
Rename the apk to something simple for e.g. NextCloud.apk
Do not worry renaming will not impact your build.
Step 5:

Add an Android.mk file with text like below to each of the folders. The below is the sample I always use.
Two values need to be changed in this file.
One the LOCAL_MODULE and the other the LOCAL_SRC_FILES.
For e.g from the below example the words FDroid and Fdroid.apk need to be replaced by the apk folder name and the apk name. If I am adding the NextCloud apk then the value for LOCAL_MODULE will be the folder name i.e. NextCloud and the value for LOCAL_SRC_FILES would be NextCloud.apk.

Similarly you have to create Android.mk files for each of the apks that you are adding.

Each folder will have one apk file and one Android.mk file with the below contents

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := FDroid
LOCAL_SRC_FILES := FDroid.apk
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
LOCAL_CERTIFICATE := PRESIGNED
include $(BUILD_PREBUILT)

Step 6:

Now make a few additions to the following file

vendor/lineage/config/common.mk

Browse down to the PRODUCT_PACKAGES +=

The default line may look like this – (your file would be different from this these are just samples)

PRODUCT_PACKAGES += FDroid GmsCore GsfProxy FakeStore MozillaNlpBackend NominatimNlpBackend com.google.android.maps.jar FDroid FDroidPrivilegedExtension

Add the names of the custom packages you have added to make it look something like this

PRODUCT_PACKAGES += FDroid Flym GmsCore GsfProxy FakeStore MozillaNlpBackend NextCloud NominatimNlpBackend Notes com.google.android.maps.jar FDroid FDroidPrivilegedExtension Telegram Twitter WhatsApp WordPress

save the common.mk

Copy the complete list of packages as you would need it in the next step

Step 7: Pass the package list copied from the previous step and pass it to your docker run command for example now your command should look like …with all the custom packages being passed.

docker run \
-e “BRANCH_NAME=lineage-15.1” \
-e “DEVICE_LIST=tissot” \
-e “SIGN_BUILDS=true” \
-e “CCACHE_SIZE=100G” \
-e “SIGNATURE_SPOOFING=restricted” \
-e “CUSTOM_PACKAGES=FDroid Flym GmsCore GsfProxy FakeStore MozillaNlpBackend NextCloud NominatimNlpBackend Notes com.google.android.maps.jar FDroid FDroidPrivilegedExtension Telegram Twitter WhatsApp WordPress ” \
-v “/home/username/lineageos4microg/lineage:/srv/src” \
-v “/home/username/lineageos4microg/zips:/srv/zips” \
-v “/home/username/lineageos4microg/logs:/srv/logs” \
-v “/home/username/lineageos4microg/cache:/srv/ccache” \
-v “/home/username/lineageos4microg/keys:/srv/keys” \
-v “/home/username/lineageos4microg/manifests:/srv/local_manifests” \
lineageos4microg/docker-lineage-cicd:latest

Step 8: Once the build is complete. Pick it up from the zips folder and flash on your phone.

Check all the apps you installed are running

Step 9: Congratulate yourself for having built your customized ROM!!!
Enjoy!!!

Advertisements

OEM unlocking and enabling developer options

Every wondered what Enabling OEM unlocking Developer options means? This is a simple step by step guide which will help you with enabling OEM unlocking Developer options for android phones.

In case you are wondering why you even need to do all this in the first place let us answer that as simply as is possible. You need to enable OEM unlocking and activate developer options in your android smart phone if and only if you want to install a custom ROM on your phone.
If you do not have any such plans then it is better you move to the short stories section on this website and read the stories there.

For those who dare to mess around with their smart phones read on….

Stage One: Downloading Google Platform tools

Download the latest version of the Google platform tools from the links given below. The link is the official link on the Android site. It has links for different operating systems.
https://developer.android.com/studio/releases/platform-tools
These tools are required to access the Fastboot features of your phone.

Follow the steps as described on the site to install on your PC. This is important as you would need the tools to be fully functional when running on your PC. To understand this step completely please read this post first.

If you have Google Platform tools on your PC and understand what they do then read on.

Stage Two : Enabling OEM unlocking and Developer options

Settings App

 

 

 

 

Step 1: On the smart phone go to Settings. It would be the gear shaped icon in the screen on the left.

 

Step 2: On Settings page scroll to the end of the screen to find the System link. Check image shot to the right. The system link is right at the bottom . System Link on the Settings App

 

 

 

 

 

System Screen DetailsStep 3: Open System >> Click on About Phone. Again the link is at the end of the screen. Somehow you will feel that they want us to miss these settings!

 

 

 

 

 

Step 4: Scroll to the end of the screen >> Build numberAbout Phone Screen

 

 

 

 

 

Step 5: Tap 7 times on Build number… yes, you read that right. Tap seven times on build number. By the third or fourth tap you will start getting a pop up which will mention in reverse the number of taps required out of seven!
Once you complete the mandatory seven taps  you would have enabled Developer options on the phone. If you have enabled a pattern lock it will show up to confirm it is you who want to enable Developer Options

About Phone with Developer OptionsStep 6: Go back to the System screen and now you should see a new option >>Developer options.
In the screenshot to the left see the option just above system update and below Backup.

 

 

 

 

 

Step 7: In Developer options screen select OEM unlocking. By default it would be grayed out. By selected it the option turns green!Developer Options with OEM unlocking enabled

 

 

 

 

 

 

Step 8: In Developer options screen select USB DebuggingDeveloper Options with USB Debugging enabled

That is it, you can now come back.

You have enabled USB debugging and OEM unlocking on your android smart phone.

Let the games begin 🙂

 

 

 

 

 

Read Articles on

Why install a custom ROM on a Xiaomi MiA1

OEM unlocking and enabling developer options

Unlocking the bootloader of Xiaomi phones

What are Google Platform Tools?