DO NOT MERGE: 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
Cherrypick-From: https://googleplex-android-review.googlesource.com/q/commit:eb1c8fbf88d489a3044ce5171264a52bc7d159f3
Merged-In: Ifeac8cebdec2fb8d6129ecfdf18b4413303b62f4
Change-Id: Ifeac8cebdec2fb8d6129ecfdf18b4413303b62f4
2 files changed