Android’s underlying kernel is based on Linux, but it has been customized to suit Google’s directions. There is no support for the GNU libraries and it does not have a native X Windows system. Inside the Linux kernel are found drivers for the display, camera, flash memory, keypad, WiFi and audio. The Linux kernel serves as an abstraction between the hardware and the rest of the software on the phone. It also takes care of core system services like security, memory management, process management, and the network stack.
Installing apps on your Android device is an absolute breeze. Just search for the app on the Play Store and click on the Install button. You can install it either as system apps or as user apps.
What is System App?
In simple words “The App which came as pre-installed or as a system.img (AOSP system image as an android OS), called system App. System apps can easily access some platform(app-framework) level API call”.
System apps are pre-installed apps in the system partition with your ROM. In other words, a system app is simply an app placed under /system/app folder on an Android device.
/system/app is a read-only folder. Android device users do not have access to this partition. Hence, users cannot directly install or uninstall apps to/from it.
Apps such as camera, settings, messages, Google Play Store, etc. come pre-installed with the phone and manufacturers do not generally provide an option to remove such apps as this might impact the functioning of your device. If you want to remove a system app you need to root your device first.
What is a Non-System APP?
Non-system/third-party/User apps are apps downloaded from Google Play Store or sideloaded with an APK file.
A non-system app is installed under /data/app folder and has read, write privileges. If there are apps that you have installed but you no longer use, you can simply uninstall them to free up storage space.
Difference between the normal app and system app
- A System application is NOT an application that is signed by the OS’s platform signatures. This is a common mistake believed by many and we shall come to this later on. A System application is merely an application that is placed under /system/app folder in an Android device. An application can only be installed in that folder if we have access to the OS’s ROM (system.img). The application is placed under /app folder after the ROM has been extracted. A device which loads the custom ROM will have the new System application added. The benefit of a System application is that the application cannot be removed from the device (cannot be uninstalled by the user). This is only because /system/app is a read-only folder. A non-System application is an ordinary application, which will be installed under /data/app folder, and which is read-write. A user can uninstall such applications normally from the Settings application. One can check if an application is a System application or not using “ApplicationInfo.FLAG_SYSTEM”. If the constant returns true, then the application in question is a System application.
- Permission: System apps are granted the ability to request certain system-only permissions that are never available to user apps. This is not the same as root/sudo/su permissions. One example that I know of and use daily is the ability to reset the missed call notification counter. I have Go Dialer, which is a replacement for the stock dialer and contact app (how you make phone calls). When I miss a call, android lets me know that with a notification. However, Go Dialer is not allowed to reset this counter, even though it asks for that permission when you install the app. Android 2.2 and earlier let user apps reset it, but made this permission system-only accessible permission for android 2.3
- Updates: System apps can be updated just like user apps, but the update is never integrated into the original rom. That is, system apps have the unique ability to roll back to the version that existed when the rom was first installed.
- Moved to SD: Android lets users move
userapps from internal memory to the sd card. System apps cannot be moved and always take up some internal space. Most (all?) devices, though, have internal user apps on a different partition, so uninstalling a system app would not give you any more user app space (other than the Dalvik-cache being removed).
To see the complete list of user apps in android device type below command on terminal:
adb shell pm list packages -3
To see the complete list of installed system apps type below command on the terminal:
adb shell pm list packages -s
Note: Make sure adb installed and android device connected to the computer.
Advantages of System apps over User apps
Google provides limited permissions on user apps. We cannot use various permissions, especially at the system level. With system apps, we can get additional permissions for our application. For example, we want to make an application that is able to install other applications (like the Google Play Store), we can get INSTALL_PACKAGES permission. We can also restart our Android device with REBOOT permissions. In addition, we can set the time on our Android system with SET_TIME permissions.
To see more lists of permissions on our Android device, please type the command below the computer terminal.
adb shell pm list permissions -g
How to make system apps?
The mandatory thing to do with our application is to add android: sharedUserId = “android.uid.system” in the application tag in AndroidManifest.xml.
Then build the APK of our Android project that is ready. After that, just place the APK file in the directory / system / app / or for Android versions of KitKat and above, it can go to the / system / priv-app / director
The first is to use a signing key. Signing key consists of 2 files, namely certificate (.pem) and private key (.pk8). The signing key here must be the same as the one used for signing our Android ROM. SO signing key is always specific to OEM’S(Samsung, Nokia etc.) And as I explained above, that system apps use permissions at the system level, so potentially people will create dangerous malware for Samsung devices. So keep it a secret for the trusted developer.
But if we have our own custom ROM, or then we can actually get our Android ROM signing key. We can sign the APK we can use the method below. The signapk.jar file can be found here.
java -jar signapk.jar certificate.pem key.pk8 file-name.apk file-name-signed.apk
Then install the name-file-signed.apk on your Android device as usual. The Android system will automatically recognize it as system apps because it has the same signing key as the ROM and then places it in the partition / system.
There are two ways to create system apps:
- Have source code
- Have .apk Only
Step 1 Create a folder inside packages/apps/
First, create a folder for your app ( Let say MyTestApp) inside packages/apps/ of your android AOSP downloaded source code. Then create a Android.mk file inside the folder(MyTestApp), and in last copy your app source code inside the folder(MyTestApp) as for example following folder and file
- src and
- AndroidManifest.xml etc
Step 2 open Android.mk file and add folowing code Snippet
LOCAL_PATH:= $(call my-dir)
LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)
LOCAL_CERTIFICATE := platform LOCAL_SRC_FILES
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_PACKAGE_NAME := MyTestApp
LOCAL_PROGUARD_ENABLED := disabled
LOCAL_PRIVILEGED_MODULE := true
LOCAL_STATIC_JAVA_LIBRARIES := libarity android-support-v4
include $(call all-makefiles-under,$(LOCAL_PATH))
save this mk file.
Step 3 put your app name in build/target/product/ folder open core.mk file from build/target/product/ folder and add your app name(MyTestApp) in
PRODUCT_PACKAGES tag at the bottom MyTestApp.
Note:-for the specific vendor, you can find the path like this vendor/manufacturer/device/vendor_device.mk
Now step by step procedure for .apk file
Step 1 will be same like above only change is that in place of src, res folder just put your .apk file.
step 2 open Android.mk file and add folowing code Snippet
LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)LOCAL_MODULE_TAGS := optional
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_MODULE_PATH := $(TARGET_OUT_APPS)LOCAL_MODULE := MyTestAppLOCAL_SRC_FILES := $(LOCAL_MODULE).apkLOCAL_MODULE_CLASS := APPSLOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
# if Apk is signed then use it. Otherwise use platform
LOCAL_CERTIFICATE := PRESIGNED include $(BUILD_PREBUILT)
Step 3 will be the same as an above mention for Android source code (a)
This is all about how to make an android app as a system App.
If you an apk file and wants to install a system app through adb commands, in that case, we have to push the .apk to the phone to the System partition. the path of the folder is /system/app or /system/priv-app (Android 4.3) using adb
adb push <file name> .apk / system / priv-app /
adb shell chmod 644 / system / priv-app / <file name> .apk
If SD card, then place your apk file in sdcard like this:
adb push my-app.apk /sdcard/
mv my-app.apk /system/app
# or when using Android 4.3 or higher
mv my-app.apk /system/priv-app
Note: All System-Apps need to have the permissions rw-r — r — . So we can change them via adb with the change mode command like chmod 644 /path_to/your_file
In this article, I have written about the system apps. I will write some more useful articles subjected to android so to know about that please keep following and clapping if you liked it.
I hope you enjoyed this session. If you have any comments or questions, please join the forum discussion below!
To have a look for other articles, PFA link:
Budhdi Sharma — Medium
Read writing from Budhdi Sharma on Medium. An Android developer is responsible for developing a framework and system…
Thanks for the support :)