Merge "Grant record audio permission to SystemCaptionsService instead of ContentCaptureService"

This commit is contained in:
Nadav Bar
2019-03-20 08:00:52 +00:00
committed by Android (Google) Code Review
6 changed files with 19 additions and 20 deletions

View File

@@ -3054,9 +3054,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();
}

View File

@@ -742,7 +742,7 @@ interface IPackageManager {
String getAppPredictionServicePackageName();
String getContentCaptureServicePackageName();
String getSystemCaptionsServicePackageName();
String getIncidentReportApproverPackageName();

View File

@@ -6863,9 +6863,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");
}
/**

View File

@@ -20173,21 +20173,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() {

View File

@@ -748,11 +748,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);
}

View File

@@ -1138,7 +1138,7 @@ public class IPackageManagerStub implements IPackageManager {
}
@Override
public String getContentCaptureServicePackageName() throws RemoteException {
public String getSystemCaptionsServicePackageName() throws RemoteException {
return null;
}