Block app installation

Search This thread

TramSK

Member
Apr 8, 2017
42
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.
 

jwoegerbauer

Senior Member
  • Jul 11, 2009
    5,225
    9
    1,273
    European Union
    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.
     

    jwoegerbauer

    Senior Member
  • Jul 11, 2009
    5,225
    9
    1,273
    European Union
    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.
     

    jwoegerbauer

    Senior Member
  • Jul 11, 2009
    5,225
    9
    1,273
    European Union
    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
    42
    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:

    jwoegerbauer

    Senior Member
  • Jul 11, 2009
    5,225
    9
    1,273
    European Union
    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.
     
    Our Apps
    Get our official app!
    The best way to access XDA on your phone
    Nav Gestures
    Add swipe gestures to any Android
    One Handed Mode
    Eases uses one hand with your phone