Merge "Restrict the mic and cam phone call ops when toggle is muted" into sc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
b13bdd4ae2
@@ -21,7 +21,6 @@ import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_CAMERA;
|
|||||||
import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
import static android.app.ActivityManager.PROCESS_CAPABILITY_FOREGROUND_MICROPHONE;
|
||||||
import static android.app.ActivityManager.RunningServiceInfo;
|
import static android.app.ActivityManager.RunningServiceInfo;
|
||||||
import static android.app.ActivityManager.RunningTaskInfo;
|
import static android.app.ActivityManager.RunningTaskInfo;
|
||||||
import static android.app.AppOpsManager.MODE_ALLOWED;
|
|
||||||
import static android.app.AppOpsManager.MODE_IGNORED;
|
import static android.app.AppOpsManager.MODE_IGNORED;
|
||||||
import static android.app.AppOpsManager.OP_CAMERA;
|
import static android.app.AppOpsManager.OP_CAMERA;
|
||||||
import static android.app.AppOpsManager.OP_PHONE_CALL_CAMERA;
|
import static android.app.AppOpsManager.OP_PHONE_CALL_CAMERA;
|
||||||
@@ -382,17 +381,9 @@ public final class SensorPrivacyService extends SystemService {
|
|||||||
|
|
||||||
int sensor;
|
int sensor;
|
||||||
if (result == MODE_IGNORED) {
|
if (result == MODE_IGNORED) {
|
||||||
if (code == OP_RECORD_AUDIO) {
|
if (code == OP_RECORD_AUDIO || code == OP_PHONE_CALL_MICROPHONE) {
|
||||||
sensor = MICROPHONE;
|
sensor = MICROPHONE;
|
||||||
} else if (code == OP_CAMERA) {
|
} else if (code == OP_CAMERA || code == OP_PHONE_CALL_CAMERA) {
|
||||||
sensor = CAMERA;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else if (result == MODE_ALLOWED) {
|
|
||||||
if (code == OP_PHONE_CALL_MICROPHONE) {
|
|
||||||
sensor = MICROPHONE;
|
|
||||||
} else if (code == OP_PHONE_CALL_CAMERA) {
|
|
||||||
sensor = CAMERA;
|
sensor = CAMERA;
|
||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
@@ -1276,10 +1267,14 @@ public final class SensorPrivacyService extends SystemService {
|
|||||||
case MICROPHONE:
|
case MICROPHONE:
|
||||||
mAppOpsManagerInternal.setGlobalRestriction(OP_RECORD_AUDIO, enabled,
|
mAppOpsManagerInternal.setGlobalRestriction(OP_RECORD_AUDIO, enabled,
|
||||||
mAppOpsRestrictionToken);
|
mAppOpsRestrictionToken);
|
||||||
|
mAppOpsManagerInternal.setGlobalRestriction(OP_PHONE_CALL_MICROPHONE, enabled,
|
||||||
|
mAppOpsRestrictionToken);
|
||||||
break;
|
break;
|
||||||
case CAMERA:
|
case CAMERA:
|
||||||
mAppOpsManagerInternal.setGlobalRestriction(OP_CAMERA, enabled,
|
mAppOpsManagerInternal.setGlobalRestriction(OP_CAMERA, enabled,
|
||||||
mAppOpsRestrictionToken);
|
mAppOpsRestrictionToken);
|
||||||
|
mAppOpsManagerInternal.setGlobalRestriction(OP_PHONE_CALL_CAMERA, enabled,
|
||||||
|
mAppOpsRestrictionToken);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user