238 Commits

Author SHA1 Message Date
TreeHugger Robot
0c8e5b6dda Merge "Fix race condition / test flakiness." into oc-dr1-dev 2017-08-04 20:59:34 +00:00
Sundeep Ghuman
370660915d Fix broken robotests.
In ag/2580164 AccessPoint.java made a reference to WifiTracker, which
in term references WifiNetworkScoreCache. Since the Robolectric in the
platform still has not been updated to support API 26 (Android O), this
caused the test to break.

By definining the class in the test package, the test can be fixed until
proper Android O support is added to the robolectric prebuilts in the
platform code.

Bug: 64217019
Test: make -j40 RunSettingsLibRoboTests
Change-Id: I6cfd5c17d1aba98d43cca4828058493960a7ff79
2017-07-31 18:46:45 -07:00
Sundeep Ghuman
db2eabbbab Fix race condition / test flakiness.
The potential for a race condition exists in WifiTrackerTest,
which intermittently manifests in APCT. By waiting for all handlers
to be idle before asserting our test verification, we can fix this
flaky test. Also added more verification steps to test code to more
precisely indicate where a test may be failing.

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

Change-Id: I597fd7dc29e7f3b0d13c8cdebfa208326a64f507
2017-07-28 15:19:41 -07:00
TreeHugger Robot
d68b6dc56b Merge "Do not evict scan results in cold start." into oc-dr1-dev 2017-07-25 22:41:39 +00:00
Sundeep Ghuman
4205874ec7 Do not evict scan results in cold start.
When starting WifiTracker, show whatever results are available from
platform until new scan results come in. This allows us to show the best
available results from the previous location scan. Once we have resumed
scanning and new scan results come in, the previous logic of evicting
scan results older than 15 seconds applies.

Also prevent unnecessary onConnectedChanged callbacks from being fired,
which may unnecessarily cause UI reloading bars to appear by performing
unnecessary work.

Bug: b/38212080
Test: 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

Change-Id: I3db9d98425b3d2fc66fa0757807a318d0c7456ee
2017-07-24 13:15:23 -07:00
TreeHugger Robot
689359914d Merge "Fix suggestion crash if parser fails to parse dismiss rule" into oc-dr1-dev 2017-07-21 22:59:13 +00:00
Fan Zhang
15ea628204 Fix suggestion crash if parser fails to parse dismiss rule
We store a index value in shared pref to figure out when a suggestion
should be displayed next time. However the rule can change due to
various reasons. When the index and the rule itself go out of sync, we
should not crash.

Merged-In: Id3ea88b6d321434e20ac0cd3e2670524c237e24e
Change-Id: Ied4a0359f9bc22ee94ec79c0591d2671a9c31b86
Fix: 63908636
Test: robotests
2017-07-21 12:57:14 -07:00
TreeHugger Robot
860f185c66 Merge "Don't set AccessPoint with WifiInfo.INVALID_RSSI" into oc-dr1-dev 2017-07-21 02:30:17 +00:00
Glen Kuhne
d38708c1ab Don't set AccessPoint with WifiInfo.INVALID_RSSI
This stops the RSSI of an AccessPoint object being updated from WifiInfo
for the current network, when that WifiInfo does not have a valid RSSI.
This occurs when attempting to connect to a network, and the connection
has not yet been established.
Fixes a UI bug where the signal strength would appear to be zero when
attempting to connect to something, or after failing to.

Bug: 63487286
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
Test: Manual. Attempt to connect to network with bad PSK. Observe Signal
strength does not get set to zero.

Change-Id: Ia5343fb6f0935134e6a4f82034de164342fe55d4
2017-07-20 19:11:59 +00:00
Sundeep Ghuman
75f9480341 Do not clear scores during stopTracking.
Bug: b/63034725
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: Ic15c7f42ec9a3883e8ba34194d9a9410457e4399
(cherry picked from commit 4bb84116636b51bf6925580df569fdeedf6061ae)
2017-07-13 05:52:59 +00:00
TreeHugger Robot
e72ec3cab2 Merge "Change initial value of mStaleScanResults to true." into oc-dr1-dev 2017-07-08 03:06:37 +00:00
Sundeep Ghuman
d2b84a8229 Change initial value of mStaleScanResults to true.
In ag/2409026 we introduced a stale scan result bit to prevent callbacks
from sticky broadcasts from occuring until we have fetched the latest
set of scan results. However, this initial value was set to false hence
there is a race condition in which the currently connected network can
still be shown without any other networks, as the scan results have not
yet been processed.

By changing the initial value to true, we address this race condition.

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

Change-Id: I5f2108e17d2c549e2176ccf64e640fbd4808b5f1
2017-07-07 17:50:44 -07:00
TreeHugger Robot
e59ba746f1 Merge "Fix NPE on network forget from details page." into oc-dr1-dev 2017-07-06 05:16:14 +00:00
Sundeep Ghuman
d911da3adc Fix NPE on network forget from details page.
Forgetting a network from the wifi network details page throws an NPE in
WifiSettings when the details fragment exits, crashing the app.

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

Change-Id: I749ecbda5654ff7a86ffe4c38ca74ebe338923f0
2017-07-05 20:08:26 -07:00
Jack He
6258aae548 Bluetooth: Display battery level of connected devices
* Add handler for BluetoothDevice.ACTION_BATTERY_LEVEL_CHANGED intent
* Check battery level information when UI is updated
* Show battery level in Quick Settings connected device summary line
* Show battery level in Bluetooth Settings connected device summary line
* Show battery level in Bluetooth device details page device summary
  line
* Add unit test for CachedBluetoothDevice, change HeadsetProfile and
  HidProfile to not final to enable mocking

Bug: 35874078
Test: make, unit test, connect to remote devices, connect/disconnect
      profiles
Change-Id: I729048cace73aab29337a8002a2897d2acf22fa6
2017-07-06 01:22:52 +00:00
TreeHugger Robot
6829db0cb6 Merge "Remove IPC calls from synchronized block." into oc-dr1-dev 2017-06-30 01:50:48 +00:00
Sundeep Ghuman
7c32aa3039 Move generatePreferenceKey to AccessPointPreference.
This allows it to be reused in the SavedAccessPointsWifiSettings.

Bug: b/62374459
Test: make -j40 RunSettingsLibRoboTests
Change-Id: Id137f56ceafe461d217c0eee6b571ccfa4eaff1f
2017-06-29 12:51:48 -07:00
Sundeep Ghuman
ce6b0b2539 Move TestAccessPointBuilder.
This is necessary to make it accessible to other test packages, such as
WifiSettingsUiTest.java in packages/apps/Settings.

Bug: 37558394
Test: runtest --path
packages/apps/Settings/tests/unit/src/com/android/settings/wifi/WifiSettingsUiTest.java

Change-Id: Ic1e4185639b2947433d6371e74448097d6adb962
2017-06-29 09:48:44 -07:00
TreeHugger Robot
c93f7b215b Merge "Update WifiConfiguration in AccessPoint." into oc-dr1-dev 2017-06-29 16:20:13 +00:00
TreeHugger Robot
e644b8cfa3 Merge "Clear AccessPoints in WifiTracker when Wifi is Off." into oc-dr1-dev 2017-06-29 05:51:39 +00:00
TreeHugger Robot
f1febb57d8 Merge "Change TRON counters to reflect cl/159755374" into oc-dr1-dev 2017-06-29 05:38:33 +00:00
Sundeep Ghuman
f4d3302b06 Update WifiConfiguration in AccessPoint.
Currently, calling AccessPoint.update(config, info, networkInfo) will
not store the new WifiConfiguration object if it has changed. This can
cause the summary statement to fall out of sync.

Bug: b/38409294
Test: Open WifiNetworkDetails page with verbose logging. Stale state no
longer shown when config changes.
runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java

Change-Id: I86411527472621f86ab691ee772c0b3d2153d01f
2017-06-28 22:24:22 -07:00
TreeHugger Robot
6a62328517 Merge "Add case sensitive sort to AccessPoint compareTo." into oc-dr1-dev 2017-06-29 04:31:36 +00:00
Sundeep Ghuman
e801309908 Clear AccessPoints in WifiTracker when Wifi is Off.
When Wifi is not Enabled, we should clear existing access points. This
avoids showing stale data when wifi is turned back on. Since this method can
now invoke onAccessPointsChanged callbacks, add extra gating for
mStaleScanResults.

Improve test flakiness by waiting for Work and Main handlers to
finish processing messages before continuing.

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

Change-Id: I34faabec01a7188debe3c3b2fe6a0e02f49b320f
2017-06-28 16:18:44 -07:00
Sundeep Ghuman
53200edba1 Change TRON counters to reflect cl/159755374
This updates to the newly defined TRON counters and futures proofs us
for new values. Prior to this change, introducing a new enum would throw
an IllegalArgumentException.

Bug: b/35628911
Test: NA
Change-Id: I46662d53b31858396c9a5a6113b1166fba4dfc51
2017-06-28 14:22:33 -07:00
Evan Laird
e955df17cf Set bolt and plus colors together
Also test to make sure the colors stay the same.

Test: runtest -x frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/graph/BatteryMeterDrawableBaseTest.java
Bug: 62668861
Change-Id: I7d01fd41aeedcb182dc05da8d7b0501a6b5b8539
2017-06-27 19:38:05 +00:00
TreeHugger Robot
be196018e1 Merge "Use BatteryMeterDrawableBase as QS icon for Battery Saver" into oc-dr1-dev 2017-06-26 21:49:04 +00:00
Sundeep Ghuman
266b409d17 Remove IPC calls from synchronized block.
updateAccessPointsLocked holds mLock to avoid concurrent modifications.
When WifiSettings onStop is called, it calls the trackers stopTracking
method, it is also synchonized on mLock, hence the main thread is blocked
until updateAccessPoints finished. If the IPCs take too long, this can
cause an ANR. Refactor the IPC calls outside of the synchonized block to
avoid this condition.

Also mark certain tests as flakey.

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

Change-Id: I2b6aff8fafe859dfc1a5192c2d352a65cfa73cbb
2017-06-26 14:24:32 -07:00
Evan Laird
6f4179c3b8 Use BatteryMeterDrawableBase as QS icon for Battery Saver
This ensures that QS, Settings, and Status bar all use the same drawable
base so they will always look the same. Battery saver is essentially a
full battery that always shows the power saver iconography.

Test: visual; runtest -x
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/graph/BatteryMeterDrawableBaseTest.java
Bug: 62668861
Change-Id: I8a9d5e59c9bb38c0ef794a0ed591195809521f70
2017-06-26 14:20:00 -04:00
TreeHugger Robot
702d4d56fe Merge changes from topic 'wrong_password' into oc-dr1-dev
* changes:
  SettingsLib: set network status for wrong password error
  wifi: add "wrong password" network disabled reason
2017-06-23 18:19:05 +00:00
Sundeep Ghuman
d44b8e4689 Add case sensitive sort to AccessPoint compareTo.
If APs differ only in case, further compare by case.

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

Change-Id: Ic36a2221a668fa59230bb0ddbee2055776d2dc44
2017-06-21 21:51:11 -07:00
Peter Qiu
9c4c6ad6ac SettingsLib: set network status for wrong password error
Bug: 62444625
Test: Manually connect to a WPA network with a wrong password,
      verify "Check password and try again" is shown under the network name

Change-Id: Ic226f4bb9b97969ef7e369de4f7a6976a229ba77
2017-06-21 15:51:29 -07:00
Maurice Lam
b10c6ffbaa Add tintable icon support
Add meta data com.android.settings.icon_tintable so that icons can
be marked as tintable by settings or setup wizard.

Also deprecate com.android.settings.title_res because
com.android.settings.title can do everything it does.

Test: cd tests/robotests && mma
Bug: 62258845
Change-Id: I063be62867dd8a81ab35ff3fe8a85c61e4c6f17d
2017-06-20 22:26:48 +00:00
Jaewoong Jung
78c5e5dd00 Allows to change summary text in a custom view tile.
Now it becomes possible to use META_DATA_PREFERENCE_SUMMARY_URI in
in conjunction with META_DATA_PREFERENCE_CUSTOM_VIEW.

Bug: 62384773
Test: make RunSettingsLibRoboTests -j40
Change-Id: I91401140b2ed0b12c26b91c8fb3d464179e75844
2017-06-16 14:58:27 -07:00
Sundeep Ghuman
73df65acd7 Merge "Create a staleScanResults bit." into oc-dev
am: d1094717a1

Change-Id: I1a4ea5a52093fa2cd9fe1bc321786c349d4c4f11
2017-06-15 05:23:46 +00:00
TreeHugger Robot
d1094717a1 Merge "Create a staleScanResults bit." into oc-dev 2017-06-15 05:19:51 +00:00
Lei Yu
08cd707bad Merge "Revert the time zone display name logic" into oc-dev
am: d9b1697b2d

Change-Id: I0b71a7b1e52c57658b7cef1521b16c15e1f2481d
2017-06-15 02:14:09 +00:00
Sundeep Ghuman
d4a79acdfa Create a staleScanResults bit.
This bit is set to true during stop tracking and will not change until
fresh scan results come in. This bit is used to prevent
onAccessPointsChanged callbacks from being invoked until other new scan
results are processed.

This is necessary to fix a UI issue in WifiSettings during app
resumption where sticky broadcasts from other intents come in before
a new scan result is available, causing us to clear out all shown APs
since the ScanResults are stale and thus removed from the picker.

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

Change-Id: I2f1fd84d1ab3461d9c8eac9511b90ba7533879c1
2017-06-14 15:01:47 -07:00
jackqdyulei
476a9ad871 Revert the time zone display name logic
This cl is a partial revert of ag/1490275, and only
reverts the method getTimeZoneOffsetAndName. Reverting
it because it fails the PTCRB test.

After this revert, it will consistently show the zone
long name in Date & time page (which is the behaviour
in N).

Bug: 62077986
Test: SettingsLibTests
Change-Id: I8174bd7a3de09e476bbffefa6e71d997340dc7d8
2017-06-14 10:07:29 -07:00
Katsiaryna Naliuka
a37ff5ec2f Added a category for lockscreen settings.
Bug: 62487664
Test: Built and flashed a system image, ran RunSettingsLibRoboTests.
Change-Id: I4f2b09622ec221caf9898d03fbad1db354c264ea
2017-06-13 12:34:15 +02:00
Sundeep Ghuman
889e961477 DO NOT MERGE: Kill Wifi Badging in OC.
Speed labeling is turned on in O-DR hence this CL should not be merged
into master. Using the merged in tag below which implements speed
labeling (ag/2346102) to prevent this CL from being merged into upstream
branches which need scoring ui.

Merged-In: I0fd96da6a06dafd8c8ebb435a2725ab155bd26ed

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

Change-Id: I5740f68be25d5ec297f1f7dc3b3e59203cec2eb5
2017-06-07 12:56:33 -07:00
Daniel Nishi
62d4642c2c Merge "Change storage manager default to be a config." 2017-06-06 20:37:41 +00:00
Sundeep Ghuman
55adc6b2fc Add SLOW network and remove deprecated enums.
Stop using deprecated API enums and instead define internal constants
for different network speeds. Add support for 'SLOW' networks.

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

Change-Id: I3394f801118adffcb4ba49035e0b22eebb9f0e9a
2017-06-05 19:18:54 -07:00
TreeHugger Robot
f0daf925b0 Merge "Enable speed labeling based on existing network badges." 2017-06-06 00:47:08 +00:00
Sundeep Ghuman
271e5de583 Enable speed labeling based on existing network badges.
Bug: b/35628911
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java

Change-Id: I0fd96da6a06dafd8c8ebb435a2725ab155bd26ed
2017-06-05 15:59:14 -07:00
TreeHugger Robot
b435250e3f Merge "Move UsageGraph from SettingsLib to Settings." 2017-06-05 22:13:57 +00:00
Fan Zhang
89cff1ab75 Misc fixes in settingslib
Bug: 62039146
Fix: 62138362
Test: make RunSettingsLibRoboTests

- Do not use enhanced loop in lifecycle events to avoid Concurrent
modification exception.
- Tweak footer preference icon layout
- Add some logging to help debug future suggestion issues

Change-Id: I08eb3aca4b776a7d7e5db75dff8f92904d482aa3
2017-06-03 18:24:13 -07:00
Alex Kulesza
d49b6b99c5 Move UsageGraph from SettingsLib to Settings.
In preparation for modifying the graph code to show detailed projections
(see bug), this change moves it into Settings along with related tests
and resources.

Bug: 38400320
Test: manual, make SettingsUnitTests, make SettingsGoogleUnitTests
Change-Id: I88e5336c15827727b3427e29b10954bba9cfba7d
2017-06-02 19:27:54 -04:00
Peter Qiu
18faa022c4 Merge "wifi: add utility function to return saved configurations" into oc-dev am: ca2f8a2b13
am: 64fafcd35d

Change-Id: I1e8e009e6f2230b36a5d831037aa4ef374fb8be5
2017-06-02 20:45:26 +00:00
Peter Qiu
abea726286 wifi: add utility function to return saved configurations
The saved configurations included saved Wi-Fi networks and
Passpoint profiles.

Bug: 62048284
Test: manual test
Change-Id: I55be798d5f36fa678bf69d9f910ca10ed952518a
2017-06-02 10:14:06 -07:00