[Android Software Development] cernekee:
I installed BlankStore under /system/app on KitKat, set mode 0644, and rebooted, but it still does not have the rights to call the installPackage() API after downloading the apk:

E/AndroidRuntime( 3399): FATAL EXCEPTION: main
E/AndroidRuntime( 3399): Process: com.android.vending, PID: 3399
E/AndroidRuntime( 3399): java.lang.SecurityException: Neither user 10061 nor current process has android.permission.INSTALL_PACKAGES.
E/AndroidRuntime( 3399):	at android.os.Parcel.readException(Parcel.java:1461)
E/AndroidRuntime( 3399):	at android.os.Parcel.readException(Parcel.java:1415)
E/AndroidRuntime( 3399):	at android.content.pm.IPackageManager$Stub$Proxy.installPackage(IPackageManager.java:2555)
E/AndroidRuntime( 3399):	at android.app.ApplicationPackageManager.installPackage(ApplicationPackageManager.java:1045)
E/AndroidRuntime( 3399):	at com.android.vending.BlankPackageInstaller.installPackage(BlankPackageInstaller.java:126)
E/AndroidRuntime( 3399):	at com.android.vending.BlankStore.startInstallApp(BlankStore.java:233)
E/AndroidRuntime( 3399):	at com.android.vending.BlankStore.startInstallApp(BlankStore.java:229)
E/AndroidRuntime( 3399):	at com.android.vending.BlankStore.onDownloadAppDone(BlankStore.java:156)
E/AndroidRuntime( 3399):	at com.android.vending.tasks.AppDownloadTask.onPostExecute(AppDownloadTask.java:110)
E/AndroidRuntime( 3399):	at com.android.vending.tasks.AppDownloadTask.onPostExecute(AppDownloadTask.java:1)
E/AndroidRuntime( 3399):	at android.os.AsyncTask.finish(AsyncTask.java:632)
E/AndroidRuntime( 3399):	at android.os.AsyncTask.access$600(AsyncTask.java:177)
E/AndroidRuntime( 3399):	at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645)
E/AndroidRuntime( 3399):	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 3399):	at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 3399):	at android.app.ActivityThread.main(ActivityThread.java:4998)
E/AndroidRuntime( 3399):	at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 3399):	at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime( 3399):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
E/AndroidRuntime( 3399):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:593)
E/AndroidRuntime( 3399):	at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 779): Force finishing activity com.android.vending/.BlankActivity

I repeated the exact same installation procedure on a JB 4.3 device and it worked fine.

There were some recent changes to the AOSP frameworks/base repo involving permissions on system apps, but it isn't yet clear to me how they affect BlankStore. In both 4.3 and 4.4, the Settings app does not list the INSTALL_PACKAGES permission - yet in 4.3 BlankStore is still able to install packages.

It might be helpful to rebuild both ROMs with instrumentation to figure out where they diverge. Maybe starting by enabling DEBUG* in PackageManagerService.java and ActivityManagerService.java.

The non-root, non-system F-Droid app uses intents instead of hidden APIs to install and uninstall packages. What are the pros and cons of applying this approach to BlankStore?

I was able to build BlankStore by creating a new "android-16-internals" API under $ANDROID_HOME/platforms, using these instructions as a starting point. This resolved the various @ hide constants and methods that are missing in the standard SDK.

A different approach might involve using reflection to invoke the internal methods. One advantage is that it allows for building the app without a modified version of the SDK. So it will be easier for new developers to participate in the project. And it simplifies the process of enabling automated builds like what we set up for AFWall.

What do you think?