Commit Graph

59 Commits

Author SHA1 Message Date
Raff Tsai
e82ae9c3e5 Merge "Show charging speed in Settings" 2020-02-07 00:53:09 +00:00
Tsung-Mao Fang
9e9910267a Create a util method to get icon badged.
In order to prevent DoS attack from icon size,
we're usinga system lib to help convert any loaded
drawable into a flattened bitmap with an appropriate size.

Test: Rebuild
Bug: 33646131
Change-Id: I92e76fb4e4c23c4995f63ebd2df8cbe0a349fbce
2020-02-06 16:55:12 +08:00
Raff Tsai
f4ea5626c9 Show charging speed in Settings
- Move BatteryStatus from KeyguardUpdateMonitor to SettingsLib
which can be used in Settings and SystemUI
- Add string to support show rapid and slow charging in Settings
- Move config from res-keyguard to SettingsLib

Fixes: 79559900
Fixes: 66573773
Test: manual, make RunSettingsLibRoboTests
Change-Id: I2ffd902743819f999ee3a10bbadc2d3ca45495c2
2019-12-27 11:00:09 +08:00
SongFerngWang
2670cba687 mainline:Replace serviceState.getDataRegState and getVoiceRegState
Replace serviceState.getVoiceRegState with getState
Replace serviceState.getDataRegState with getDataRegistrationState

Bug: 146637978
Test: atest NetworkControllerBaseTest (PASS)
atest CarrierTextControllerTest (PASS)

Change-Id: I0cbdfd5d3de3a78326703ede1640f01430bae18a
2019-12-23 22:54:09 +08:00
SongFerngWang
e641c9b019 [Mainline] decouple ServiceState.getDataNetworkType()
Use NetworkRegistrationInfo.getRegistrationState() to
replace serviceState.getDataNetworkType() inside getCombinedServiceState

Bug: 146473838
Test: atest frameworks/base/packages/SettingsLib/tests/robotests/\
src/com/android/settingslib/UtilsTest.java (PASS)

Change-Id: Iddf23778be5d275c76ad01bfbac8f4ed0c655331
2019-12-18 18:26:05 +08:00
Soonil Nagarkar
fb6b187bfb Remove obsolete constants.
These constants are not in use anywhere.

Test: na
Bug: 137675020
Change-Id: I9f1b2101b75779ff2f9c5f9d945189eccff782ae
2019-07-19 02:09:11 +00:00
Raff Tsai
c9e26ba70c Fix Disabled text color in dark theme
disabled_text_color is similar to background color in dark theme.
Use text color multiply disabledAlpha to get disabled text color.

Fixes: 137639665
Test: manual
Change-Id: I00bb1dbedd0032001c2fc325b412dacb08f84132
2019-07-18 09:53:00 +08:00
Soonil Nagarkar
32bee192b4 Remove dead code
Bug: 118883513
Test: manually
Change-Id: I0bbdfac91cbe26d08445178b5690c2e9171a39c8
2019-01-31 10:32:28 -08:00
Daniel Nishi
10a6994d86 Use the correct Smart Storage flag in SettingsLib.
Previously, the show_opt_in and enabled flags were conflated to
basically mean the same thing. Because we are now distinctly making
show_opt_in refer to showing a toggle to opt into the feature in SUW and
enabled to mean the default enabled status, we need to change the
utility method for querying the default enabled status.

Bug: 122461924
Test: RunSettingsLibRoboTests
Change-Id: I9802d307597d90514e7dc6631998daa1d2fab253
2019-01-11 13:48:23 -08:00
Evan Laird
0e48aacfb3 Exclude IWLAN network type from isInService check
The current behavior of MobileNetworkController is to consider the
device in service if we have an out_of_service service state, but an
in_service data reg state. This is to handle "data only" SIM cards.

This change excludes IWLAN network types from this behavior because that
is the state of wifi calling and shouldn't cause the device to report
cell service.

Change-Id: I408fe282ebeb00425776b745abee0468ac0567c9
Fixes: 111958683
Test: atest com.android.settingslib.UtilsTest#isInService_voiceOutOfServiceDataOutOfService_returnFalse
2019-01-08 14:28:33 -05:00
SongFerngWang
8cfb4d59a9 Refactor SystemUI and add function in settingslib for service state
To make behavior consistent in the long run and refactor the code
into settingslib and call it from both Settings and SystemUI.

Bug: 110973964
Test: run testcase as below:
1. frameworks/base/packages/SettingsLib: -> ALL PASS
make RunSettingsLibRoboTests -j40
2. frameworks/base/packages/SystemUI: -> ALL PASS
atest frameworks/base/packages/SystemUI/tests/src/com/android/systemui
/statusbar/policy/NetworkControllerSignalTest.java

Change-Id: Ie8899dd5398a503b861557c222bbd93bd2049d10
2018-08-24 10:56:02 +08:00
TreeHugger Robot
5cbad09482 Merge "[SettingsLib] Update Utils.getColorAccent() and Utils.getColorError() to return ColorStateLists instead of colors." 2018-05-21 10:23:17 +00:00
Jason Chang
2386a37952 [SettingsLib] Update Utils.getColorAccent() and Utils.getColorError() to return ColorStateLists instead of colors.
Update Utils.getColorAccent() and Utils.getColorError() to return ColorStateLists instead of colors and change every callers entry.

Bug: 78215054
Test: manually test for UI
Change-Id: I830222a14ef81b2456dd89c9f8631b5fd36f12ff
2018-05-16 15:26:14 +08:00
timhypeng
7b1a43949a Add isAudioModeOngoingCall function to check call status am: 1b25c9a89c
am: 7128338376

Change-Id: Id3e7a22c73dfa2285dd87ccbb7770b084a9ee5e3
2018-04-30 02:26:04 -07:00
timhypeng
1b25c9a89c Add isAudioModeOngoingCall function to check call status
*return true if it is in ringing/call/communication(VoIP) status

Bug: 78318415
Test: make -j50 RunSettingsLibRoboTests
Change-Id: Ifb84da386fcd5bf03eaccf78fc264fbad86a9707
2018-04-30 15:30:17 +08:00
hjchangliao
2da48f8e71 Remove wrapper for LocationManager
Remove LocationManagerWrapper from SettingsLib

Bug: 76167422
Test: RunSettingsLibRoboTests
Change-Id: I5c50c88175d807d0758b2dc6b4992435df493408
2018-04-27 03:32:18 +00:00
Jason Chang
b4e879d6e5 [SettingsLib] Update Utils APIs usage
Update Utils.getColorAttr and similar methods in Utils to return a ColorStateList instead of a color

Bug: 74872054
Test: Force to display different color items then manually test
Change-Id: I92697a597b532ba95f29a886baa114ed6d0ac632
2018-04-11 11:17:58 +08:00
Tony Mak
34942ab7b1 Use the correct drawable to badge user icon
Also, ic_corp_user_badge is now tinted by default color, insteaad
on white by default.

Test: Create managed user, observe the icon is now blue on white.
Test: Wifi data usage, observe the icon of "All work apps" are now
grey instead of white.

FIXES: 71568987
Merged-In:Ic6c8ed15644c6e7894f2a84320077a3962603b5b

Change-Id: Ic6c8ed15644c6e7894f2a84320077a3962603b5b
2018-03-12 22:16:29 +00:00
Tony Mak
34b5bd8d57 Use the correct drawable to badge user icon
Also, ic_corp_user_badge is now tinted by default color, insteaad
on white by default.

Test: Create managed user, observe the icon is now blue on white.
Test: Wifi data usage, observe the icon of "All work apps" are now
grey instead of white.

Change-Id: Ic6c8ed15644c6e7894f2a84320077a3962603b5b
2018-03-06 15:36:43 +00:00
Tony Mak
e205193f86 Use the proper API to get managed profile user drawable
FIX: 73997367

Test: Go to settings -> Storage, observes the icon change.

Change-Id: I60153b31adf1175aea4cdf960d5094a89e8bc6b9
2018-02-28 15:12:01 +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
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
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
Maggie
fab2e2cbaa Send MODE_CHANGING broadcast before location mode change.
When location mode is about to change in Settings app, send
MODE_CHANGING broadcast.

Fixes: 28057031
Test: manual
Test: robotests
Change-Id: Id26325520211a8934c1670dfcd12e8d339766308
2017-12-07 23:22:35 +00:00
Tony Mak
213955e562 Fix user color overlay is not applied
Resource overlay is now done in runtime with non-system resources object.
Amend getDefaultUserIcon to take resources object as parameter.

BUG: 69355037
Test: Factory reset, verify that overlayed color is used in multiple
places, including keyguard, the bar under quick settings and Settings app.

Change-Id: I20b0527bdcb2eb38e8bea6a05f53eea1edcba932
2017-11-28 07:47:19 +00:00
Tony Mak
bca5c933be Replace work profile icon with the new one
Test: Check Printing / Google Settings / Wifi data usage page,
      observe the new icon.

BUG: 69028605
Change-Id: I344dfe6d6a99a8fdadfd7283dc851ea865566c18
2017-11-08 19:54:30 +00:00
Tony Mantler
88920145c2 Move SimStatus and ImeiInfo Pref Controllers to SettingsLib
Bug: 67410808
Test: RunSettingsLibRoboTests
Change-Id: I877d0338c28b4ebcf561d34875cb73c58aa32751
2017-10-20 15:03:56 -07:00
Daniel Nishi
078e594a63 Merge "Update the work icon." into oc-mr1-dev am: f19edfdab0
am: 985c4a7961

Change-Id: I662357082b835b5b08da05c6b83b4102ec4603b2
2017-08-31 18:18:35 +00:00
Daniel Nishi
07d0f592f4 Update the work icon.
This icon is based on ic_corp_badge_case, but scaled up to fit.
This changes the old orange briefcase to a newer briefcase that isn't
orange.

Bug: 64475406
Test: Manual
Change-Id: I63ce95326d419428b1df298783633f90f75162be
2017-08-29 12:39:13 -07:00
Daniel Nishi
b76ddcd24d Merge "Fix the user profile icon." into oc-mr1-dev am: 6ebd3594ae
am: 1d4daee10d

Change-Id: I2e9e2fb1e3c2cbb5f13ff3a4c9ec94a03c78064c
2017-08-25 00:28:45 +00:00
Daniel Nishi
f26dbd8f96 Fix the user profile icon.
It showing up regressed in MR1 for some reason. It appears that the icon
was never being loaded properly at all (drawables are not supposed to be
bitmappable as it was done before). By returning the raw drawable, the
icon is set properly.

Change-Id: I5f8e96b1b99dc725b8f69c6a5feb3fbfc05bb4d8
Fixes: 64610295
Test: Manual
2017-08-21 15:43:38 -07:00
Eric Schwarzenbach
44268e3c67 Remove references to deprecated NetworkBadging class.
Cleanup. Replaces references to the badging enums with
AccessPoint.Speed. Recreates getWifiIcon functionality in Utils class.

Bug: 62355275
Test: manual (no behavioral changes)
Change-Id: I33fa70e3680431fd234a92e989f89dbe04798ad2
2017-08-15 20:33:05 +00:00
Daniel Nishi
3f94f68b3b Change visibility on formatPercentage(double).
Bug: 37923610
Test: Manual

Change-Id: I05a2e244a07e737784988a6353841ee55bbdcad0
2017-07-05 15:38:33 -07:00
Sundeep Ghuman
9d10a3cf30 Revert "Update Status Bar with Badged Wifi Icons."
This reverts commit d57f324776.

Reason for revert: Kill badging in ODR

Bug: b/35628911
Test: runtest --path
frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java
Change-Id: I153863dfc02aaa211e1d76f0d85a2779894f72ee
2017-06-15 20:11:44 -07:00
Daniel Nishi
539828045c Change storage manager default to be a config.
This allows OEMs to customize the default behavior of the automatic
storage manager.

Bug: 38499322
Test: SettingsLib Robotest
Change-Id: I7d78865923fa7ff20b796a7075da0f35c7af1807
2017-05-25 09:55:39 -07:00
Jason Monk
9a376bcd45 Fix the status icon colors in QS
Requires lots of theming magic

Test: visual
Change-Id: I1cd28b570f30989b496065c0e06a5aca461deb41
Fixes: 37619734
2017-05-12 16:16:39 -04:00
Jason Monk
824ffffcc4 Make QS light
Test: visual
Change-Id: I873bc44647d509bad0ac035058ea13ac57717416
Fixes: 37213814
Fixes: 37008758
2017-04-11 15:49:06 -04:00
jackqdyulei
806f78d988 Add showChargingMethod in BatteryInfo
This toggle is used to decide whether to show charging method.
If it is off, then "Charging over ac" will become "Charging"

Bug: 36558216
Test: RunSettingsLibRoboTests
Change-Id: I98b1f7e7b77d7ce0a7e1aae29e55a33ac79ff0d7
(cherry picked from commit b3c33f63ed)
2017-04-06 13:16:58 -07:00
Jason Monk
58be7a675b Add colorError
Remove scatered references to old error color and replace them with
references to new colorError

Test: make & visual
Change-Id: Icca8cd790db351c3dfce2197f2046879d062a2c0
2017-02-24 14:57:27 -05:00
jackqdyulei
5dc1f36599 Make precentage calculation round up by 0.5%
So we will show 1% when actually number is 0.5%

Bug: 35305983
Test: RunSettingsLibRoboTests
Change-Id: I26f11f25a7d78cc6b09cb358abd82017fa7cea00
2017-02-21 16:40:01 -08:00
TreeHugger Robot
6e82080513 Merge "Move Badging from ScoredNetwork to NetworkingBadging." 2017-02-18 01:14:04 +00:00
Jason Monk
790442e4cd Tuner updates
Some UX updates to the tuner to feel better and align with settings
UX patterns.

Test: visual
Change-Id: I9c57194b9649c61e0d6d3f9e21a51d9c4a5c1286
2017-02-15 13:35:00 -05:00
Sundeep Ghuman
699deaf610 Move Badging from ScoredNetwork to NetworkingBadging.
This is a non-functional refactor. The old enums will be removed once
ag/35323372 is addressed.

Bug: 35114358
Test: Ran existing tests (see files touched).
Change-Id: I08fd8c7964463b5908ce361e61f8fe811d0ff6f3
2017-02-14 14:04:18 -08:00
Fan Zhang
73b161ddc1 Fix a crash when opening app data usage for work profile
The icon on app header is a clone of original app icon, which relies on
getConstantState() of the orginal drawable non-null.

Change-Id: Ice5360f5d00d99b3cfe538b167ce67fc06d5e402
Fix: 34190136
Test: make RunSettingsLibRoboTests
2017-02-08 12:02:52 -08:00
Sundeep Ghuman
d57f324776 Update Status Bar with Badged Wifi Icons.
This change inserts badged wifi icons into the status bar to indicate
historical network strength. The existing callback handler was modified
to explicitly pass the drawable as currently the icon is a rendered from
two separate resources, composited together in a LayeredDrawable.

Badging is controlled by Settings.Global.NETWORK_RECOMMENDATIONS_ENABLED
and can be enabled from the Wifi Settings page.

Bug: 34056846
Test: runtest --path
frameworks/base/packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/NetworkControllerWifiTest.java
Change-Id: I33b736d4543e380887513cbb5937f49945794c09
2017-01-24 15:18:32 -08:00
TreeHugger Robot
9553a1ecc2 Merge "Visual refresh for QS" 2017-01-20 18:08:53 +00:00
Jason Monk
3250885c9f Visual refresh for QS
Adds circles and things

Test: visual
Change-Id: I7d974fcfe6257357abfd1a7d0ee521f0e6cee588
2017-01-20 11:29:25 -05:00
Sundeep Ghuman
f84e0573fc Insert badged icons into the WifiSettings picker.
This initial pass inserts badged wifi icons when available. A later CL
will move this logic to a new AccessPointPreference subclass to further
isolate the new picker UI changes.

Bug: 33457699
Test: Manual inspection
Change-Id: I849efe3f135bb24efeb60d2484dfb56673168430
2017-01-19 16:28:24 -08:00
jackqdyulei
b68fd7ae0a Remove hardcoded color for cellular data usage view
1. Remove hardcoded color and create colorStateList instead
2. Remove warning color and use attr textColorError instead
3. Add function to extract color from colorStateList

Bug: 32592245
Test: manual - Take screenshots
Change-Id: I7f0a54b304b09b99ba1f255952e7e99e009a4d2a
2017-01-04 16:12:44 -08:00
Tony Mak
bfba9d485e Disallow user to block notification from OobConfig
Change-Id: Ifb2ea790559fc91f88b38ecf29a2b0a7949aeabb
Fix: 29632126
2016-07-14 15:29:44 +08:00