Merge "Turn on foreground service type policy check."

This commit is contained in:
Hui Yu
2023-02-08 18:18:15 +00:00
committed by Android (Google) Code Review

View File

@@ -107,9 +107,8 @@ public abstract class ForegroundServiceTypePolicy {
*
* @hide
*/
// TODO (b/254661666): Change to @EnabledAfter(T)
@ChangeId
@Disabled
@EnabledAfter(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
@Overridable
public static final long FGS_TYPE_NONE_DISABLED_CHANGE_ID = 255038118L;
@@ -142,9 +141,8 @@ public abstract class ForegroundServiceTypePolicy {
*
* @hide
*/
// TODO (b/254661666): Change to @EnabledAfter(T)
@ChangeId
@Disabled
@EnabledAfter(targetSdkVersion = android.os.Build.VERSION_CODES.TIRAMISU)
@Overridable
public static final long FGS_TYPE_PERMISSION_CHANGE_ID = 254662522L;
@@ -286,10 +284,7 @@ public abstract class ForegroundServiceTypePolicy {
new ForegroundServiceTypePermissions(new ForegroundServiceTypePermission[] {
new RegularPermission(Manifest.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION)
}, true),
new ForegroundServiceTypePermissions(new ForegroundServiceTypePermission[] {
new RegularPermission(Manifest.permission.CAPTURE_VIDEO_OUTPUT),
new AppOpPermission(AppOpsManager.OP_PROJECT_MEDIA)
}, false)
null
);
/**
@@ -1058,7 +1053,7 @@ public abstract class ForegroundServiceTypePolicy {
if (policy.isTypeDisabled(callerUid)) {
return FGS_TYPE_POLICY_CHECK_DISABLED;
}
int permissionResult = PERMISSION_DENIED;
int permissionResult = PERMISSION_GRANTED;
// Do we have the permission to start FGS with this type.
if (policy.mAllOfPermissions != null) {
permissionResult = policy.mAllOfPermissions.checkPermissions(context,