summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/systemui/appops/AppOpsControllerImpl.java
Commit message (Collapse)AuthorAgeFilesLines
* [RESTRICT AUTOMERGE] Fix recording config mic indicator suppressionAtneya Nair2025-10-071-5/+8
| | | | | | | | | | | | | | | We should suppress the indicator when AllOf the configs are silenced, instead of AnyOf. Bug: 293603271 Bug: 325912429 Test: CtsMediaAudioPermissionTestCases Test: AppOpsControllerTest Flag: EXEMPT security (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:40d0f5477e2f1d22967ef9895dd504330f4e3615) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ac5878f4c98720ee055e23005be26b053ee40981) Merged-In: I8b1fe0bc2a4474467a1ef2510b29c5164e32aad8 Change-Id: I8b1fe0bc2a4474467a1ef2510b29c5164e32aad8
* [SB][Privacy] Fetch current active appops on startup.Caitlin Shkuratov2024-01-091-0/+28
| | | | | | | | | | | | | | | | | | | | | This also updates SysUI's chip animation scheduler to ignore an `isTooEarly` check if the chip animation is forced to be visible (which is true for privacy events). Bug: 294104969 Test: start recording, then kill systemui via adb-> verify privacy chip reappears after restart. Pull down shade and verify chip is correctly attributed. Stop recording and verify chip/dot disappears. Test: open camera, then kill systemui via adb -> verify privacy chip reappears after restart. Pull down shade and verify chip is correctly attributed. Close camera and verify chip/dot disappears. Test: smoke test of privacy chip and dot Test: atest AppOpsControllerTest SystemStatusAnimationSchedulerImplTest (cherry picked from commit 084a7afb4bb41e0cdfdbe67bdd60728d940b4331) (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dac02d61f8cf755f733ef6c2fbd0f939ea13ee23) Merged-In: I664bb3003a2f6871113406e3257b7118bbdf2ab5 Change-Id: I664bb3003a2f6871113406e3257b7118bbdf2ab5
* Merge "Note RECEIVE_AMBIENT_TRIGGER_AUDIO in the SoundTrigger" into tm-devNate Myren2022-05-111-1/+3
|\
| * Note RECEIVE_AMBIENT_TRIGGER_AUDIO in the SoundTriggerNate Myren2022-05-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | This op gets around the background restrictions on RECORD_AUDIO, when used for SoundTrigger detection In addition, moves the precise logic for soundtrigger RECORD_AUDIO checks out of the soundtrigger system Fixes: 230430779 Test: manual Change-Id: I6d63c99e2d31e3f668070ac82afed71ff6672c9e Merged-In: I6d63c99e2d31e3f668070ac82afed71ff6672c9e
* | Fix indicator not removing in certain casesNate Myren2022-04-281-1/+1
|/ | | | | | | | | This is an internal CP of aosp/2041184 Test: manual Bug: 227647076 Change-Id: I72680218e7147281ded8305154ba7ccd2aea7a7e Merged-In: I1fe5eb2dcb216ab18907ecbcb3a58edf27b3c21f
* Remove FileDescriptor from systemui.Dumpable.Dave Mankoff2022-04-051-2/+1
| | | | | | | | | | This is the first step in moving over to the new public android.util.Dumpable api. Bug: 217567642 Test: m SystemUI Merged-In: Ibaebcfb2c6c5326d0c45b8c72d868c76655d89a0 Change-Id: Ibaebcfb2c6c5326d0c45b8c72d868c76655d89a0
* Create "trusted chain" mechanism for AttributionSourceNate Myren2021-06-301-4/+22
| | | | | | | | | Add and populate a "trusted" attribution flag, that verifies the attribution sources used to create it were trusted. Fixes: 192270935 Test: atest RuntimePermissionsAppOpTrackingTest Change-Id: Ifd8f825151bec55aa795da7bee0a3069509f5abe
* Do not hold indicators for apps that become pausedFabian Kozynski2021-04-151-8/+27
| | | | | | | | | | | | | If an app op becomes "paused" (microphone muted or disabled by toggle), remove the indicator immediately as opposed to holding for 5s. Also, pass the value that we are using for mic muted to PermissionManager, so they are in sync. Test: atest SystemUITests Test: manual Fixes: 184891081 Change-Id: I4d46fc6e1cefa45c0d718cc01f40c8f060dafee7
* Exclude only system and device intelligence roles from indicatorsNate Myren2021-04-071-114/+6
| | | | | | | | | | | Converts both the AppOpsControllerImpl and the PermissionUsageHelper to use the same static method when filtering which packages to show. The only packages which are filtered are 6 device intelligence roles, and the system package. These values are updated at most every 15 seconds Fixes: 184141707 Test: manual Change-Id: I9dc44197a2ff3df7783b37f450ada4ef2fb1ca6f
* Change privacy indicator holding policyFabian Kozynski2021-03-301-5/+7
| | | | | | | | | | Now, each PrivacyItem will be held for at least 5 seconds. Test: manual Test atest com.android.systemui.privacy Fixes: 183557327 Change-Id: I37d32eec7a45a4e6c58899812eff5ddd55a04656
* Show all system apps to hub teamfood, remove location indicatorNate Myren2021-03-121-10/+6
| | | | | | | | | | Location indicator has its own flag, so it is being removed from the hub teamfood. Also, showing all system usages (except the system app) for the hub teamfood. Bug: 172868375 Test: atest PrivacyDialogControllerTest, PrivacyItemControllerFlagsTest Change-Id: Iad5b141f600a0bf830d5b2ef5169ed90533914cb
* Show usage by default speech recognizerNate Myren2021-02-261-1/+14
| | | | | | Test: manual Fixes: 181067845 Change-Id: I9be50bf4bbafcedbc1c52adc0780b9821c865c8d
* Expose SensorPrivacy as SystemApiEvan Severson2021-02-241-9/+9
| | | | | | | | | | | Rename the apis to be more consistent. Also expose to test api. Have the aosp mark that it supports the toggle features by default. Test: atest CtsSensorPrivacyTestCases Bug: 162549680 Change-Id: Ib38c16adfc5cec931347e1a1891618983d78248b
* Added attribution tag to note listenerSoonil Nagarkar2021-02-191-1/+2
| | | | | | | | Add attribution tag information for listeners on noteOps(). Bug: 180111317 Test: none Change-Id: I39ae9af893b8c81b1d832c4c3dc876f16ffc301f
* Hide indicators when camera/mic disabledNate Myren2021-01-271-20/+56
| | | | | | | | | When the mic or camera block switch is enabled, hide the relevant indicator Test: Atest AppOpsControllerTest Fixes: 178294237 Change-Id: Ia2b907b147327dfc0159ce7b41b6f55288a235a2
* TEMP: Show AiAi usage in teamfoodNate Myren2021-01-111-2/+18
| | | | | | Bug: 172868375 Test: manual Change-Id: I49e342aff9c069c71c9894aaa27a236e04d82b5b
* Add flags to onOpNoted/Started callbacksPhilip P. Moltmann2020-12-091-1/+2
| | | | | | | | This way clients can distingish actual trusted from untrusted ops. Test: TH Bug: 162549680 Change-Id: If470bc9a4503da6533d123def2f8e2dbe0644ca7
* Observe mic mute changes, consider recordingss paused when mutedNate Myren2020-09-161-2/+25
| | | | | | | | | | | | Listen for the microphone mute state to change, and when it changes, update the paused status of all audio recordings. If the mic is muted, then every stream is considered paused. Fixes: 168553482 Test: Get a call, then screen it. The "mic in use" icon should be replaced by the mute icon Change-Id: I5fad1f359c7009c924e8f7cce9c09f8ea299522a
* Merge changes from topic "phone-call-indicators" into rvc-qpr-dev am: ↵Philip P. Moltmann2020-08-201-2/+27
|\ | | | | | | | | | | | | | | ff2866cfd6 am: a592f49c5b Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12406147 Change-Id: I8c6413133542605e73d249c54e86e64635b49e2b
| * Cache location provider pkg namePhilip P. Moltmann2020-08-191-2/+27
| | | | | | | | | | | | Bug: 162547999 Test: Accessed camera from location provider and saw camera indicator Change-Id: Id273b7d42c6ebb60219b515e2ebd4bd44961c2e0
* | Special case location provider camera accesses and show them as am: ↵Philip P. Moltmann2020-08-201-0/+8
|\| | | | | | | | | | | | | | | 64c801d344 am: 541749bf7e Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12404752 Change-Id: I79c1e80efbc791527b8270ab820e6de9d06c98e0
| * Special case location provider camera accesses and show them asPhilip P. Moltmann2020-08-191-0/+8
| | | | | | | | | | | | | | | | indicators Bug: 162547999 Test: Made location provider access camera and saw privacy chip Change-Id: I5960fdff38b38a0bd8f4d9c9826639cc89a94603
* | Treat phone call mic/camera similar to other mic/camera app-ops am: ↵Philip P. Moltmann2020-08-201-1/+5
|\| | | | | | | | | | | | | | | 94afe73ca2 am: 984f90a345 Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12396941 Change-Id: I73d6152a20024705b6a34fb9d645bc379a941be6
| * Treat phone call mic/camera similar to other mic/camera app-opsPhilip P. Moltmann2020-08-191-1/+5
| | | | | | | | | | | | | | Bug: 162547999 Test: Started a phone call and swiped clicked all way through privacy chip flow Change-Id: Icb933c7e4e430d3da54cef44b5aaab99093ffeca
| * [DO NOT MERGE] Keep track of audio recordings that are silencedFabian Kozynski2020-08-071-7/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, an app will have an active App Op for recording, but it is silenced (for example, after a while being in background). This means they cannot get the recording audio stream. This change keeps track of that and prevents them from being considered as actively using AppOpsManager.OP_RECORD_AUDIO from SystemUI's perspective. It does two things: - If a particular UID has any of its AudioRecordingConfigurations as silenced, it will be marked as paused and an inactive update will be sent to listeners of AppOpsController. When the recording stops being silent, an active update will be sent. - When getting the list of active items, paused ones will be filtered out. Test: manual with recording app Test: atest AppOpsControllerTest Bug: 162552566 Change-Id: I72fbebf4b37b799907855d57e6c615c244b63999
| * Separate mic + camera from locationFabian Kozynski2020-08-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The different states are: - No indicators enabled. Location is displayed using LocationControllerImpl - Only mic + camera indicators. Location is displayed using LocationControllerImpl - All indicators enabled. LocationControllerImpl is ignored. Also, hardwire OP_MONITOR_HIGH_POWER_LOCATION as user sensitive. Fixes: 162552566 Test: atest com.android.systemui.privacy Test: manual Change-Id: I1e7f62d6fccb4a3bc4fdf2a47a8d5c8a4f55421d Merged-In: I1e7f62d6fccb4a3bc4fdf2a47a8d5c8a4f55421d
| * Restricts notified app ops based on flagsFabian Kozynski2020-07-201-4/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AppOps that are received by SystemUI and notified to listeners of AppOpsControllerImpl are filtered based on the permission flag PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED. As calls to obtain this flag require an IPC, three things are done to mitigate impact: * PermissionFlagsCache keeps track of requested flags and will update those (in a background thread), when a change is notified for a given uid. * Calls to getActiveAppOps/getActiveAppOpsForUser should be made from a background thread. * notifySubscribers is always called in the background thread. Bug: 160966908 Test: atest PermissionFlagsCacheTest AppOpsControllerTest Change-Id: I871094c32ce5ec940d779626333caa0ca500a4e3 Merged-In: I871094c32ce5ec940d779626333caa0ca500a4e3
| * Add back privacy chipFabian Kozynski2020-07-201-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This adds back the privacy chip classes (Controller and view). Change to using Executors and DeviceConfigProxy, also fix tests that were flaky before. Test: SystemUITests Bug: 160966908 Change-Id: Id3e5981a87c33a8cabe7ce348f9512d81ad2b1d8 Merged-In: Id3e5981a87c33a8cabe7ce348f9512d81ad2b1d8
* | 6/N Move everything into SysUIComponent.Dave Mankoff2020-08-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is far easier to move _everything_ into SysUIComponent, and then selectively promote things back to GlobalScope and/or WMScope than it is to try to do it one at a time. With this change, though lots of files are touched, very little actually changes structurally. After this change goes in, folks should stop using @Singleton quite so freely. Most things should live in @SysuiSingleton. @Singleton is due to quickly be replaced by @GlobalScope. Bug: 162923491 Test: atest SystemUITests && manual Change-Id: Idc31d3d83b030581fb1fa869f7fafc4f2d3a8828
* | Keep track of audio recordings that are silencedFabian Kozynski2020-08-101-7/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes, an app will have an active App Op for recording, but it is silenced (for example, after a while being in background). This means they cannot get the recording audio stream. This change keeps track of that and prevents them from being considered as actively using AppOpsManager.OP_RECORD_AUDIO from SystemUI's perspective. It does two things: - If a particular UID has any of its AudioRecordingConfigurations as silenced, it will be marked as paused and an inactive update will be sent to listeners of AppOpsController. When the recording stops being silent, an active update will be sent. - When getting the list of active items, paused ones will be filtered out. Test: manual with recording app Test: atest AppOpsControllerTest Bug: 162552566 Change-Id: I72fbebf4b37b799907855d57e6c615c244b63999
* | Separate mic + camera from locationFabian Kozynski2020-08-041-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The different states are: - No indicators enabled. Location is displayed using LocationControllerImpl - Only mic + camera indicators. Location is displayed using LocationControllerImpl - All indicators enabled. LocationControllerImpl is ignored. Also, hardwire OP_MONITOR_HIGH_POWER_LOCATION as user sensitive. Bug: 162552566 Test: atest com.android.systemui.privacy Test: manual Change-Id: I1e7f62d6fccb4a3bc4fdf2a47a8d5c8a4f55421d
* | Restricts notified app ops based on flagsFabian Kozynski2020-07-221-4/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AppOps that are received by SystemUI and notified to listeners of AppOpsControllerImpl are filtered based on the permission flag PackageManager.FLAG_PERMISSION_USER_SENSITIVE_WHEN_GRANTED. As calls to obtain this flag require an IPC, three things are done to mitigate impact: * PermissionFlagsCache keeps track of requested flags and will update those (in a background thread), when a change is notified for a given uid. * Calls to getActiveAppOps/getActiveAppOpsForUser should be made from a background thread. * notifySubscribers is always called in the background thread. Bug: 160966908 Test: atest PermissionFlagsCacheTest AppOpsControllerTest Change-Id: I871094c32ce5ec940d779626333caa0ca500a4e3
* | Deprecate high power location broadcastSoonil Nagarkar2020-07-091-7/+6
|/ | | | | | | This can be replaced by listening directly for appops changes. Test: manual + presubmit Change-Id: Ib84fbeebd7be25f4a1b097b65137777030805132
* Migrate DumpController -> DumpManagerNed Burns2020-02-201-4/+6
| | | | | | | Unify "everything that needs to dump stuff" to use the DumpManager. Test: atest, manual Change-Id: Ib475aba4eeccb24bd49ab909896f7d779a8e1b04
* Prevent sending early termination of appop useFabian Kozynski2020-01-101-75/+42
| | | | | | | | | | | | | | | | | | | | If a package starts a particular appop both as active and noted, once one of them is finished (usually noted after 5s), a message will be sent to callbacks indicating the end of the use. However, the app op may still be active. This could result in the removal of indicators prematurely from notifications. This change prevents that from happening by checking if the app op is still in use by that combination uid/package (either active or noted) and not notifying listeners if that's the case. Also removed user sensitive checks. Test: atest AppOpsControllerTest Test: use app from bug report. Observe that notification does not lose the microphone indicator Bug: 144092031 Change-Id: I180e7c257e6171e7686ba7eda9bf02249358ed00
* Conslidate @MainHandler and similar to @Main (and similar).Dave Mankoff2019-12-201-2/+2
| | | | | | | | | | | | @MainHandler, @MainLooper, @MainResources -> @Main @BgHandler, @BgLooper -> @Background. Also, move the providers for Handlers and Loopers into the ConcurrencyModule. Bug: 146510722 Test: atest SystemUITests Change-Id: I991735e1fdca397784427409a2ae696a7374f584
* Do not notify onOpNoted if less than 5sFabian Kozynski2019-11-181-7/+16
| | | | | | | | | If opNoted is updated for the same uid, op, package that it's already in the AppOpController, do not send new updates. Test: atest AppOpsControllerTest Bug: 143929255 Change-Id: Ib744f7cfb60d8cf1a52f35fbf6c463ac8593ffdb
* Add AppOpsController to the DumpControllerBeverly2019-11-081-3/+7
| | | | | | | | | | | | | | There are no more calls to Dependency.get(AppOpsController.class), so we must register this controller to DumpController if we want to see AppOps in a dumpsys Fixes: 144160975 Test: atest AppOpsControllerTest Test: manual - adb shell dumpsys activity service com.android.systemui/.SystemUIService - see AppOpsController state Change-Id: I0c2246540a5340cc0cf8246424afcd2ee482bc70
* Move DI related coded into new dagger package.Dave Mankoff2019-10-211-4/+2
| | | | | | | | | This adds new Dagger qualifiers for BgHandler, BgLooper, MainHandler, MainLooper, and MainResources, replacing the use of @Named for them. Bug: 142954072 Test: atest SystemUITests Change-Id: Ibbda8998e587474c26740ba8d49a8b3f90d89efa
* Public API to watch for "active" operations.Jeff Sharkey2019-08-221-1/+1
| | | | | | | | | | | | | We already have startOp() and finishOp() to provide a mechanism to mark an operation as being "active". This change publishes a set of APIs to check the status of these active operations, matching the naming of similar existing APIs on the same class. Bug: 139128842 Test: atest com.android.server.appop.AppOpsActiveWatcherTest Test: atest android.media.cts.AudioRecordAppOpTest Exempt-From-Owner-Approval: trivial API refactoring Change-Id: I9fb381d748ff23ff24dd363ed5b117bd661793ab
* Add cache to AppOpsControllerFabian Kozynski2019-06-101-3/+13
| | | | | | | | | | | | | | | | | | | | | | | Reduces the Binder calls from AppOpsControllerImpl to PackageManager#getPermissionFlags by caching calls for 10s (moltmann@ recommended this expiration time). Also, modify AppOpsControllerImpl#notifySuscribers to use the bg Thread. Currently calls to getPermissionFlags only happen in two functions: * AppOpsControllerImpl#notifySuscribers * AppOpsControllerImpl#getActiveAppOpsForUser First one in only called from bg thread and second one is called from a bg thread from PrivacyItemController. In a future CL, this calling will be enforced at the entry point (getActiveAppOpsForUser) Test: atest PermissionFlagsCacheTest AppOpsControllerTest Bug: 134687592 Change-Id: I6fa9e2d865bc295f6325935e2df574b8b758214a
* DO NOT MERGE Revert "DO NOT MERGE Remove Privacy Indicators"Fabian Kozynski2019-06-041-5/+60
| | | | | | | | | This reverts commit ec3e0ecacaa659d06e520d207d8e817b7563bfcb. Reason for revert: Re-enable Privacy Indicators in qt-r1-dev Bug: 133257910 Change-Id: I7c778dd76c0aff3f483cf06f1dd96fd067145c12
* DO NOT MERGE Remove Privacy IndicatorsFabian Kozynski2019-05-311-60/+5
|\ | | | | | | | | | | am: 9a560e068d Change-Id: Ied3a51b9c47255a21e2fd29becfe4ed3400a16c7
| * DO NOT MERGE Remove Privacy IndicatorsFabian Kozynski2019-05-311-60/+5
| | | | | | | | | | | | Bug: 133257910 Test: build and check that behavior is as P Change-Id: I24bfc3806e2d12f6a1cc968d6979107e7002a3c4
* | Clear AppOpsController when it stops listeningFabian Kozynski2019-05-281-0/+7
|/ | | | | | | | | | | | | | If AppOpsController stops listening, the lists were not cleared and it may not receive the update to remove an active AppOp. To make sure that we do not show outdated behavior once the controller is listening again, we clear the lists on setListening(false). When the controller goes back to listening, we will not have information of anything that happened while the controller was not listening. Test: atest AppOpsControllerTest Fixes: 133263799 Change-Id: I2827b03d39d3b16c9cf6593537f7c1e30d7946f5
* Filter app-ops from for foreground notificationsNadav Bar2019-03-271-9/+45
| | | | | | | | | | | This fixes inconsistency of showing the app ops indicators in the status bar and foreground notifications. Specifically, the issue that were seen is that the microphone indicator was also shown for system apps without a launcher that have the recording pre-granted. Bug: 129263222. Change-Id: I6f6faf1552d3721f6fc34c650b5601e90d172db6 Test: Manually.
* Show only user sensitive ops in system uiPhilip P. Moltmann2019-03-081-11/+25
| | | | | Test: Looked at system ui button when starting maps and camera Change-Id: Id6a9a64162200281c5c94671668255f258db36b3
* AppOpsController implements DumpableFabian Kozynski2019-01-091-1/+20
| | | | | Test: adb bugreport Change-Id: I4770ccef57d152adfbdfa5d4b4507666517c0238
* Clean up DependencyProvider a bitJason Monk2018-12-211-1/+9
| | | | | | | | | Create DependencyBinder which is abstract and can tell dagger how to convert directly between interfaces and implementations without requiring code for it. Test: compile (which runs dagger) Change-Id: I7013ee12d37172441e2c70cf2fe36f707975c821
* Use raw op codes for the watch noted APIs.Fabian Kozynski2018-12-201-20/+11
| | | | | | | | | Test: atest com.android.server.AppOpsServiceTests Test: atest com.android.systemui.appops.AppOpsControllerTest bug:121246606 Change-Id: Id99923c566fbf132914b15c676cb766d8793e875