Block app installation

Search This thread

TramSK

Member
Apr 8, 2017
44
1
Bratislava
yeapguy.gq
Hello,
I have a daughter and she's using the Galaxy S2, with LineageOS 16 (Android 9) as her phone. I want to block app installation from unknown sources completely, since this is a security threat and she can install anything. I've scavenged Google for about 2 hours and can't find a way to block app installation, even with root.
  • Uninstalling the PackageInstaller isn't a way, that puts the phone in a bootloop (since PackageInstaller is also used for managing permissions from Android 6)
  • Disabling unknown sources in the settings isn't enough, since when you open an APK file, it opens a dialog which links you to the settings option
  • I don't want to lock the entire settings with an AppLock since she needs to access Wi-Fi and other settings

Is there any way to do this?
Blocking certain file types or downloading them would be enough, but I can't find a way to do that either.
Thanks.
 
D

Deleted member 1890170

Guest
You can use the Play Store's parental controls to restrict or block app installation on the Android device.

Using your child's device, open the Play Store app and tap the menu in the top left corner. Choose Settings and then Parental controls, and turn on the controls. Choose a PIN your kids won't know and tap the kind of content – in this case, apps and games – you want to restrict. Essentially, you've set a password for Google Play free downloads.

Aside from basic downloading, you also want to restrict paid apps and in-app purchases. Apps specifically targeted at kids 12 and under already block unauthorized purchases, but to make it universal, you need to go back to the main Parental Controls menu and choose Require authentication for purchases. Set it to All purchases, which means your PIN must be entered for any purchase.
 
D

Deleted member 1890170

Guest
No, that's not what I want. She doesn't have Play Store on the device, just the browser, through which she can download .apk files to install apps.
If device is rooted another option is to freeze both the Android's "Package Installer" app ( com.android.packageinstaller ) and "Package Manager" - what is an Android service: "Packet Manager" service gets invoked by "Package Installer" app.
 
D

Deleted member 1890170

Guest
Nope, that's unfortunately not possible. ADB doesn't allow that:
Code:
java.lang.SecurityException: Shell cannot change component state for com.android.packageinstaller/null to 2
The ADB command - as an example above shown by me - should work, if the Android device is rooted means run in superuser-mode ( aka ROOT ). Sorry I forgot to mention it: Didn't know you aren't familiar with this.
 

TramSK

Member
Apr 8, 2017
44
1
Bratislava
yeapguy.gq
Wait, perhaps I could disable a specific activity of PackageInstaller? Would that work? I can't find any info on that online, just that you can also disable an activity by doing
Code:
adb shell pm disable <package>/.<activity>
 
Last edited:
D

Deleted member 1890170

Guest
Wait, perhaps I could disable a specific activity of PackageInstaller? Would that work? I can't find any info on that online, just that you can also disable an activity by doing
Code:
adb shell pm disable <package>/.<activity>
I think you've to revoke app's permission "INSTALL_PACKAGES"
pi-manifest-ss.jpg

Code:
adb shell pm revoke com.android.packageinstaller android.permission.INSTALL_PACKAGES
FYI: Haven't tried it.
 

SmartestKen

Member
Jun 29, 2021
5
0
Any solutions found? It is like I went through all those commands in exact same order and then I found this post.....
 

SmartestKen

Member
Jun 29, 2021
5
0
Working?:
adb shell pm disable com.android.packageinstaller/.PackageInstallerActivity

If the name ever changes, I think we can always use the following to obtain the new component name?
adb shell dumpsys activity activities | grep mResumedActivity

No effect:
adb shell appops set com.android.packageinstaller RUN_IN_BACKGROUND deny


Bootloop:
adb shell cmd package hide com.android.packageinstaller
 
Last edited:

joke19

Senior Member
Feb 23, 2012
1,633
248
Xiaomi Redmi Note 7
Samsung Galaxy S21
Working?:
adb shell pm disable com.android.packageinstaller/.PackageInstallerActivity

If the name ever changes, I think we can always use the following to obtain the new component name?
adb shell dumpsys activity activities | grep mResumedActivity

No effect:
adb shell appops set com.android.packageinstaller RUN_IN_BACKGROUND deny


Bootloop:
adb shell cmd package hide com.android.packageinstaller
And what is with one of this steps?
 

jzwalliser

New member
Jun 27, 2023
1
0
Do you have root access on your phone/tablet? Since you cannot block app installation, you can try to make an app that uninstalls any new installed apps right after the installation.