am 675ecc43
: am 5974a7ea
: am 492fc648
: Merge "Grant record audio to system reco service by default" into mnc-dev
* commit '675ecc43d6e0294d1c87eab37d343ab4e02492a2': Grant record audio to system reco service by default
This commit is contained in:
@ -495,6 +495,16 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Voice recognition
|
||||||
|
Intent voiceRecoIntent = new Intent("android.speech.RecognitionService");
|
||||||
|
voiceRecoIntent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||||
|
PackageParser.Package voiceRecoPackage = getDefaultSystemHandlerServicePackageLPr(
|
||||||
|
voiceRecoIntent, userId);
|
||||||
|
if (voiceRecoPackage != null
|
||||||
|
&& doesPackageSupportRuntimePermissions(voiceRecoPackage)) {
|
||||||
|
grantRuntimePermissionsLPw(voiceRecoPackage, MICROPHONE_PERMISSIONS, userId);
|
||||||
|
}
|
||||||
|
|
||||||
// Location
|
// Location
|
||||||
if (locationPackageNames != null) {
|
if (locationPackageNames != null) {
|
||||||
for (String packageName : locationPackageNames) {
|
for (String packageName : locationPackageNames) {
|
||||||
@ -627,6 +637,26 @@ final class DefaultPermissionGrantPolicy {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PackageParser.Package getDefaultSystemHandlerServicePackageLPr(
|
||||||
|
Intent intent, int userId) {
|
||||||
|
List<ResolveInfo> handlers = mService.queryIntentServices(intent,
|
||||||
|
intent.resolveType(mService.mContext.getContentResolver()),
|
||||||
|
PackageManager.GET_DISABLED_COMPONENTS, userId);
|
||||||
|
if (handlers == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final int handlerCount = handlers.size();
|
||||||
|
for (int i = 0; i < handlerCount; i++) {
|
||||||
|
ResolveInfo handler = handlers.get(i);
|
||||||
|
PackageParser.Package handlerPackage = getSystemPackageLPr(
|
||||||
|
handler.serviceInfo.packageName);
|
||||||
|
if (handlerPackage != null) {
|
||||||
|
return handlerPackage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private List<PackageParser.Package> getHeadlessSyncAdapterPackagesLPr(
|
private List<PackageParser.Package> getHeadlessSyncAdapterPackagesLPr(
|
||||||
String[] syncAdapterPackageNames, int userId) {
|
String[] syncAdapterPackageNames, int userId) {
|
||||||
List<PackageParser.Package> syncAdapterPackages = new ArrayList<>();
|
List<PackageParser.Package> syncAdapterPackages = new ArrayList<>();
|
||||||
|
Reference in New Issue
Block a user