Commit Graph

24 Commits

Author SHA1 Message Date
Roshan Pius
3ebfceafa6 settings(nfc): Remove reference to APM setting in NFC page
APM mode no longer affects NFC stack as of Android Q.

Bug: 275381319
Test: atest NfcEnablerTest NfcPreferenceControllerTest
Test: Manual settings page verification
Change-Id: I974a424332eb85e27d51816507183e1ca0def42c
2023-03-29 12:57:32 -07:00
Jason Chiu
2989c50a23 Add highlight menu keys for all toggle pref controllers and custom slices
Bug: 204695404
Test: manual, robotest build pass, unit
Change-Id: Iad2e28ada8ddb766ffa7eff2c8dc581250cbd6f8
2021-11-01 15:00:18 +08:00
Stanley Wang
10b7a7d483 Use MainSwitchPreference to replace the button style switches.
Fix: 177967926
Fix: 177968295
Fix: 177967925
Fix: 177968078

Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Ie854de96e5495fa564fb8a097ed4547bbd2b10c5
2021-02-02 08:39:37 +00:00
Yi-Ling Chuang
430c16c012 Make some existing slices public.
Only PreferenceControllers with isPublicSlice() set to true are exposed
to other apps. Others will be Settings only.

Bug: 141088937
Test: robotests
Change-Id: I5934e89bc1b268fdd44acd630621fa46987728ff
2019-11-28 14:32:15 +08:00
George Chang
6ddff97414 Fix NFC state switched off every time user entered connection preferences page
NfcAirplaneModeObserver added a scenario that
switched NFC off every time  a user entered connection
preferences page if airplane mode was on.
Even when a user manually switched on NFC, the observer would still
turn NFC off when re-entering connection preferences page.

GSAM TS.27 certification requires NFC state to be consistent
under AirplaneMode before and after reboot the device.
NfcAirplaneModeObserver breaks the requirement
because it would always switch NFC off under airplane mode
when a user checked the NFC state in settings page.

Fix it by removing NfcAirplaneModeObserver.
Keep the NFC state consistent.


Bug:128384879
Test: make RunSettingsRoboTests / Check Nfc on/off Status
Change-Id: If4c8e47c2509b09e8bc1a464e1ab329b945e3d20
2019-06-06 17:53:02 +00:00
Matthew Fritze
9e50419c75 Remove NFC Slice jank
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
2019-02-26 08:20:38 -08:00
Fan Zhang
23f8d59d02 Sort imports
Having consistent import order will reduce chance of merge
conflict between internal and external master

Test: rebuild
Change-Id: I0b1a170967ddcce7f388603fd521f6ed1eeba30b
2018-08-28 22:13:15 +00:00
Fan Zhang
c7162cd24d Reorder and clean up imports.
Test: rebuild
Change-Id: I178485c84ae7146f991fd77b6d7504b029942a68
2018-06-18 15:45:09 -07:00
Doris Ling
6776da1cad Do not turn on NFC automatically when airplane mode is off.
- besides checking the value for AIRPLANE_MODE_TOGGLEABLE_RADIOS, also
check the value for AIRPLANE_MODE_RADIOS to determine if we should turn
off NFC when airplane mode is on.
- when user turns off airplane mode, only re-enable the NFC preference
and do not enable NFC by default.
- remove listening to airplane mode directly from the android beam
preference controller, as it is already listening to Nfc state, which
handles the beam state already.

Change-Id: Id41fef15fb2de873729d20d7f53b1a88b164cf95
Fixes: 80217047
Test: make RunSettingsRoboTests
2018-06-13 13:44:15 -07:00
Chihhang Chuang
3b387a028a Refactor nfc preference controller
- Remove BaseNfcPreferenceController.
- NfcPreferenceController inherit from TogglePreferenceController.
- AndroidBeamPreferenceController inherit from BasePreferenceController.
- Override getIntentFilter in NfcPreferenceController to listen changes.
- Add an API (hasAsyncUpdate) into BasePreferenceController to
distinguish the setting which is updated asynchronously.

Change-Id: I7c9c48ea7f1ad01a02524beabf9d30baa3db891f
Fixes: 67997761
Fixes: 74887543
Test: RunSettingsRoboTests
2018-05-23 13:58:28 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
HJ ChangLiao
b247311b2a Move BT, NFC out of Conntection pref
Move BT, NFC preference out of Connection Preference,
To Connected devices page.
Because NFC and Android Beam are controlled by the same controller,
Create each controller for those preference and leave the sharing part.

Change-Id: I8bc303a5f487de9c667487119b49e1e4130aa80c
Fixes: 72458929
Test: manually test, make RunSettingsRoboTests
2018-03-28 09:55:22 +08:00
Fan Zhang
a72620b67b Use setVisible instead of removePreference everywhere.
Change-Id: I2e8084b23d3cb2c0a31a38c01716fc76236734ea
Fixes: 68956750
Test: robotests
2017-11-09 13:22:36 -08:00
Daniel Nishi
85cd1b7d39 Merge "Make nfc toggability logic static and public." into oc-dr1-dev am: b27d65fa55
am: db1158f855

Change-Id: I39a83eff9705f8ed5e66a4ea4aeada9f262d12aa
2017-08-01 23:27:41 +00:00
Daniel Nishi
c0659ea40d Make nfc toggability logic static and public.
Test: exercised in other robotests
Change-Id: Id51c9fd820afd539c1d647feb90eecf73ffbf4a7
2017-07-27 13:06:33 -07:00
Tony Mantler
1d583e125f Make PreferenceController a mixin
Bug: 62912136
Test: Existing tests in BaseSearchIndexProviderTest
Change-Id: Ieda359806c09a019840b2005446c7ec8b61fdb00
2017-06-26 10:58:36 -07:00
Juan Lang
777ed2535a Depend on SettingsLib's version of lifecycle and FooterMixin.
The implementations have been imported into SettingsLib. Setting's copy
can now be removed, which this change also does.

Test: Manually check battery status, which uses FooterMixin, looks OK.
make RunSettingsLibRobotTests && make RunSettingsRoboTests
     && make RunSettingsGoogleRoboTests
Change-Id: I6539605fdad80d156ff5ff249e68df4a1c412067
2017-05-12 11:10:46 -07:00
Ruchi Kandoi
7ca6c2410c Add searchable index for Bluetooth and Nfc only if the feature exists
Test: make RunSettingsRoboTests
Bug: 35657961
Change-Id: Ie2f4722b2b1599981c933f87f95016909ba92022
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
2017-04-24 13:15:35 -07:00
Doris Ling
f2cf2aea37 Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code
and tests.

Bug: 35764802
Test: make RunSettingsRoboTests
Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
2017-03-07 11:15:03 -08:00
Matthew Fritze
2108f91fe6 Implements queryNonIndexableKeys for Settings
queryNonIndexableKeys returns a list of all of the
non-indexable keys for all providers in Settings

Change-Id: Id53cb2f55662e85c66f1c3f0c0e7d933b19fedaf
Fixes: 34623460
Test: RunSettingsRoboTests
2017-01-25 14:33:45 -08:00
Fan Zhang
9b6f181340 Remove no-op handlePerferenceTreeClick from PrefControllers
Bug: 33429853
Test: RunSettingsRoboTests
Change-Id: I5633953e3d7b07f9006e541b96a24a2a769e2686
2016-12-07 15:34:31 -08:00
Fan Zhang
242da31179 Fix logging spam in DashboardFragment.
When updating preferences managed through PreferenceController, the
fragment should skip prefs that are not available.

Bug: 32255863
Test: RunSettingsRoboTests
Change-Id: I2f9b6ddf8c78d40068dc18f07e60672dcba4474a
2016-10-25 17:14:47 -07:00
Fan Zhang
db1112a221 Add progressive disclsoure
- Add a ProgressiveDisclosureMixin that contains all logic for collapse
  preference list when it's too long
- Refactored PreferenceController's updateState to take a preference
  instead of PreferenceScreen, because with progressive disclosure the
  preference can either be in screen or the mixin. DashboardFragment is
  responsible finding the preference before passing it to controller.

Bug: 32255863
Test: RunSettingsRoboTests

Change-Id: I6713abd61c954ce12732902e5b3ca4d4c0b1563e
2016-10-18 16:57:11 -07:00
Doris Ling
e214570abf Add nfc preference controller.
Update connected devices and wireless setting to use the nfc
preference controller for displaying the nfc and bean settings.

Test: RunSettingsRoboTests
Bug: 31800290
Change-Id: I06eee6b7bfe1d8b767216198bd37f1c79e53d992
2016-10-13 17:19:35 -07:00