Saleh
Saleh

Reputation: 1931

Add an application as trusted app store when building AOSP

I am building AOSP for myself to build a custom ROM. Can I specify a system application as trusted app store (like google play on regular phones) so that app will be able to install apps silently? (without showing confirmation dialog to user)

Where in the AOSP code could this happen?

Upvotes: 0

Views: 346

Answers (1)

Rick Sanchez
Rick Sanchez

Reputation: 4756

If you're a system app, built within AOSP tree, just call installPackage directly:
http://androidxref.com/7.1.2_r36/xref/frameworks/base/core/java/android/content/pm/PackageManager.java#4790

Your app must request this permission:

 <uses-permission
        android:name="android.permission.INSTALL_PACKAGES"
        tools:ignore="ProtectedPermissions" />

Though based on the comment in code, this method is deprecated, might have gone away in newer versions of AOSP. Use the new implementation.

Upvotes: 1

Related Questions