Add defaultSearchSelector config and default grant

The search selector needs the NOTIFICATION permissions for EU
regulations

Fixes: 229282939
Test: manual
Change-Id: I54630371dbe7e1682ca2117d81dc86118995f164
This commit is contained in:
Nate Myren
2022-04-18 13:45:22 -07:00
parent f1f03b8f38
commit 4c0ea738e7
3 changed files with 16 additions and 0 deletions

View File

@@ -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

View File

@@ -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" />

View File

@@ -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) {