简体   繁体   中英

Building android app as AOSP app

I want to build and embed my android application in AOSP code. My objective is to grant all system level permission to my application so that i can access system level permissions.

I have added following flags in my application's AndroidManifest.xml file -

coreApp="true"
android:sharedUserId="android.uid.system"

Following is my Android.mk-

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := TestApp
LOCAL_CERTIFICATE := platform
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
include $(BUILD_PREBUILT)

But still i am not able to see my application in the installed application list!! Any idea how to do it?

It seems that you forgot to add your application into build. If you modify core files of Android (although it is not recommended) you need to modify build/target/product/core.mk file. There into the PRODUCT_PACKAGES you need to add your application.

However, to my point of view, if you want your application only to obtain access to the functionality protected with system permissions (of level signature and signatureOrSystem ) there is no need to add the line android:sharedUserId="android.uid.system" into your manifest file. This line means that your application will be run as AID_SYSTEM Linux user, meaning that your application and system server will share the same UID. As far as I remember this will allow you to bypass all permission checks becasue SYSTEM and ROOT users are granted with all the permission. Thus, I do not recommend you to add this line.

shareUserId is required for some cases not all. for example, if you need to access to the airplane mode settings in the secure settings, without the shareUserId, you will be able to change the settings but when you will need to broadcast the change to the system, it will fail silently. the broadcast will have no effect until you add the shareUserId.

As Yury said, you have to tell the build system to include you app in the system image. You can do it via build/target/product/core.mk or you can change device.mk located in device folder, for example device/lge/bullhead/device.mk and add it to PRODUCT_PACKAGES.

That way it gets picked up by the build process and included in your ROM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM