555 Commits

Author SHA1 Message Date
Aurimas Liutikas
22c3585c54 Remove uses of private Platform class in truth library.
Change-Id: I8d53ddb04fe5bccf70ef9db7bac8b37e34234ff6
Test: None
2018-02-16 16:58:47 +00:00
Sundeep Ghuman
f34217408a Convert forceUpdate to 'onStart' lifecycle event.
Although the AccessPointControllerImpl class is modified, there is no
longer a wifi picker in QuickSettings.

Bug: 68030053
Test: runtest --path
      frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
Manual testing of WifiSettings cold start / resumption scenarios for UI
jank

Change-Id: Ib28edebb0acf4160cc9eda7c1620c1b4280dcdc4
2018-02-15 15:03:53 -08:00
Sundeep Ghuman
dc67f4d26c Change WifiListenerWrapper to WifiListenExecutor.
The executor no longer instantiates it's on main thread handler, and
instead uses ThreadUtils.postOnMainThread.

Also clean up WifiTracker tests, since the custom Handlers have been
removed, and the broadcast receiver method is invoked directly in the
tests, it is no longer necessary to wait for handlers to finish processing
messages.

Although the only asynchronous source code (invocation of WifiListener
methods) is now mockable via WifiListenerExecutor injection,
CountDownLatches used in cases where verifying multiple mock invocations
would be confusing due to test setup behavior.

Bug: 68030053
Test: runtest --path
    frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I485c62d81ec2cdd3d53ed3e258ae6b40837cdc51
2018-02-15 15:03:52 -08:00
Sundeep Ghuman
bcb5373c8b Delete the WorkHandler class.
All work is still performed on the given workThread, just without the
need for a custom Handler class.

Bug: 68030053
Test: runtest --path
    frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: Id4509821e51a1a8e1b171710b33b83212f2a506a
2018-02-15 15:03:52 -08:00
TreeHugger Robot
c0451c36f9 Merge "Unify automatic storage management enabled checks." 2018-02-15 03:46:19 +00:00
TreeHugger Robot
3c71bbcc2f Merge changes from topic "WifiTrackerRefactor"
* changes:
  Consolidate all work in the WorkHandler.
  Remove the double lists in WifiTracker.
  Delete the MainHandler and remaining code.
  Remove methods from MainHandler.
2018-02-15 01:55:37 +00:00
Daniel Nishi
84522e056e Unify automatic storage management enabled checks.
By putting it in SettingsLib, it should be accessible to every app that
needs it.

This also adds in the ability for the framework to define default
behavior. The default behavior for the storage manager enabled status
may differ based upon the device.

Bug: 70893105
Test: SettingsLib Robotests
Change-Id: I9082a77f90289b8fa208c628dd3606000e19495b
2018-02-14 16:06:08 -08:00
Sundeep Ghuman
c5bbecb35d Consolidate all work in the WorkHandler.
Fix flakey tests, and remove indeterminism in tests but asserting all
latches successfully countdown.

Bug: 68030053
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I68f108929d563bc323a28bdfb3c9eb514630630b
2018-02-14 13:40:01 -08:00
Sundeep Ghuman
bb39991c52 Remove the double lists in WifiTracker.
This CL completes the final removal of the double handler, double list,
pending notification complexity that was introduced ag/1396615 as a
'fix' to improper API implementation of the AccessPointListener
callback. The implementation erroneously refetched the entire
WifiTracker list and then performed its own sorting everytime an
individual AccessPoint was updated, instead of waiting for WifiTracker's
WifiListener.onAccessPointsChanged (plural) method instead.

Those changes have now been reverted, and the underlying SetupWizard
code has changed since then such that it does not need to be modified to
prevent regressions.

Bug: 37674366
Test: 1. runtest --path
    frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
2. runtest --path
    frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
3. Manual testing of WifiSettings for visual jank
4. Startup and manual inspection of SetupWizard Wifi Picker.

Change-Id: Ia4079859a7a892983ecf55ba8eab13d20120ff99
2018-02-14 11:52:55 -08:00
Sundeep Ghuman
91f4ccb4b7 Delete the MainHandler and remaining code.
As of ag/3516264 this is no longer required. Next CL will remove the
double lists and pending notification structure.

Bug: 37674366
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
1. Manual testing of WifiSettings for visual jank
2. Start up and confirmation of SetupWizard wifi picker.

Change-Id: I3f2c649375f245295a00177f805d6d3e883fe656
2018-02-14 11:52:55 -08:00
Sundeep Ghuman
c0cf84845a Remove methods from MainHandler.
Followup from ag/3516264 where callbacks are now already invoked on the
main thread. There is no reason to execute this methods on the
MainThread. Removing UPDATE_ACCESS_POINTS in following CL as it has more logic
in that requires careful modification.

Also make changes to how verbose logging is determined (now respects
logging tag as well as developer option) and log callbacks.

Bug: 37674366
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I373af3a65596d478ec25bd2c67a41fc3c7033beb
2018-02-14 11:52:55 -08:00
Beverly
5e65c32218 No alarm warning in dnd dialog if alarms allowed
Test: make ROBOTEST_FILTER=EnableZenModeDialogTest RunSettingsLibRoboTests -j40
Change-Id: I3a60e6e8e603ecf301076c875693e6fccf9d6ff4
Fixes: 73343468
2018-02-14 14:42:19 -05:00
James Lemieux
5c50dc11b8 Use external/robolectric-shadows/run_robotests.mk
This allows SettingsLib to test against the latest framework changes.

Also replaced TestConfig with traditional robolectric.properties.

Also reworked the test runner to avoid using deprecated API.

Bug: 73173204
Test: make -j56 RunSettingsLibRoboTests
Change-Id: Iebe130d6542ed7096147e3fff61f9cfd76aad948
2018-02-12 02:25:13 -08:00
TreeHugger Robot
592ca04056 Merge "Use proper string formatting for the "Active device" string" 2018-02-08 22:47:52 +00:00
Fan Zhang
1c12690fc6 Merge "Move dev option restriction check from app to controller." 2018-02-08 21:51:50 +00:00
Pavlin Radoslavov
e6e080ff5c Use proper string formatting for the "Active device" string
* The hard-coded "active" / "active(media)" / "active(phone)" strings
  are removed and replaced with proper XML-based string formatting.
* Added the appropriate strings for Bluetooth Audio Active Device status:
  "bluetooth_audio_active_device_summaries". For now those strings are
  marked as translatable="false" until the actual UI is finalized.
* Updated all "bluetooth_connected*" strings to include the new
  "active_device" component.
* Added unit tests for the new "active" strings.
  Also, updated existing unit tests to check the getConnectionSummary()
  strings by comparing against strings embedded within the unit tests.

Bug: 72317067
Test: Unit tests added: make RunSettingsLibRoboTests -j40
      Manual: two headsets and switching the active device
Change-Id: Ide639b5dfb45c1db8114155240f193249aeaf3be
2018-02-08 15:53:00 +00:00
TreeHugger Robot
9555c952da Merge "Add shared strings to settingsLib" 2018-02-07 22:15:29 +00:00
TreeHugger Robot
0ac01dd40d Merge "Use framework onNavigateUp() instead of simply finish()." 2018-02-07 22:05:39 +00:00
Fan Zhang
6da958a999 Move dev option restriction check from app to controller.
Dev option is not supposed to show up when there is a user restriction.
However the restriction is sometimes not applied universally. So let's
move the check into controller and avoid handling this logic ad-hoc.

Change-Id: Iab85c90a7c43330abb66bf63dc4c70fb69bc3757
Fixes: 72815875
Test: robotest
2018-02-07 13:35:20 -08:00
Salvador Martinez
eb9ab29ec6 Add shared strings to settingsLib
Now that hybrid notifications exist in SysUI these strings should
be moved into settingsLib so we don't duplicate them. Additionally
several utility methods were moved so that they could be shared to
help keep behavior and strings consistent between different system
components that show battery time remaining.

Test: robotests
Bug: 65656091
Bug: 66909350
Bug: 67469159
Change-Id: Ifdaf02cf39354ed0088560490eabf8b101788a83
2018-02-07 10:55:42 -08:00
Fan Zhang
92a2613353 Use framework onNavigateUp() instead of simply finish().
- Simply finishing activity bypasses the entire nav-up chain, making
  taskAffinity/parentActivity defined in androidmanifest.xml no-op, which
  is bad.

- Also removed showMenu() logic, this is from drawer era and was only
  needed by mobile settings. We no longer need drawer so this method can
  be removed.

Bug: 72337421
Test: atest

Change-Id: Idee1b72751363b5162887a799197404a9498c83e
2018-02-07 10:50:03 -08:00
TreeHugger Robot
2dd7bde961 Merge "Adding warning text to dnd dialog" 2018-02-06 17:09:33 +00:00
Beverly
e975a4242a Adding warning text to dnd dialog
Test: make ROBOTEST_FILTER=EnableZenModeDialogTest RunSettingsLibRoboTests -j40
Bug: 72494029
Change-Id: I581f5da71616573b9b76176fdfc3d5cbbfa47005
2018-02-05 17:44:11 -05:00
TreeHugger Robot
353952fa2a Merge changes I1a1077c1,I7adb6de2,Ieea1af71
* changes:
  Clean up updateAccessPoints.
  Remove unused variables and resulting conditionals.
  Execute all callbacks on the MainThread.
2018-02-02 23:41:49 +00:00
Leif Hendrik Wilden
3b0e0574cd Migrate to lifecycle events from architecture components.
Bug: 70572789
Test: Added unit test. Manual: adb logcat -b events | egrep "(sysui_|notification_)".
Change-Id: If249f16c06ac439c6da1e419142bff6f22ffb0c9
2018-02-01 18:23:32 +00:00
TreeHugger Robot
eabb7e5c5c Merge "Remove double cache eviction logic." 2018-01-29 22:40:43 +00:00
Sundeep Ghuman
0d492e8365 Clean up updateAccessPoints.
Remove obsolete logic, refactor for efficiency and readability. No
longer make redundant, duplicate IPCs.

Bug: b/68030053
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I1a1077c1adaacbd759521451a994a7655befdf58
2018-01-26 18:19:31 -08:00
Sundeep Ghuman
8d157e38f2 Remove unused variables and resulting conditionals.
WifiTracker always is used in 'includeScans' mode, and is never used in
includeSaved mode. The former variable was not even referenced. The
original functionality of includeSaved true and includeScans mode was
for rendering the Saved Access Points page, which is now provided by
another utility. All calling apps currently filter out unreachable saved
networks they receive from WifiTracker.

Subsequent CLs will modify the updateAccessPointsLocked loop to simply
insert config data into existing APs, thus reducing the complexity of
thi class.

Bug: 68030053
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: I7adb6de2e700c48543d7a43419527052f2909cc0
2018-01-26 13:49:35 -08:00
Zhizhi Liu
093518ee51 Merge "Migrate some Suggestions related classes to SettingsLib(I)." 2018-01-26 18:16:42 +00:00
Sundeep Ghuman
04f7f34a71 Remove double cache eviction logic.
WifiTracker and AccessPoint both maintain their own caches of
ScanResults and dictate their own grouping logic. This leads to various
issues, such as dropping APs during network selection. Remove the double
cache eviction logic, making WifiTracker the source of truth for
evicting and grouping ScanResults.

Consolidate on AccessPoint time based eviction logic. In place swap of
logic, with subsequent wifi tracker clean up and cache rekeying to
follow in later CLs. Logic was left as close to original location for
reviewer ease and will be rearranged in following CLs.

Moves existing key generation logic from AccessPointPreference into
AccessPoint.java

BUG: 64989100
Test: runtest runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
make RunSettingsLibRoboTests
make RunSettingsRoboTests
Manual inspection of WifiSettings jitter when changing networks / moving
across floors.

Change-Id: Id30a34b08e14fc8da2c9d29dfcb5d1e8973cc18c
2018-01-26 09:24:45 -08:00
TreeHugger Robot
50bdbe3e2f Merge "Add key to store location changer" 2018-01-25 17:59:24 +00:00
Pavlin Radoslavov
502af2192c Add support for Multi-A2DP state machines per device
* Update usage of A2dpService API calls that take BluetoothDevice
  as an additional argument
* Update the description for BluetoothA2dp.connect()

Exempt-From-Owner-Approval: De-facto owner of the relevant changes is
the Bluetooth team.
Bug: 69269748
Test: Manual
Change-Id: I190ed48ef65bbc8b88b45f84ebd6ab3d21cf0b4e
2018-01-25 11:05:25 +00:00
Lifu Tang
0cba58f5df Add key to store location changer
Store location changer into Settings.Secure

Modify quick settings to identify itself as location changer

Bug: 68779883
Test: Manual
Change-Id: I2c7a599e1383102685994d876e7160e164436a08
2018-01-24 22:30:11 -08:00
Leif Wilden
673892c6c2 Merge "Unrevert "Move instrumentation classes to SettingsLib to share between mobile/TV.""" 2018-01-25 00:35:26 +00:00
Maggie Wang
d2c4f7f610 Merge "Deprecate location modes" 2018-01-24 01:47:54 +00:00
Leif Wilden
5eb7748842 Unrevert "Move instrumentation classes to SettingsLib to share between mobile/TV.""
This reverts commit 2e9781034f796826727a55ad36f8213a8d7452fb.

Reason for revert: NPE now fixed, test added, see b/72267201.

Change-Id: I63cf296675e526776e0bef334d30141ea98904c3
2018-01-23 23:54:05 +00:00
Zhizhi Liu
1a35c133d2 Migrate some Suggestions related classes to SettingsLib(I).
Copy classes to SettingsLib from Settings so the code can be
shared with TvSettings.

Test: mmma SettingsLib/tests/robotests

Change-Id: If2d7db9d998af9d262a5e225c3b7a5cacb053542
2018-01-23 14:07:04 -08:00
Maggie
aa080f9676 Deprecate location modes
1. Mark public fields as deprecated: LOCATION_MODE, LOCATION_MODE_HIGH_ACCURACY, LOCATION_MODE_SENSORS_ONLY,
LOCATION_MODE_BATTERY_SAVING, LOCATION_MODE_OFF.

2. Add new public  methods to LocationManager:
setLocationEnabled(boolean)
isLocationEnabled()
setLocationProviderEnabled(String, boolean)

3. Remove LOCATION_PREVIOUS_MODE and constant
LOCATION_MODE_PREVIOUS. Refactor code that references
LOCATION_MODE_PREVIOUS to use LocationManager.setLocationEnabled or
LOCATION_MODE_HIGH_ACCURACY.

4. Mark deprecated fields and methods as removed: LOCATION_PROVIDERS_ALLOWED, setLocationProviderEnabled(), isLocationProviderEnabled()

5. Refactor logic in Settings app and Quick Settings to call
LocationManager.setLocationEnabled() instead of setting location mode.

Bug: 70990911
Test: Manual
Change-Id: Ia49b385f8b6a358b62291983eb0146af0ecf8e02
2018-01-23 10:45:49 -08:00
Leif Wilden
2e9781034f Revert "Move instrumentation classes to SettingsLib to share between mobile/TV."
This reverts commit 58dccbe1e23c7ecb77c5716fe31d5c9d549124ff.

Reason for revert: Broke fingerprint setup flow. b/72267201

Change-Id: I9901d0ec077ff0a5b50f59a9f1b1c6156f6f09bd
2018-01-22 20:57:21 +00:00
Leif Hendrik Wilden
58dccbe1e2 Move instrumentation classes to SettingsLib to share between mobile/TV.
Test: Compiles. Manually tested.
Change-Id: I8a56e9ee26e45e61435cbb84e7b177221f9d1dde
2018-01-17 15:12:56 -08:00
Fan Zhang
0cc6164081 Fix flaky tests caused by WeakReference
Change-Id: I287195a37aeb0ff781420c2839ffff0391942f76
Fixes: 71867776
Test: robotest
2018-01-16 14:31:51 -08:00
James Lemieux
0f5bba003b Adopt robolectric 3.6.1
Bug: 71596155
Test: make RunSettingsLibRoboTests
Change-Id: I0f8e538238c42fed89bc4778a6a717f2eddac9b7
2018-01-06 00:28:25 -08:00
TreeHugger Robot
dd312ababe Merge "Move debug log summary to WifiUtils" 2017-12-28 19:24:24 +00:00
jackqdyulei
9ee9b39eb4 Move debug log summary to WifiUtils
This cl is the first step to clean up the AccessPoint.

Bug: 70983952
Test: RunSettingsLibRoboTests
Change-Id: I23b5b4bee6f4533ea7e59ede3dc9c66af80bf0b6
2017-12-22 11:42:40 -08:00
Tony Mantler
47394cdbb8 Move ServiceListing to SettingsLib and add tests
Bug: 70902607
Test: RunSettingsLibRoboTests
Change-Id: I172092f8c249e76667136442080d5fd7a6a6ef01
2017-12-21 09:49:30 -08:00
Maggie
704c423ca3 Sort "Recent Location Requests" by recency.
The list of apps with recent location requests is currently displayed in
alphabetical order on device (Settings -> Security & Location ->
Location). Sort this list by recency: (1) apps that are currently
requesting location are displayed  on the top. (2) For apps that are not currently
requesting location, the ones with most recent location request finish
time come first.

Bug: 70350519
Test: Robolectric
Test: manual
Change-Id: I5c757defcd7645d254c9c47e3c83f7e323247a71
2017-12-20 13:56:59 -08:00
Tony Mantler
e105512555 Merge changes from topics "tv-settings-manage-power", "applicationsstate-lifecycle"
* changes:
  Move PowerWhitelistBackend to SettingsLib
  Move ApplicationsState to support lib Lifecycle
2017-12-18 19:45:53 +00:00
James Lemieux
0189ce1b17 Adopt robolectric 3.5.1
Bug: 70581603
Test: make RunSettingsLibRoboTests
Change-Id: I18dd5d74dae0570d2909998a0bab1d812b9f8f6e
2017-12-15 17:49:49 -08:00
Tony Mantler
70676c1c00 Move PowerWhitelistBackend to SettingsLib
Bug: 70716754
Test: RunSettingsLibRoboTests
Change-Id: Ia6f94ff643080499a7631f69b08bc6d525a35162
2017-12-15 15:53:07 -08:00
Michael Plass
992588ca30 Fix flaky WifiTrackerTest
The rssiChangeBroadcastShouldUpdateConnectedAp uses two CountDownLatch instances to
synchronize the events on the main thread and the handler thread. The "latch" informs
the main thread that mockWifiManager.getConnectionInfo() has been called and allows it
to proceed, and "mAccessPointsChangedLatch" notes that onAccessPointsChanged is called.
But mAccessPointsChangedLatch was assigned after "latch" released the main thread,
so that on occasion the main thread could try to use it before this assignment, causing
the timeout.

Move the assignment of mAccessPointsChangedLatch to before the body of the test
to prevent this race.

Bug: 70163367
Test: runtest --path frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
Change-Id: I62c1ef9a2155ffbd08b5e07e94723b28102d1f6d
2017-12-14 05:44:28 +00:00