Should avoid spying on Android classes due to potential test pollution: https://robolectric.org/best-practices/
Bug: 315399487
Test: atest SettingsRoboTests:com.android.settings.homepage.contextualcards.slices --iterations 20
Change-Id: Ia52baf52bf43d3a3959dc0234fbfc5b4a4575dac
- ArrayMap is not thread-safe.
- When accessing the map across threads at the same time, the map may
throw a ConcurrentModificationException.
- Convert the map to a synchronizedMap to avoid the exception.
Fixes: 159813482
Test: robotest
Change-Id: I3b8bdd435c7c546acf736fa8aafd2ceaed94d081
Implement a throttle in SliceBackgroundWorker to control slice updates.
Test: robotest
Fixes: 152366832
Change-Id: I8b65d1b57973e036b932172627aca506f4fae3a4
- Support signing in captive portal APs in WifiSlice
- Show ContextualWifiSlice when signing in is required
- Generifies SliceBackgroundWorker.getInstance() to return <T extends SliceBackgroundWorker>
Fixes: 128056349
Test: make RunSettingsRoboTests -j
Change-Id: Ib4d3942591a65e81018389e4c0bbddfea6854dbc
- AccessPoint treats connected and connecting as equal so slice doesn't
refresh in this case
- Add a new method to determine if two lists are the same in SliceBackgroundWorker
- WifiScanWorker overrides this method to check the access point states
Fixes: 123941320
Test: robotest
Change-Id: I78d610da4b6b1d40f5785ba6701fb71b987fe31c
The NFC Slice would jank on enable and disable, because of the
intent filter it registered with SysUI. The intent filter would
broadcast an update for four states:
1) On
2) Off
3) Turning On
4) Turning off
The first two caused no problems. The third and fourth caused jank,
since when clicked, the switch in the NFC slice would turn on / off
asynchronously - that is, it turned on or off based on the previous
state of the switch, rather than on the actual value of NFC. It does
this to feel fluid in the app in which it is rendered.
From the off state, the order of events is:
1. Switch clicked
2. Switch animates on
2. Background intent is fired to settings to turn on Nfc (happens at
the same time as animation)
3. Settings calls the NFC enable API
4. A broadcast for Turning On is sent
5. The receiver in SysUI gets the broadcast and forwards it to settings
6. Settings tells the Slice to make sure it is up to date
7. The Slice checks for the current value - IMPORTANTLY - which is
currently off, it is only in the process of being enabled.
8. The Slice flips back off
9. Nfc finishes getting enabled in the background
10. The framework pushes the NFC ON broadcast
11. SysUI gets the broadcast, and forwards it to settings
12. Settings tells the slice to update
13. The slice checks again and finds that NFC is on, flipping on.
This CL creates a new background slice worker for NFC and registers
the intent filter there, rather than in SysUI. When the background
worker gets the broadcast, it checks if it is in state 3/4, and if so,
it drops the update silently.
Fixes: 115737701
Test: robotests
Change-Id: I17043828ad3a67a2a5acdf5c75d9cc51ff7e91d0
Build the special case mobile data slice for general use,
and for the Internet Connectivity Panel. The Slice controls
the default data subscription, and links to the subscriptions
page.
Bug: 117804089
Fixse: 119411534
Test: robotests & test app.
Change-Id: I31b524a8fe3182a244d940848090e97250632f39
- Refresh slice in WifiTracker.onConnectedChanged
- Only expose notifySliceChange to child in SliceBackgroundWorker
Fixes: 123270015
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.wifi.slice
Change-Id: Id5540ebae2746e58e14924665c5e62bf437ebcf0
- Two different threads could call SliceBackgroundWorker.getInstance()
at the same time and caused ConcurrentModificationException
- Add a new API overloading getInstance for each slice to get a nullable
worker since there is no result data then
- Only slice provider can create a new worker instance in main thread
Test: robotest
Change-Id: I560529bb6034ec22263418adeb7f3ccebf879196
Fixes: 121043385
The same broadcast are handled in SliceRelayReceiver and WifiScanWorker.
We will only use WifiScanWorker to handle wifi broadcast.
Change-Id: I32c2fcc699ae240f12bd1049ba33e1792ae123b0
Fixes: 120284615
Test: manual
- Create workers via reflection in SliceBackgroundWorker
- Store the workers in a static container and release then at shutdown()
Fixes: 118228009
Test: robolectric
Change-Id: I564277d3a12b2d7d3b50cef091bdfedb3397c145
It's because WifiTracker's initialization and onStop is on different
thread. Fine tune the thread logic in SliceBackgroundWorker.
Fixes: 118165942
Test: manual
Change-Id: Icc86b5df7ec3c6fd0e4a79a62ea0c84465e9528d