How to grant priv-app (pre-build) APK permissions by default

3,275 views
Skip to first unread message

Riccardo Bruè

unread,
Aug 5, 2020, 12:56:05 PM8/5/20
to android-porting
Hi, I have a prebuild APK  which I've added in my AOSP system by adding its name on the PRODUCT_PACKAGES variable. I can successfully see my app under "/system/priv-app" folder and I've added all its permissions in the "privapp-permissions-platform.xml" file.  Now I was thinking that all the permissions (microphone access, location and external storage writing) were already granted, but I still have to grant them manually from Android settings. What can I do to fix this? Thank you.

Trần Kha

unread,
Aug 5, 2020, 3:49:02 PM8/5/20
to android-porting
Hello Riccardo,

Please set PRODUCT_PROPERTY_OVERRIDES += control_privapp_permissions=enforce to your current makefile of your product.

To check missing permission and other information related to Privileged permission, please refer this reference:

https://source.android.com/devices/tech/config/perms-whitelist

Regards,
Kha Tran

Riccardo Bruè

unread,
Aug 6, 2020, 10:22:42 AM8/6/20
to android-porting
Thank you I'll try this ASAP. One question, which is the difference between your solution "control_privapp_permissions=enforce" and this other solution "ro.control_privapp_permissions=enforce" (if any or not a typo).

Riccardo Bruè

unread,
Aug 6, 2020, 5:11:36 PM8/6/20
to android-porting
Tried your solution, stil lhave to manually grant microphone, location and external storage writings. These are the permissions in both Android manifest and in the privapp-permissions-platform.xml file:

<permission name="android.permission.RECORD_AUDIO" />
<permission name="android.permission.MODIFY_AUDIO_SETTINGS" />
<permission name="android.permission.WRITE_EXTERNAL_STORAGE" />
<permission name="android.permission.READ_EXTERNAL_STORAGE" />
<permission name="android.permission.ACCESS_COARSE_LOCATION" />
<permission name="android.permission.ACCESS_NETWORK_STATE" />
<permission name="android.permission.ACCESS_FINE_LOCATION" />

What am I missing here?
On Wednesday, August 5, 2020 at 9:49:02 PM UTC+2 khab1...@gmail.com wrote:

semw

unread,
Aug 12, 2020, 9:45:41 AM8/12/20
to android-porting
Hi ricardo ,
How did you added the apk as system app ?
Can you tell me what code you wrote in your make file ?
and in which file you added its package name ?

Riccardo Bruè

unread,
Aug 20, 2020, 1:22:55 PM8/20/20
to android-porting
Hi, in my app Android.mk I have the following content:

   LOCAL_PATH := $(call my-dir)
   include $(CLEAR_VARS)

   LOCAL_MODULE_TAGS := optional
   LOCAL_MODULE := MyApp
   LOCAL_CERTIFICATE := PRESIGNED
   LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
   LOCAL_MODULE_CLASS := APPS
   LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
   LOCAL_PRIVILEGED_MODULE := true
   TARGET_OUT_DATA_APPS_PRIVILEGED := $(TARGET_OUT_DATA)/priv-app/

   include $(BUILD_PREBUILT)

I have added the app in the build output by adding this in my board mk (android_build/device/variscite/imx8m/dart_mx8mm/dart_mx8mm.mk):

PRODUCT_PACKAGES += \
    MyApp\



Reply all
Reply to author
Forward
0 new messages