1

I have been trying to add a apk to priv-app.

Following are the steps i did:

Made a folder named Testapk in packages/apps Copied apk to folder with name Testapk.apk In same directory, created an Android.mk file with following contents:

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

LOCAL_MODULE_TAGS := optional
LOCAL_MODULE := Testapk
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := Testapk.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)

Then, added Testapk to /build/target/product/base_system.mk

Build is successful and i can see my apk in priv-app folder in out/target/product/sdm660_64/system/priv-app. After flashing, the device wont boot up. Its stuck on Android logo.

I am using Qualcom SDM660, the branch is android-10

If I add the apk to system/apps, i can boot and the apk works fine.

Can someone help me on this???

erik7854
  • 150
  • 1
  • 16
madinina
  • 13
  • 6

1 Answers1

2

You haven't shared the Crash Stack here. Its difficult to tell.

I could see here that Are you requesting any privileged permissions from the app side ? if yes, device will not boot until you whitelist those permissions in privileged permissions xml file which will be stored at either system/etc/permissions

Ashok Mutyala
  • 89
  • 1
  • 4
  • 1
    Hi Ashok, How can I give all permissions to the app? https://justpaste.it/8zfs2 Saganakmdm its my app – madinina Mar 21 '22 at 08:33
  • Hi madinia, Can you share the Failure stack by running the command "logcat -b crash" ? so, i will get to know the privileged permissions which you are requesting – Ashok Mutyala Mar 21 '22 at 08:49
  • https://justpaste.it/9idbp Hi Ashok this is my output log. Please check. What should i do? Thank you @Ashok Mutyala – madinina Mar 21 '22 at 10:49
  • Please include below in this file (justpaste.it/8zfs2) under "com.interprobe.saganakmdm" – Ashok Mutyala Mar 21 '22 at 11:35
  • Thank you the app is working. But I had a question for you, I want my app to never close. So I want to inactivate the force stop and disable buttons, how can I do that? – madinina Mar 21 '22 at 13:00
  • disable button is not enabled for System App and is not getting updated via server/PlayStore/ThirdPartyAppStore. Does your app falls under this ? For Force Stop, i will come back in your other question. – Ashok Mutyala Mar 21 '22 at 14:08