Commit Graph

241 Commits

Author SHA1 Message Date
Quang Luong
72c56e2c88 Merge "Fix NPE on getTitle()" into qt-dev am: afee5a7219
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15888886

Change-Id: Ib57e720c6c28fe5d24406775ba8832650c8dbd12
2021-09-30 15:23:33 +00:00
cnchen
ced3af1e05 Fix NPE on getTitle()
Bug: 199922685
Test: make RunSettingsLibRoboTests -j40
Change-Id: I35bf6f5911dc0ee56e43af7faddaceb479362863
(cherry picked from commit f00f2203b5)
Merged-In: I35bf6f5911dc0ee56e43af7faddaceb479362863
2021-09-22 22:20:42 +00:00
Arc Wang
6e810df9b8 [Wi-Fi] Fix transition mode problems
1. In AccessPoint#updateBestRssiInfo, if bestResult is available, cache if it’s transition mode at  new variables.
2. Remove SECURITY_PSK_SAE_TRANSITION & SECURITY_OWE_TRANSITION since we will cache if an Wi-Fi AP is transition mode.
3. Enhance getSecurity(ScanResult result).
   For a PSK/SAE transition mode ScanResult, return SAE.
   For a open/OWE transition mode ScanResult, return OWE.
4. Enhance all AccessPoint#matches methods
5. Use enhanced AccessPoint#matches to replace AccessPoint#isKeyEqual
6. In WifiTracker#updateAccessPoints, it associates an AccessPoint with a configured WifiConfiguration
   I. If an AccessPoint is PSK/SAE transition mode, update it with a configured network
      of the same SSID and PSK/SAE security if it’s available. (SAE has higher priority).
   II. If an AccessPoint is Open/OWE transition mode, update it with a configured network
       of the same SSID and open/OWE security if it’s available. (OWE has higher priority).

Bug: 144320676
Bug: 144320649
Bug: 144325162
Bug: 144321574
Test: atest SettingsLibTests
      manual: In Wi-Fi picker
              1. Save a PSK network, click a PSK/SAE transition mode AP of the same SSID,
	         it should connects.
              2. Save a SAE network, click a PSK/SAE transition mode AP of the same SSID,
	         it should connects.
              3. For 1. and 2., the transition mode AP should show 'Saved'.
	      4. For 1. and 2., looking at saved network page, each saved network should
	         shows correct connection status of the transition mode AP.

Change-Id: Ida858af791bc60f0ccb11025901de2a79eacba3c
Merged-In: I9688f51f4a4b8e3d5c080fb0d0103abb4e3fd79b
2019-12-09 19:17:23 +08:00
Philip P. Moltmann
a4bd150588 Whitelist all perms on installExistingPackage
The code allows to also whitelist only a select set of permissions, but
this is not yet exposed in the API.

Also: Fix up shell commands for restricted permissions

Fixes: 132368462
Test: - Enabled app via device admin in secondary profile
        -> verified that permissions were whitelisted
      - Installed existing and new app using --restrictpermissions and
        not
	-> verified that permissions were whitelisted or not
      atest AppRestrictionsHelperTest
            RestrictedPermissionsTest
Change-Id: I9cd76c555b40663f2e25ad86e8a54991baae346c
Merged-In: I9787e63d8beb8f6b1ba2d15532d4c0f69dbdf863
2019-05-15 11:09:45 -07:00
Quang Luong
e747f59665 Update Passpoint R1 AccessPoint with R2 config
Made sure to update the WifiConfiguration of a Passpoint AccessPoint
to update the friendly name if a user installs an R2 config over an
R1 config.

Bug: 131840803
Test: atest WifiTrackerTest
Change-Id: I39cd5679b65240dabee0f67df866e34d1700c769
2019-05-02 11:43:06 -07:00
clownshen
78be6541d6 Provide "Disconnected" in summary for detail page
Wi-Fi detail page need to use "Disconnected" instead of "Saved" to
improve UX.

Bug: 131119614
Test: atest AccessPointTest
Test: manual test
Change-Id: I8e1cec3c64a3118f6a7448b7ec233cd4d9a92942
2019-04-25 06:07:13 +00:00
Ying Zheng
6e54927990 Remove the deprecated UserManagerHelper, new one is in car user lib.
Test: build
Bug: 130313554
Change-Id: Iee5282a9a40935c43dc1b4cb7814a67ac4324d7c
2019-04-11 10:20:34 -07:00
Quang Luong
089c54316b Merge "Connect to Passpoint network immediately after OSU provisioning" 2019-04-01 17:55:36 +00:00
Quang Luong
85bbc6e0a0 Increase ScanResult cache eviction timeout for failed/aborted scans
Currently ScanResults are evicted from WifiTracker's cache when they
are more than 15 seconds old. Since scans are conducted every 10
seconds, one aborted scan will cause no fresh scans to be seen until
20 seconds later, resulting in all scans to be evicted and the
wifi-picker completely emptying.

This change doubles the eviction timeout to 30 seconds if the last
scan was aborted, avoiding this case.

Bug: 113132408
Test: atest WifiTrackerTest
Change-Id: I2e3aad3a1470f52c3d87e657262a2c4de1bd2418
2019-03-29 11:19:59 -07:00
Quang Luong
7cfa527511 Connect to Passpoint network immediately after OSU provisioning
Added logic in the OSU provisioning callback to connect to a
network immediately after provisioning is complete.

Bug: 123697580
Test: atest AccessPointTest
Change-Id: I39d1ec9726d6211ebd385931e19322bde58baafa
2019-03-28 12:39:32 -07:00
TreeHugger Robot
057e7894ff Merge "Removed duplicate Passpoint entries in saved networks page" 2019-03-13 06:39:22 +00:00
Quang Luong
6e711c80ff Removed duplicate Passpoint entries in saved networks page
The AccessPoint constructor for PasspointConfigurations was not
setting the AccessPoint key. This caused the Saved Networks Page to
not be able to correctly reference the entries for saved Passpoint
networks, causing entries to not disappear after clicking "forget",
or creating duplicate entries whenever the activity was resumed.
Fixing the key updating/getting for PasspointConfigurations solves
this issue.

Bug: 118705403
Test: atest AccessPointTest
Change-Id: I0e49192ef5efa72fd490e4a0ac987e1c0682e3f3
2019-03-07 15:26:44 -08:00
Quang Luong
19429e438a Changed AccessPointPreference setTitle to use getTitle()
AccessPointPreference now uses getTitle() as the single method
for the UI title. The saved network case is now also handled by
getTitle().

Marked getConfigName as deprecated in order to encourage use
of getTitle() as the definitive UI title for AccessPoints.

Test: atest AccessPointTest && atest WifiTrackerTest && atest
WifiSettingsTest.
Bug: 118705403

Change-Id: Ieaaef804e46f2eed2543e658aee030021b7d08df
2019-03-07 13:38:06 -08:00
Quang Luong
8123f7717a Added special constructors for Passpoint and OSU AccessPoints
Created separate constructors for Passpoint and OSU, and a separate
scan result update function for Passpoint. Added roaming scans to
full scan result list. Added tests for different AP type behaviors.

Bug: 122849296
Test: atest AccessPointTest
Change-Id: Ie69e08bfb8b997c7b46a9d114969f12c6f03c16c
2019-03-05 16:02:39 -08:00
Quang Luong
1f1207b5dd Fixed wifi picker active network detection for Passpoint
Determining the active access point at the top of the picker
depended on matching the connection info with a saved configuration.
With Passpoint configs being removed from getConfiguredNetworks, the
matching of Passpoint access points must be done solely through the
current WifiInfo.

Bug: 118705403
Test: atest AccessPointTest

Change-Id: Ia9f5a0d7d7dca26d02a1e747edbf08ecbbec91dd
2019-02-28 12:33:37 -08:00
Quang Luong
da49e822b4 Added unit tests for Passpoint/Osu integration in WifiTracker
Separated Passpoint/OSU AP update logic from updateAccessPoints()
and added tests.

Test: atest WifiTrackerTest
Bug: 122849296
Change-Id: Ib4eafd58a608480140f0eb4e79c0b6d3cdb2e5a8
2019-02-11 13:28:29 -08:00
Roshan Pius
bd8c27ee36 Merge "AccessPoint: App attribution for suggestion/specifier" 2019-01-30 03:03:20 +00:00
Roshan Pius
e9b8e50774 AccessPoint: App attribution for suggestion/specifier
Use the wifiInfo field to attribute the app that provided the network
suggestion or specified that provided the connection.

Bug: 115504887
Bug: 113878056
Test: atest AccessPointTest WifiTrackerTest
Test: Manual UI verification
Change-Id: Ibea13207622245efc198dc51957cac9f6e2dc526
2019-01-29 10:23:46 -08:00
Amin Shaikh
10f363bb18 Move SettingsLib icons to android.
Bug: 122263617
Test: make
Change-Id: I11ce02f3f65f429fd4375a5522c060c8080f4813
2019-01-25 15:26:41 -05:00
KOUSHIK PANUGANTI
63bf06e2ac Migrate frameworks/base/packages/SettingsLib/tests/integ to androidx.test
See go/jetpack-test-android-migration

Test: make checkbuild
Change-Id: Iee19990c0fe06c9f9e3cf78348323c0ee9d1a900
2018-12-18 14:26:21 -08:00
jovanak
206d6e4475 Makes LocalBluetoothManager multi-user aware.
It enables LocalBluetoothManager to receive broadcasts for a specific
UserHandle, not just the one that created it, by exposing an additional create
method.

To pass in UserHandle different from the one returned in context.getUser(),
one must have INTERACT_ACROSS_USERS_FULL permission.

Should be used by singletons with adequate permissions to be able to monitor
bluetooth state across all users.

For monitoring the state across all users, pass in UserHandle.ALL.

Change-Id: Id89d73b05bfebc2f9e8673c5610b3ff8f70dba0c
Fixes: 117517726
Test: working on them
2018-10-25 14:08:51 -07:00
jackqdyulei
396e52d5f6 Always evict old scanResults(> 15s) in WifiTracker
When fragment is created, it will force display all the APs
from mWifiManager.getScanResults, where it may have obsolete APs.

This CL will evict old scanResults even in this force display, so
it won't show obsolete APs anymore.

Also change the buffer size from 25s to 15s so it only display APs
scanned in last 15s.

Bug: 111738605
Test: SettingsUnitTests
Change-Id: I9413bcba81dba55c6b13cfdca2785069d4d7d105
2018-09-20 14:58:20 -07:00
Evan Laird
2bcdbe0bce Remove test for battery percent paint being equal to bolt paint
BatteryMeterView used to draw both the charging bolt and the powersave
'+' symbol as the same color. However the plus sign is drawn as
colorError now, so the test isn't needed anymore.

Test: runtest  -x packages/SettingsLib/tests/integ/src/com/android/settingslib/graph/BatteryMeterDrawableBaseTest.java
Change-Id: I014fbc65d96bed727e880ac492913c2e5d50f405
Fixes: 112205156
2018-08-06 17:48:51 -04:00
Fan Zhang
23baea9b5f Remove unused fields and move ProfileSelect to Settings
Bug: 77600770
Test: rebuild
Change-Id: I34bbf888324901f707fba13274196a4b1ca846da
2018-08-02 13:53:33 -07:00
Fan Zhang
83dde97b30 Add activityInfo and getIcon() method in Tile class.
Moved loading icon logic from TileUtils into Tile#getIcon().

TileUtils only load things once and cache forever but getIcon()
loads a fresh icon every time to avoid any caching issue.

Bug: 77600770
Test: robotests
Change-Id: I706225e382ebd5b72e91edef43bfc7427fa64590
2018-07-25 14:53:32 -07:00
Fan Zhang
416dd57fa2 Delete SettingsDrawerActivity entirely.
Bug: 77600770
Bug: 110259478
Test: rebuild
Change-Id: I48e6c3c96b3e708719e21eac3cc6c12b9dc54177
2018-07-20 10:28:49 -07:00
pastychang
a2998fc3ee Remove TtsSpan from Ssid
Telephone type span caused talkback stop to read next texture in Setupwizard wifi page. Remove it and doesn't impact previous issue ag/1468171.
New Google TTS can recognize work and doesn't only spell words.

Test: atest
Bug: b/110104543
Change-Id: I4f37a6280294446e5f33ea3620366803b6d30a4e
2018-06-27 02:45:45 +00:00
Fan Zhang
cd63e94186 Merge "Update misc settingslib icons" into pi-dev am: ee555d5f90
am: 2f8f73e98c

Change-Id: I1db25982e492ae94c5d950bb030af5e0bf1569c3
2018-05-15 20:02:10 -07:00
Fan Zhang
eb0c976995 Update misc settingslib icons
- new icon size for edit pencil
- removed home.xml, it's not needed by anything except test

Bug: 77982107
Test: visual
Change-Id: I451bc12c4a57e5f61e7c561c394b00bd95e7228d
2018-05-16 01:38:39 +00:00
android-build-team Robot
aab0b2f06b Merge "Make isValidSystemNonAuxAsciiCapableIme stateless" 2018-04-27 22:49:40 +00:00
Yohei Yukawa
4faac7d9ef Make isValidSystemNonAuxAsciiCapableIme stateless
This CL simplifies SettingsLib by making
isValidSystemNonAuxAsciiCapableIme() method stateless.

Although this can be a minor user-visible behavior change, we believe
it is acceptable because the behavior we are going to drop is a
fallback rule in case there is no system IME that could be considered
ASCII capable without actual AsciiCapable attribute..  Even without
this fallback rule the System Settings does not fall into a bad state.
It only affects the sort order of the IME enabler page and minor
optional cosmetic behavior.

The bottom line is that if a pre-installed IME is ASCII capable, it
really should annotate itself to be so, rather than relying on some
heuristic logic that we have had.

With this CL, SettingsLib no longer depends on InputMethodUtils.

Fix: 77730201
Test: atest InputMethodPreferenceTest
Test: make RunSettingsLibRoboTests -j
Change-Id: I1352bf42dcb9219a370a16a381ea39c43c57637a
2018-04-27 14:00:06 -07:00
Jovana Knezevic
317f7de44c Merge "Fixes null-ref when trying to start Guest session." into pi-dev am: 8491304cf6
am: 9df8e55021

Change-Id: Ie1b89ca436d97718d01b7d9382e8a68513736f44
2018-04-26 13:07:56 -07:00
jovanak
6639c4dfa1 Fixes null-ref when trying to start Guest session.
CarUserSwitchingDialog threw null-ref because Guest didn't have
a default avatar.

1. Adds null guard in case default avatar is not set.
2. Populates default Guest avatar correctly.

Fixes:77546931
Fixes:78588087
Test: Manual, observing the default icon when starting a guest session.
       Manual, observing the switching dialog icon without a default icon.

Change-Id: Iacbfcc65147fdbc5515c0d96eb613fb17543f6b3
2018-04-25 16:10:59 -07:00
TreeHugger Robot
a47c03960b Merge "Make getLanguageFromLocaleString private" 2018-04-18 19:01:05 +00:00
Yohei Yukawa
e9eff660e0 Make getLanguageFromLocaleString private
As part of effort to lock down the use of InputMethodUtils only within
the core system components, this CL removes the dependency on
InputMethodUtils#getLanguageFromLocaleString() from the Settings UI
code.

At high level, there should be no user visible behavior change.

Bug: 77730201
Test: atest SettingsLibTests:com.android.settingslib.inputmethod.InputMethodSubtypePreferenceTest
Change-Id: I92cc0b0808f3e40ab92b60ec783ad218141f2bbd
2018-04-13 16:28:20 -07:00
Nader Jawad
6a8727ebce Updated UserIconDrawable#shouldUpdateColorFilter to return true if
current ColorFilter was not an instance of PorterDuffColorFilter

Fixed issue where UserIcondrawable#shouldUpdateColorFilter would
mistakenly return false if the current ColorFilter was not a
PorterDuffColor filter leading to color tints to not be applied if no
ColorFilter was applied previously.

Change-Id: I463932403723b2542cb79e4d996b5ffdc4c32f98
Fixes: 77907724
Test: Re-ran atest on UserIcondrawable
2018-04-12 16:18:00 -07:00
Jovana Knezevic
ccb8eb3858 Merge "Adds user broadcasts to UserManagerHelper." into pi-dev 2018-04-11 22:20:33 +00:00
jovanak
82029aedff Separates current process user and foreground user
User switcher wrongly called methods on the current process user,
which is always User 0 for SysUI.

Instead, user switcher requires knowledge about foreground user.
The process of user switching = changing the foreground
user.

Split tests between unit and robolectric.
Robolectric tests enable shadowing ActivityManager and UserHandle.

Fixes:77485524
Test: Unit and robolectric tests.
Change-Id: I20cc32f132ce48b4507a6907bdc9d103c04f4a30
2018-04-11 11:45:09 -07:00
jovanak
5e523fa378 Adds user broadcasts to UserManagerHelper.
Same broadcasts supported by UserSwitcherController.

Car User switcher listens to user changes.
Switcher needs to hear when the user is switched to dismiss the
keyguard,which causes the switching animation to terminate.

Bug:77653809
Test: Unit tests.
Change-Id: I633cbd9045e7254dcc173ca0e1118fca06c669df
2018-04-11 17:18:19 +00:00
Nicolas Geoffray
b0284fb5de Exempt tests for hidden APIs.
Bug: 64382372
Bug: 74963051
Test: m
Change-Id: I5234dd6230f2bdd6ffccbf12b25a02d929d20161
2018-04-06 14:54:39 +01:00
jovanak
12f105e54a Adding user accessor functions to UserManagerHelper.
Fixing a failing test. Currently unable to test removing current user, since current user is system user.

Fixes: 73415209
Test: unit tests
Change-Id: Ie374aa97383e3dd8ec4ef96b0d680fa8a04172b5
2018-03-29 15:28:31 -07:00
Jovana Knezevic
c7034f7ab1 Merge "Adding UserManagerHelper class to SettingsLib." into pi-dev 2018-03-21 19:34:32 +00:00
jovanak
10a5d7fe22 Adding UserManagerHelper class to SettingsLib.
It's a simple wrapper for adding/removing/switching users.

It provides an interface to register listeners for user changes.

Moving it here to be used in CarSettings and SystemUI for the car.

It's not car-specific, so it could be used by anyone who needs it.

Fixes: 74456332
Bug: 74456744
Test: Unit tests in UserManagerHelperTest.java.
Change-Id: I94b3051ed1e4f96d98e5ab2a7a5a7fa75bc5cade
2018-03-20 13:51:35 -07:00
Sundeep Ghuman
93d591bccb Prevent callbacks after onStop is called.
Bug: 74196862
Test: runtest --path
frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java

Change-Id: Idab27f7d493fdd097d55aac40750912e454addb2
2018-03-19 16:31:48 -07:00
Sundeep Ghuman
5fde6405f8 Add tests to prevent NPE regression.
Bug: 73484770
Test: runtest --path frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/AccessPointTest.java
Change-Id: Idd909dc3ac78ba9ed75ff06040b2c0842a7c74b8
2018-03-12 12:59:24 -07:00
Anton Hansson
d137c872cd frameworks/base: Set LOCAL_SDK_VERSION where possible.
This change sets LOCAL_SDK_VERSION for all packages where
this is possible without breaking the build, and
LOCAL_PRIVATE_PLATFORM_APIS := true otherwise.

Setting one of these two will be made required soon, and this
is a change in preparation for that. Not setting LOCAL_SDK_VERSION
makes the app implicitly depend on the bootclasspath, which is
often not required. This change effectively makes depending on
private apis opt-in rather than opt-out.

Test: make relevant packages
Bug: 73535841
Exempt-From-Owner-Approval: Global cleanup
Change-Id: I26458e41ecb84de91ac9a356a5d4bafb44f463c1
2018-03-07 11:42:04 +00:00
TreeHugger Robot
008c4dbcf9 Merge "Display connected AP when there are no scanresults" 2018-02-26 21:23:12 +00:00
Andreas Gampe
7dbcb8fc87 SettingsLib: Fix assertThat in test
Truth.assertThat is a fluent-style API. Fix the tests to actually
do something.

Found by errorprone.

Bug: 73513670
Test: atest WifiTrackerTest
Test: m javac-check RUN_ERROR_PRONE=true
Change-Id: Ic16cded73ad5192d6c32033e41e72e39277729c6
2018-02-26 11:36:41 -08:00
Sundeep Ghuman
06ec3bed0e Display connected AP when there are no scanresults
Bug: 68030053
Test: runtest --path
    frameworks/base/packages/SettingsLib/tests/integ/src/com/android/settingslib/wifi/WifiTrackerTest.java
1. Visual verification of UI when opening WifiSettings directly from
screen off longer than 5 minutes (no scan results scenario).

Change-Id: I7e4d9a3abb861b485b0a952a1a4b822f2460bdc2
2018-02-21 16:44:51 -08: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