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

Commit 4c0ea738 authored by Nate Myren's avatar Nate Myren
Browse files

Add defaultSearchSelector config and default grant

The search selector needs the NOTIFICATION permissions for EU
regulations

Fixes: 229282939
Test: manual
Change-Id: I54630371dbe7e1682ca2117d81dc86118995f164
parent f1f03b8f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1860,6 +1860,11 @@
     -->
    <string name="config_defaultNetworkRecommendationProviderPackage" translatable="false"></string>

    <!-- The package name of the default search selector app. Must be granted the POST_NOTIFICATIONS
         permission.
    -->
    <string name="config_defaultSearchSelectorPackageName" 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
@@ -3412,6 +3412,9 @@
  <!-- Network Recommendation -->
  <java-symbol type="string" name="config_defaultNetworkRecommendationProviderPackage" />

  <!-- Search Selector -->
  <java-symbol type="string" name="config_defaultSearchSelectorPackageName" />

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

+8 −0
Original line number Diff line number Diff line
@@ -610,6 +610,10 @@ final class DefaultPermissionGrantPolicy {
                    pm, setupWizardPackage, userId, NEARBY_DEVICES_PERMISSIONS);
        }

        // SearchSelector
        grantPermissionsToSystemPackage(pm, getDefaultSearchSelectorPackage(), userId,
                NOTIFICATION_PERMISSIONS);

        // Camera
        grantPermissionsToSystemPackage(pm,
                getDefaultSystemHandlerActivityPackage(pm, MediaStore.ACTION_IMAGE_CAPTURE, userId),
@@ -938,6 +942,10 @@ final class DefaultPermissionGrantPolicy {
                new Intent(Intent.ACTION_MAIN).addCategory(category), userId);
    }

    private String getDefaultSearchSelectorPackage() {
        return mContext.getString(R.string.config_defaultSearchSelectorPackageName);
    }

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