Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9b8b66e authored by Evan Severson's avatar Evan Severson
Browse files

Treat background mic/camera normally

Since the addition of background mic/camera, the foreground mode now
takes the mode MODE_FOREGROUND so now we don't need to treat
MODE_ALLOWED specially for microphone and camera.

Test: Try bg camera/mic access from fg/bg && with both levels of access
Bug: 158311343
Change-Id: I17b5cbfe6644bcbfc9c295487ca41482113562d9
parent d7087b25
Loading
Loading
Loading
Loading
+0 −23
Original line number Diff line number Diff line
@@ -584,29 +584,6 @@ public class AppOpsService extends IAppOpsService.Stub {
                    // process is not in foreground.
                    return MODE_IGNORED;
                }
            } else if (mode == MODE_ALLOWED) {
                switch (op) {
                    case OP_CAMERA:
                        if (mActivityManagerInternal != null
                                && mActivityManagerInternal.isPendingTopUid(uid)) {
                            return MODE_ALLOWED;
                        } else if ((capability & PROCESS_CAPABILITY_FOREGROUND_CAMERA) != 0) {
                            return MODE_ALLOWED;
                        } else {
                            return MODE_IGNORED;
                        }
                    case OP_RECORD_AUDIO:
                        if (mActivityManagerInternal != null
                                && mActivityManagerInternal.isPendingTopUid(uid)) {
                            return MODE_ALLOWED;
                        } else if ((capability & PROCESS_CAPABILITY_FOREGROUND_MICROPHONE) != 0) {
                            return MODE_ALLOWED;
                        } else {
                            return MODE_IGNORED;
                        }
                    default:
                        return MODE_ALLOWED;
                }
            }
            return mode;
        }