Merge "FGS BG start restriction enforcement mode."

This commit is contained in:
Hui Yu
2020-02-19 04:00:48 +00:00
committed by Android (Google) Code Review
2 changed files with 6 additions and 12 deletions

View File

@@ -1994,12 +1994,11 @@ public final class OomAdjuster {
if (app.hasForegroundServices()) {
capability |= capabilityFromFGS;
} else if (!ActivityManager.isProcStateBackground(procState)) {
// procState higher than PROCESS_STATE_TRANSIENT_BACKGROUND implicitly has
// procState higher than PROCESS_STATE_BOUND_FOREGROUND_SERVICE implicitly has
// camera/microphone capability
if (procState == PROCESS_STATE_FOREGROUND_SERVICE && procStateFromFGSClient) {
// if the FGS state is passed down from client, do not grant implicit capabilities.
} else {
//TODO: remove this line when enforcing the feature.
capability |= PROCESS_CAPABILITY_ALL_IMPLICIT;
}
}

View File

@@ -536,9 +536,8 @@ public class AppOpsService extends IAppOpsService.Stub {
// The FGS has the location capability, but due to FGS BG start
// restriction it lost the capability, use temp location capability
// to mark this case.
// TODO change to MODE_IGNORED when enforcing the feature.
maybeShowWhileInUseDebugToast(op, mode);
return AppOpsManager.MODE_ALLOWED;
return AppOpsManager.MODE_IGNORED;
} else {
return AppOpsManager.MODE_IGNORED;
}
@@ -546,17 +545,15 @@ public class AppOpsService extends IAppOpsService.Stub {
if ((capability & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
return AppOpsManager.MODE_ALLOWED;
} else {
//TODO change to MODE_IGNORED when enforcing the feature.
maybeShowWhileInUseDebugToast(op, mode);
return AppOpsManager.MODE_ALLOWED;
return AppOpsManager.MODE_IGNORED;
}
case OP_RECORD_AUDIO:
if ((capability & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
return AppOpsManager.MODE_ALLOWED;
} else {
//TODO change to MODE_IGNORED when enforcing the feature.
maybeShowWhileInUseDebugToast(op, mode);
return AppOpsManager.MODE_ALLOWED;
return AppOpsManager.MODE_IGNORED;
}
default:
return AppOpsManager.MODE_ALLOWED;
@@ -571,17 +568,15 @@ public class AppOpsService extends IAppOpsService.Stub {
if ((capability & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
return AppOpsManager.MODE_ALLOWED;
} else {
//TODO change to MODE_IGNORED when enforcing the feature.
maybeShowWhileInUseDebugToast(op, mode);
return AppOpsManager.MODE_ALLOWED;
return AppOpsManager.MODE_IGNORED;
}
case OP_RECORD_AUDIO:
if ((capability & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
return AppOpsManager.MODE_ALLOWED;
} else {
//TODO change to MODE_IGNORED when enforcing the feature.
maybeShowWhileInUseDebugToast(op, mode);
return AppOpsManager.MODE_ALLOWED;
return AppOpsManager.MODE_IGNORED;
}
default:
return MODE_ALLOWED;