I have been asked to write a small simple app for an Android-based product. The device comes with two Android system images with different features. The app I\'m writing is
System apps (apps with shared user ID set to android.uid.system
) cannot install system updates on Android 5 and newer - it's forbidden by a SELinux policy. To be specific writing to /cache
is forbidden for system apps. In other words:
/cache
is owned by system
user so your app running under system
UID can write to it. But only if SELinux is disabled/permissive.android.permission.ACCESS_CACHE_FILESYSTEM
platform signature permission, you can write to /cache
.You'll need to remove the shared user ID. You still have to sign the app with platform signature and ensure you have the following permissions:
android.permission.REBOOT
android.permission.ACCESS_CACHE_FILESYSTEM
- to write to /cache
android.permission.RECOVERY
- required on API 21 to reboot to recoveryThis will work on Kitkat and Lollipop+ alike.