Enforce suspend restrictions in startOp and noteOp paths
Suspended apps could previously bypass AppOps restrictions by using the
startOp and noteOp code paths, as these did not check the package
suspended state. This change adds a check for isOpRestrictedDueToSuspend
in noteOperationUnchecked, startOperationUnchecked, and
startOperationDryRun.
Refactored FrameworksServicesTests to verify these restrictions. The
tests now independently check checkOp, noteOp, and startOp paths for
three different operations: OP_RESERVED_FOR_TESTING, OP_VIBRATE, and
OP_PLAY_AUDIO. This replaces the previous reliance on microphone and
camera ops, which cannot be directly changed.
Bug: 477935679
Test: atest FrameworksServicesTests:SuspendPackagesTest \
CtsSuspendAppsTestCases:SuspendPackagesTest
Flag: EXEMPT CVE_FIX
(cherry picked from commit 3b8d1a9f49543e8633f51e01488a40c927590764)
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:caa53e28ca4755a49f40f46d5a1b7689774590a4
Merged-In: Ifeac8cebdec2fb8d6129ecfdf18b4413303b62f4
Change-Id: Ifeac8cebdec2fb8d6129ecfdf18b4413303b62f4
2 files changed