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

Commit 3eac0ae5 authored by Nate Myren's avatar Nate Myren
Browse files

Add Default grant for Captive Portal Login app

Bug: 228991143
Test: DefaultPermissionGrantPolicyTest
Change-Id: I20f93a710a6035696bb395bf66ca553141135baf
parent 4220511d
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1869,6 +1869,11 @@
    -->
    <string name="config_defaultSearchSelectorPackageName" translatable="false"></string>

    <!-- The package name of the default captive portal login app. Must be granted the
         POST_NOTIFICATIONS permission.
    -->
    <string name="config_defaultCaptivePortalLoginPackageName" translatable="false"></string>

    <!-- Whether to enable geocoder overlay which allows geocoder to be replaced
         by an app at run-time. When disabled, only the
         config_geocoderProviderPackageName package will be searched for
+3 −0
Original line number Diff line number Diff line
@@ -3419,6 +3419,9 @@
  <!-- Search Selector -->
  <java-symbol type="string" name="config_defaultSearchSelectorPackageName" />

  <!-- Captive Portal Login -->
  <java-symbol type="string" name="config_defaultCaptivePortalLoginPackageName" />

  <!-- Optional IPsec algorithms -->
  <java-symbol type="array" name="config_optionalIpSecAlgorithms" />

+8 −0
Original line number Diff line number Diff line
@@ -618,6 +618,10 @@ final class DefaultPermissionGrantPolicy {
        grantPermissionsToSystemPackage(pm, getDefaultSearchSelectorPackage(), userId,
                NOTIFICATION_PERMISSIONS);

        // Captive Portal Login
        grantPermissionsToSystemPackage(pm, getDefaultCaptivePortalLoginPackage(), userId,
                NOTIFICATION_PERMISSIONS);

        // Camera
        grantPermissionsToSystemPackage(pm,
                getDefaultSystemHandlerActivityPackage(pm, MediaStore.ACTION_IMAGE_CAPTURE, userId),
@@ -933,6 +937,10 @@ final class DefaultPermissionGrantPolicy {
        return mContext.getString(R.string.config_defaultSearchSelectorPackageName);
    }

    private String getDefaultCaptivePortalLoginPackage() {
        return mContext.getString(R.string.config_defaultCaptivePortalLoginPackageName);
    }

    @SafeVarargs
    private final void grantPermissionToEachSystemPackage(PackageManagerWrapper pm,
            ArrayList<String> packages, int userId, Set<String>... permissions) {