0

i have a moto x4 running on lineage OS ver. 16 that i wanna disable installation of APK'S, so after searching online i found that deleting or disabling the packageinstaller (via debloater or adb pm commands) will disable the option of installing APK'S, the issue is that it seems that if the packageinstaller is disabled then the phone cannot boot (probably the system needs the packageinstaller) and it will tell me to make a data wipe and a factory reset, so my question is as follows is it possible to disable the packageinstaller that it should not allow installation of new apps but still be enabled so the phone can boot?, or is there another way of blocking the installation of new apps?

thanks in advance

4
  • Disabling packageinstaller app wouldn't help you at all. All it would do is make the user inaccessible the user interface they see when an app is sideloaded. Apps which have privileges to install an APK (such as Play Store or an OEM market app) can continue to use packagemanager service to install apps. Similarly, you can also install apps via command-line despite packageinstaller app disabled/removed.
    – Firelord
    Mar 8, 2020 at 13:27
  • thanks but both are not an issue as i don't have any play store as i use lineage OS with microG so no gapps are installed, and about command-line that is not an issue as the user is not an android tech etc. but my question is, is there a way to do what i asked to disable the installation of apps but the phone should still boot?
    – Year1917
    Mar 8, 2020 at 13:43
  • The PackageInstaller app is just a frontend - pm itself is the package manager. When you sideload an .apk, it's pm the one which does the job.
    – Grimoire
    Mar 8, 2020 at 16:24
  • sorry gripoire can you explain better don't really know android so good
    – Year1917
    Mar 8, 2020 at 16:32

1 Answer 1

1

This question offers itself to a variety of approaches, because it seems that you are relying to an unknown extent on your user's lack of dev savvy.

A) Simplest: if your user is not an android tech, and you have no app store installed on the device, why assume that they know what an apk is and where to obtain one?

B) however, if you think that thats too simple , you can disable unknown sources and hide the setting from the user, (that should work on a reg phone, though not sure about lineage OS.) adb shell pm uninstall -k --user 0 com.android.settings.<settingName> to disable a particular setting has been known to work on some devices, you can try it on the package manager as well, as it does not remove the apk from the phone just de-registers, though a factory reset will return the setting, and you'd have to look into preventing the user from performing factory resets.

there are many approaches that would offer a similiar level of protection.

C) Therefore, (if you think a non-dev user will figure that out,) it seems that parental control apps and/or app managers would be the most complete basic level protection.

D) you can get super deep and play around with the OS - possibly recompile the package manager app.

in summary: at the end of the day android requires pm in order to function properly. the packageinstaller app that comes preloaded with your firmware is only one of the many ways to install apks on your device because it is only a UI for a native android functionality which doesnt disappear when the package installer app is removed. to fully and irreversably disable this functionality in a way that only very experienced dev cannot circumvent is a very complicated job. However an app manager or parental control solution can usually offer near complete security from an average user.

4
  • thanks!!! so what is the factory reset setting name so i can disable it as well?
    – Year1917
    Mar 9, 2020 at 3:39
  • actually not sure for your device - but be advised, user can usually still launch factory reset from recovery or by secret code in the dialer, they can also force it by removing the battery during an sdcard encryption process or such. thats why i think parental control like livagent or similiar is best for you
    – sh7411usa
    Mar 9, 2020 at 13:19
  • how can i find the setting name for my device?
    – Year1917
    Mar 9, 2020 at 13:39
  • pull the apk from you device and dump the manifest probably - but it will only work if the setting you want is set up as a separate package. if you have root level access you can pull the apk, use 7zip or similiar to delete the activity xml - and replace the apk. this is a very "dirty" route but it may work
    – sh7411usa
    Mar 22, 2020 at 5:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .