271 Commits

Author SHA1 Message Date
Sundeep Ghuman
2fd9ad068a Merge "Merge "Do not evict scan results in cold start." into oc-dr1-dev am: d68b6dc56b am: f5b7da9b32" into oc-mr1-dev-plus-aosp
am: c8d5463923

Change-Id: Ia3e0d750ab8f7541700b2a99b3b10bea2b826565
2017-07-25 23:47:18 +00:00
Sundeep Ghuman
f5b7da9b32 Merge "Do not evict scan results in cold start." into oc-dr1-dev
am: d68b6dc56b

Change-Id: If442689c6a05ad261a846a5252d9a0256520508e
2017-07-25 23:05:11 +00: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
Fan Zhang
d30c05c293 Make a helper method to post work to ui thread.
Bug: 36131513
Bug: 63896139
Test: robotests
Change-Id: If7154f17926f86157816987221f449a48ae6fd4e
2017-07-21 17:05:09 -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
7b77cf8938 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.

Change-Id: Id3ea88b6d321434e20ac0cd3e2670524c237e24e
Bug: 63908636
Test: robotests
(cherry picked from commit 4d37a1a1e1ca902b8a65bce64fafa0eeea51a4dd)
2017-07-21 22:11:41 +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
Fan Zhang
4d37a1a1e1 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.

Change-Id: Id3ea88b6d321434e20ac0cd3e2670524c237e24e
Bug: 63908636
Test: robotests
2017-07-21 12:53:00 -07:00
Glen Kuhne
a8b74c8c1e Merge "Don't set AccessPoint with WifiInfo.INVALID_RSSI" into oc-dr1-dev am: 860f185c66 am: 640f04ef38
am: d6d285ecca

Change-Id: I6c97db37a23d73fee9e8511d62702e4e0e900a13
2017-07-21 02:50:11 +00:00
Glen Kuhne
640f04ef38 Merge "Don't set AccessPoint with WifiInfo.INVALID_RSSI" into oc-dr1-dev
am: 860f185c66

Change-Id: I9069d51fa6214d9b78c04eea6ab6adebff13ca2e
2017-07-21 02:37:58 +00: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
Eric Schwarzenbach
0b431c9af2 Sort APs by Speed label value instead of ranking score.
This prevents unintuitive sorting if the ranking score (somehow)
sorts differently from the speed label.

This change also fixes a broken test in AccessPointTest.java
'testSummaryString_showsSpeedLabel()'.

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

Change-Id: I4a9e55950541ddbf32e01508484bd40326ef228e
2017-07-20 10:38:12 -07:00
TreeHugger Robot
de82accc3a Merge "Use scores from connected AP only." 2017-07-20 01:26:44 +00:00
Sundeep Ghuman
a28050ae42 Use scores from connected AP only.
When connected to a specific base station, show the speed label for that
specific access point, rather than the best label for all similar access
points in the area.

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

Change-Id: Ic3b3c5838ca8b43daa226335125bb8046dee3884
2017-07-19 16:30:19 -07:00
Fan Zhang
60b850de5e Add Wifi's security type to contentDescription
Change-Id: I0c1945fd8776814ddf0097c0c1f27ed4dd1c73b2
Fix: 63805288
Test: robotests
2017-07-19 09:22:49 -07:00
Tony Mantler
09bd539969 Merge changes from topic 'AdbEnableController'
* changes:
  Add ADB enable/disable PreferenceController
  Move to newer mockito/robolectric
2017-07-17 20:26:41 +00:00
Tony Mantler
ec4bae9d86 Add ADB enable/disable PreferenceController
Bug: 34203528
Test: EnableAdbControllerTest
Change-Id: I6bff5fccf4a299df3da46a593bc36447945571c3
2017-07-14 15:39:47 -07:00
Tony Mantler
8d167378e3 Move to newer mockito/robolectric
Also fix TileUtilsTest, it broke with the newer mockito

Bug: 34203528
Test: This is the test
Change-Id: I714860795ec0b344cb89a95600a4365893c4f8d7
2017-07-14 15:39:40 -07:00
Jeff Sharkey
43d2a1700b Move "metered" persistence to WifiConfiguration.
For a long time we've had a nasty tangled dependency between Wi-Fi
and NPMS, since they both persisted different details for configured
networks.  As part of preparing for new carrier data plan APIs, move
the tracking of meteredness over to WifiConfiguration.

This also cleans up how meteredness is communicated through
NetworkAgents to rely completely on NET_CAPABILITY_NOT_METERED by
removing the metered flag on NetworkInfo, which has caused confusion
and staleness.

Migrates any existing user-configured metered networks over to
WifiConfiguration once the device finishes booting.

Remove support for NetworkQuotaInfo, since this information can no
longer be made available to apps.  Frustratingly, some apps are
using it, so keep the object around returning stub values, and shame
them in the logs.

Bug: 63391323
Test: builds, boots, Wi-Fi policy is upgraded
Exempt-From-Owner-Approval: Bug 63673347
Change-Id: I64f865ddeb65cfcd330f8d2a847368abdf960a07
2017-07-14 11:46:31 -06: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
Sundeep Ghuman
4bb8411663 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
2017-07-12 19:12:30 -07:00
Sundeep Ghuman
45a4fd3c31 Merge "Change initial value of mStaleScanResults to true." into oc-dr1-dev am: e72ec3cab2
am: 335a2d7e3c

Change-Id: I4b09fe0fbcecc562ced0ed2a6793b2ae87b0f731
2017-07-08 03:18:43 +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
Joe LaPenna
a6ded21add Revert "Change initial value of mStaleScanResults to false."
This reverts commit bd5410fa4845b9975e8544071d5e590adf5db0f0.

Reason for revert: Changelist description was incorrect, which can cause issues when debugging and reading commit logs, in the future.

Change-Id: Ic70c5f1822ab6f1b77486097fadcf3bdf3484e32
2017-07-07 20:44:51 +00:00
Sundeep Ghuman
bd5410fa48 Change initial value of mStaleScanResults to false.
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 true 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 false, 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: I82ff8d6c547f1bec4ebfe9b768e6b12435a400ee
2017-07-06 14:03:43 -07:00
Sundeep Ghuman
94f5aecadd Merge "Fix NPE on network forget from details page." into oc-dr1-dev am: e59ba746f1
am: 58b665f4b5

Change-Id: I9b7e87ef5f398189666b747471eeee5f197403be
2017-07-06 05:31:03 +00: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
Jack He
cba3a9dc39 Bluetooth: Display battery level of connected devices am: 6258aae548
am: 199849631b

Change-Id: I56f073605bc0f4223a1c0f3a385977e2b7c44879
2017-07-06 03:29:48 +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
Sundeep Ghuman
8111fdb208 Merge "Remove IPC calls from synchronized block." into oc-dr1-dev am: 6829db0cb6
am: e26118d84c

Change-Id: I4e28ee323606976d7b224c62b7bfcb30b1671bc1
2017-06-30 02:05:30 +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
db7de0f051 Merge "Move generatePreferenceKey to AccessPointPreference." into oc-dr1-dev am: 635575d579
am: b7c4518d57

Change-Id: I7da1349402f57d94f450a0d1d4e85864a1fafb5d
2017-06-30 00:12:32 +00:00
Sundeep Ghuman
42134c05d5 Merge "Move TestAccessPointBuilder." into oc-dr1-dev am: 80139bfc4d
am: 2a3219af74

Change-Id: I131be0573105670b8230f41f77fce83cac6b82ba
2017-06-29 20:43:43 +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
Sundeep Ghuman
d82ba18e1e Merge "Update WifiConfiguration in AccessPoint." into oc-dr1-dev am: c93f7b215b
am: 02a5c039ff

Change-Id: I82d1c1e7a4f1e1ece43aa8b02f4650c92d8dc82f
2017-06-29 16:34:53 +00:00
TreeHugger Robot
c93f7b215b Merge "Update WifiConfiguration in AccessPoint." into oc-dr1-dev 2017-06-29 16:20:13 +00:00
Sundeep Ghuman
06dd9f7abc Merge "Clear AccessPoints in WifiTracker when Wifi is Off." into oc-dr1-dev am: e644b8cfa3
am: f435039ef5

Change-Id: Ifaa8027439327c8c71afa9dc23d38946ceebc86c
2017-06-29 06:06:45 +00:00
Sundeep Ghuman
2d7d9263a5 Merge "Change TRON counters to reflect cl/159755374" into oc-dr1-dev am: f1febb57d8
am: 3ead3dc1df

Change-Id: I1fcf7c560e899e66f3d2813108b9960122326b88
2017-06-29 05:55:16 +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
Sundeep Ghuman
5e571387bb Merge "Add case sensitive sort to AccessPoint compareTo." into oc-dr1-dev am: 6a62328517
am: 08af7417c7

Change-Id: I9adc1886593006cd53911ec63a2a0ccda730d3e9
2017-06-29 04:49:06 +00: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