Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1dceeaa0 authored by Sumedh Sen's avatar Sumedh Sen
Browse files

Dont check for "no_install_unknown_sources" for installs from privileged sources.

Installs from privileged sources should only check for "no_install_apps"
retriction.

Bug: 324305636
Test: Manual. Follow repro steps in the bug

Change-Id: I64197ebed16098306c349f62e84f183d61903b4d
parent 59cf6de3
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ public class InstallStart extends Activity {
            mAbortInstall = true;
        }

        checkDevicePolicyRestrictions();
        checkDevicePolicyRestrictions(isTrustedSource);

        final String installerPackageNameFromIntent = getIntent().getStringExtra(
                Intent.EXTRA_INSTALLER_PACKAGE_NAME);
@@ -304,12 +304,17 @@ public class InstallStart extends Activity {
        return callingUid == installerUid;
    }

    private void checkDevicePolicyRestrictions() {
        final String[] restrictions = new String[] {
    private void checkDevicePolicyRestrictions(boolean isTrustedSource) {
        String[] restrictions;
        if(isTrustedSource) {
            restrictions = new String[] { UserManager.DISALLOW_INSTALL_APPS };
        } else {
            restrictions =  new String[] {
                UserManager.DISALLOW_INSTALL_APPS,
                UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
                UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY
            };
        }

        final DevicePolicyManager dpm = getSystemService(DevicePolicyManager.class);
        for (String restriction : restrictions) {