Grant record audio permission to SystemCaptionsService instead of ContentCaptureService
Now that we have a definition for a SystemCaptionsService we should move to use it instead of piggybacking on ContentCaptureService. This is also required to ensure that T2C will be granted audio recording permission in case it will be shipped in a different APK for OEMs. Test: Manual and DefaultPermissionGrantPolicyTest. Bug: 128622041. Change-Id: Ic0b5b21b05ff1ad200472bfc1c4eaa3c588324df
This commit is contained in:
@@ -3055,9 +3055,9 @@ public class ApplicationPackageManager extends PackageManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentCaptureServicePackageName() {
|
||||
public String getSystemCaptionsServicePackageName() {
|
||||
try {
|
||||
return mPM.getContentCaptureServicePackageName();
|
||||
return mPM.getSystemCaptionsServicePackageName();
|
||||
} catch (RemoteException e) {
|
||||
throw e.rethrowAsRuntimeException();
|
||||
}
|
||||
|
||||
@@ -742,7 +742,7 @@ interface IPackageManager {
|
||||
|
||||
String getAppPredictionServicePackageName();
|
||||
|
||||
String getContentCaptureServicePackageName();
|
||||
String getSystemCaptionsServicePackageName();
|
||||
|
||||
String getIncidentReportApproverPackageName();
|
||||
|
||||
|
||||
@@ -6860,9 +6860,9 @@ public abstract class PackageManager {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public String getContentCaptureServicePackageName() {
|
||||
public String getSystemCaptionsServicePackageName() {
|
||||
throw new UnsupportedOperationException(
|
||||
"getContentCaptureServicePackageName not implemented in subclass");
|
||||
"getSystemCaptionsServicePackageName not implemented in subclass");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -160,9 +160,9 @@ import android.content.pm.InstantAppInfo;
|
||||
import android.content.pm.InstantAppRequest;
|
||||
import android.content.pm.InstrumentationInfo;
|
||||
import android.content.pm.IntentFilterVerificationInfo;
|
||||
import android.content.pm.PackageBackwardCompatibility;
|
||||
import android.content.pm.KeySet;
|
||||
import android.content.pm.ModuleInfo;
|
||||
import android.content.pm.PackageBackwardCompatibility;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageInfoLite;
|
||||
import android.content.pm.PackageInstaller;
|
||||
@@ -20124,21 +20124,20 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentCaptureServicePackageName() {
|
||||
String contentCaptureServiceName =
|
||||
mContext.getString(R.string.config_defaultContentCaptureService);
|
||||
public String getSystemCaptionsServicePackageName() {
|
||||
String flattenedSystemCaptionsServiceComponentName =
|
||||
mContext.getString(R.string.config_defaultSystemCaptionsService);
|
||||
|
||||
if (TextUtils.isEmpty(contentCaptureServiceName)) {
|
||||
if (TextUtils.isEmpty(flattenedSystemCaptionsServiceComponentName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
int separatorIndex = contentCaptureServiceName.indexOf("/");
|
||||
|
||||
if (separatorIndex < 0) {
|
||||
ComponentName systemCaptionsServiceComponentName =
|
||||
ComponentName.unflattenFromString(flattenedSystemCaptionsServiceComponentName);
|
||||
if (systemCaptionsServiceComponentName == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return contentCaptureServiceName.substring(0, separatorIndex);
|
||||
return systemCaptionsServiceComponentName.getPackageName();
|
||||
}
|
||||
|
||||
public String getIncidentReportApproverPackageName() {
|
||||
|
||||
@@ -742,11 +742,11 @@ public final class DefaultPermissionGrantPolicy {
|
||||
grantSystemFixedPermissionsToSystemPackage("com.android.sharedstoragebackup", userId,
|
||||
STORAGE_PERMISSIONS);
|
||||
|
||||
// Content Capture Service
|
||||
String contentCaptureServicePackageName =
|
||||
mContext.getPackageManager().getContentCaptureServicePackageName();
|
||||
if (!TextUtils.isEmpty(contentCaptureServicePackageName)) {
|
||||
grantPermissionsToSystemPackage(contentCaptureServicePackageName, userId,
|
||||
// System Captions Service
|
||||
String systemCaptionsServicePackageName =
|
||||
mContext.getPackageManager().getSystemCaptionsServicePackageName();
|
||||
if (!TextUtils.isEmpty(systemCaptionsServicePackageName)) {
|
||||
grantPermissionsToSystemPackage(systemCaptionsServicePackageName, userId,
|
||||
MICROPHONE_PERMISSIONS);
|
||||
}
|
||||
|
||||
|
||||
@@ -1138,7 +1138,7 @@ public class IPackageManagerStub implements IPackageManager {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContentCaptureServicePackageName() throws RemoteException {
|
||||
public String getSystemCaptionsServicePackageName() throws RemoteException {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user