Implement the identifier disclosure window
This commit implements the logic that tracks identifier disclosures and decides when notifications should be emitted to the user. The actual implementation of notifications is left to a future change. The core concept is a disclosure window. A disclosure window is either open or closed. Each disclosure window is associated with a single user notification. All new disclosures either: 1. are dropped if they are emergencies or the notifier is disabled. 2. open a new window if one is not open. 3. are added to an existing open window. A window remains open for some duration, N, after its most recent disclosure. Once N time has passed, the window is closed. If the notifier is disabled, the window is closed. The implementation makes use of a single threaded executor service to offload all work that could eventually result in IPC for notifications sent. The separate thread allows us to ensure that that calls into the notifier won't block, since currently calls happen in Looper threads, which can't block. The single thread allows us to enforce and reason about strictly serialized operations more easily. This is important because semantically, the notification for N+1 disclosures should happen before the notification for N+2 disclosures. Bug: 315818642 Test: atest CellularIdentifierDisclosureNotifierTest Change-Id: I24ccf562fcc6601c4d0523ae4aa2eb9a23a55cbf
Loading
Please register or sign in to comment