Commit Graph

37 Commits

Author SHA1 Message Date
Mill Chen
5c84edacf0 Replace private attributes with public resources.
The change replaces all existing usage of private resources in
SettingsLib with corresponding public resources. The only exception
is android:string/config_headlineFontFamily where there's no proper
replaccement.

The library is currently used by bundled apps (such as SettingsGoogle)
and unbundled apps (such as PermissionController and
CellBroadcastReceiver). Since we still want these bundled apps to
reference config_headlineFontFamily properly while not breaking
unbundled apps due to them referencing private attributes, we added a
new attribute settingslib_config_headlineFontFamily (alongside with
other FontFamily variance for completeness) in
SettingsTheme/res/values-v31/strings.xml which points to
config_headlineFontFamily by default. Then, in separate CLs, we will add
resource overrides to these unbundled apps to replace the value of
settingslib_config_headlineFontFamily to point to a public value. While
this means that the style of the pages from the unbundled apps will be
different from the rest of SettingsLib clients, the change provides a
tactical fix to make sure that these unbundled apps won't crash when
shipped to other devices. We can address the issue at its core by
potentially exposing some private resources in future Android releases.

Bug: 191387775
Bug: 190964071
Bug: 196106314
Test: manual test to confirm this is a no-op CL.
Change-Id: Ie25950d9f54964aa40038a27b302ed017e4e4d15
2021-08-12 23:52:16 +08:00
Chen Xu
5e20541fc9 Merge "Apply new settings widget lib for the cbr main feature switch" into sc-dev 2021-07-01 18:02:01 +00:00
Sunny Shao
429d7624fb Fix Talkback say twice in MainSwitch
- Remove the duplicated setting in the ContentDescription.

Bug: 191735947
Test: manual test
Test: make RunSettingsLibRoboTests -j ROBOTEST_FILTER=com.android.settingslib.widget
Change-Id: If28d0002dd1087173623b654c67bc7597d721a85
2021-07-01 15:17:13 +08:00
Chen Xu
4608a7a448 Apply new settings widget lib for the cbr main feature switch
apply the new settings widget lib for the emergency alert main feature
switch.

Bug: 183574149
Test: Manual
Change-Id: Idfdb2696056faf3dbe4ccb0061f2b61c33e94292
2021-07-01 14:37:56 +08:00
Stanley Wang
85c9c3e6ad Fix the problem that the title of MainsSitchPreference will
be truncated.

- Remove the maxLines=2 attribute.

Fix: 189921147
Test: robotest and see the UI
Change-Id: Ia62fd2f5ed1e76c9f1149e842bdae308e83fb03b
2021-06-30 14:10:40 +08:00
Stanley Wang
33c5ed926e Fix the problem that the unknown item will be announced when
using Switch Access.

- Disable the importantForAccessibility of the MainSwitchBar's
  parent layout.

Fix: 182227784
Test: robotest and operate the switch preference manually
Change-Id: If1780361fcc7d7e0e53400d068ef4d2c31d6d8af
2021-06-28 16:02:44 +08:00
Stanley Wang
99b691f54c Fix the problem that the switch should gray out when preference
disabled.

- Use the switch style of SettingsTheme to make the switch UI
  consistent.

Fix: 189062669
Test: robotest and operate the switch preference manually
Change-Id: Ic0280fd3986726008225530fd1705ad7df0b17a6
2021-06-27 16:28:20 +08:00
Edgar Wang
fce3f0fd2b Fix build broken
- It's because we refactored BuildCompat to BuildCompatUtils and didn't
  replace it in another CL at the same time.

Fixes: 191628501
Test: rebuild
Change-Id: Ibeb231a268465f2642b9452c1760492a65c67254
2021-06-21 12:10:42 +00:00
TreeHugger Robot
3b28d923c8 Merge "Fine tune Widget library" into sc-dev 2021-06-21 09:17:32 +00:00
Edgar Wang
bff4a440cc Relace BuildCompat.isAtLeastS to check Build.VERSION.SDK_INT
Fixes: 191227729
Test: robotest & manual
Change-Id: I4b865b7de33a6801783dd645213fef0cda8d4dd2
2021-06-21 12:52:06 +08:00
Edgar Wang
bba370ec2c Fine tune Widget library
- rename resource in FooterPreference
- use material_grey_600 in MainSwitchBar directly
- backward compitable in MainSwitchBar
- correct dialog background and accent color

Bug: 191267392
Test: robotest & manual
Change-Id: I31fff1b157ec757e9f74f4b82ae8d997a0a117f1
2021-06-18 10:23:05 +00:00
Stanley Wang
3f0812ea7c Merge "Switch control should not be activated after event happens off of the target region." into sc-dev 2021-06-03 10:29:29 +00:00
Stanley Wang
c2d91b650d Switch control should not be activated after event
happens off of the target region.

- Disable the focusable and clickable features.

Fix: 189079003
Test: robotest and test the switch manually
Change-Id: I0fa19c132ddfd5a3e010bf8328c6b84c1087d78b
2021-06-03 15:34:04 +08:00
Stanley Wang
eec7a6ca45 Add new method "checkRestrictionEnforced" to
RestrictedPreferenceHelper.

- Return the EnforcedAdmin object if the preference is retricted.

Bug: 179245126
Test: robotest and see the UI
Change-Id: I0687bb5e1bafa6c50f7c4e1400e6d4ed7c03c9b1
2021-05-29 19:01:53 +08:00
Edgar Wang
ffcf3679cb Apply new style for SwitchPreference
- Moving two_target_min_width to SettingsTheme.
- Apply new Switch in SettingsTheme.

Bug: 185549116
Test: manual
Change-Id: Iae31b430728113b25f7c9055372f60ee80a6a58f
2021-05-25 23:56:12 +08:00
TreeHugger Robot
8253fe8c30 Merge "The MainSwitch should has the accessibility label." into sc-dev 2021-05-22 01:11:16 +00:00
Stanley Wang
4f097e3472 Merge "Synchronize the states of MainSwitchBar and MainSwitchPreference." into sc-dev 2021-05-21 02:06:53 +00:00
Colin Cross
c55ba7e2a4 Update lint baseline for SettingsLibMainSwitchPreference
Add some new NewApi lint errors to lint-baseline.xml

Bug: 188805387
Test: m out/soong/.intermediates/frameworks/base/packages/SettingsLib/MainSwitchPreference/SettingsLibMainSwitchPreference/android_common/lint/lint-report.xml
Change-Id: Ia1077b3077cd14cb1b1f39352195558d0644a3f7
Merged-In: Ia1077b3077cd14cb1b1f39352195558d0644a3f7
(cherry picked from commit c1fe1ef47d)
2021-05-20 18:30:48 +00:00
Stanley Wang
f984db4b4a The MainSwitch should has the accessibility label.
Add the title to the content description of Switch.

Fix: 182228819
Fix: 182227784
Test: robotest and manually test the UI
Change-Id: I3cad922e903df783ee7eaf727b82f16f3345ff30
2021-05-20 16:02:18 +08:00
Stanley Wang
ab9937f5f6 Synchronize the states of MainSwitchBar and MainSwitchPreference.
MainSwitchPreference should synchronize the switch state of
MainSwitchBar.

Fix: 187391143
Test: robotest and see the UI
Change-Id: Ifa3d21f7ce3ba6bdcfa3c254b2aa1a7668618829
2021-05-20 06:51:18 +00:00
Stanley Wang
86548aa1df Update the margins and colors of MainSwitchBar to fit the spec.
Bug: 187911551
Test: robotest and see the UI
Change-Id: Iebff051a58d855cc066c4f10c17f0393c26d5d51
2021-05-17 13:32:03 +08:00
Hai Zhang
4d01a45c44 Remove workaround for R class conflict in Settings unit test.
The workaround is accessing the resources dynamically with
Resources.getIdentifier(), however this makes it incompatible with R8
which will think the resource is unused and remove it, resulting in a
runtime exception. There is currently no way to have consumer ProGuard
texts in Soong, and we cannot disable R8 for PermissionController
because it would severely regress our APK size and make build unhappy.

The real cause for the original test failure is that, Settings unit
test used to include SettingsLib libraries in its static_libs, and
this caused duplicate R classes to be included in its test APK (which
is already in Settings APK) and resulted in the wrong R class being
loaded when accessing resources from Settings context.

So we should remove the SettingsLib dependencies in Settings unit test
and remove the workaround here, to correctly fix the issue and unblock
R8 usage.

Bug: 183340630
Bug: 177638625
Bug: 183342958
Test: atest SettingsSliderPreferenceControllerTest
Test: atest PrivateVolumeForgetTest
Change-Id: I404892ccb7c2004ec3f81df69c1dc4bceed150df
2021-05-11 01:54:37 -07:00
Edgar Wang
3b9df00cbb Rename resource name to avoid build conflict in another path.
Bug: 186881512
Test: manual & robotest
Change-Id: I2545c07e9a0e7cb77cf942605fcc447cb387c5ec
2021-05-10 16:13:27 +00:00
Stanley Wang
d979dbd6af Update MainSwitchBar to Material Next style.
Fix: 182255113
Test: Run robotest and see the ui
Change-Id: I2d407bb463a13ed986fe7fe3611e4c00c55284dd
2021-05-07 16:02:44 +08:00
Pedro Loureiro
d34f536b59 Add lint baseline to address NewApi errors
We are enabling a new lint check where the min sdk != compile sdk.
It has produced a lot of errors and adding the baseline file(s)
allows us to continue work without introducing more problems.

Bug: 150847901

Test: m lint-check
Change-Id: Ide8a8fe80ba31396f23853ab266afcbcc33af9a6
2021-04-13 10:51:51 +01:00
Edgar Wang
43e006b69b Add backward compatible for MainSwitchPreference
- Before Android S, it will apply SwitchBar layout
- Fix TypedArrayUtils can't build pass in another path.

Bug: 182179573
Test: robotest & manual
Change-Id: I33ca1991cef359f8e95650c7616bb76cee3bb7ff
2021-04-12 07:42:37 +00:00
Arc Wang
714d7be0ee Fix resource problem in PrivateVolumeForgetTest
Somehow Resource IDs are inconsistent between SettingsLib and
SettingsUnitTests. This is a workaround for NotFoundException
in SettingsUnitTests.

Bug: 183342958
Test: atest com.android.settings.deviceinfo.PrivateVolumeForgetTest
Change-Id: If513d5796d4dcd50261d9dd366f6a0def51e0ec4
2021-03-25 14:29:32 +08:00
Edgar Wang
6d7a8cced8 Remove RestrictedLockUtils dependency in MainSwitchPreference
- Extract related things to SettingsMainSwitchBar

Bug: 180226735
Test: robotest
Change-Id: Ibb0e687519ef48f85f47028374437e00ac2adabd
2021-03-09 03:01:54 +00:00
Bob Badour
745e7ee830 Merge "[LSC] Add LOCAL_LICENSE_KINDS to frameworks/base" into sc-dev 2021-02-24 18:43:29 +00:00
Bob Badour
d59495855e [LSC] Add LOCAL_LICENSE_KINDS to frameworks/base
Added SPDX-license-identifier-Apache-2.0 to:
  apct-tests/perftests/contentcapture/Android.bp
  apct-tests/perftests/inputmethod/Android.bp
  apex/appsearch/Android.bp
  apex/appsearch/framework/Android.bp
  apex/appsearch/service/Android.bp
  apex/appsearch/testing/Android.bp
  apex/jobscheduler/service/jni/Android.bp
  apex/media/service/Android.bp
  cmds/abx/Android.bp
  cmds/uinput/Android.bp
  cmds/uinput/jni/Android.bp
  core/tests/GameManagerTests/Android.bp
  core/tests/batterystatstests/BatteryStatsLoadTests/Android.bp
  core/tests/batterystatstests/BatteryStatsViewer/Android.bp
  core/tests/devicestatetests/Android.bp
  libs/WindowManager/Shell/tests/flicker/Android.bp
  libs/WindowManager/Shell/tests/flicker/test-apps/flickerapp/Android.bp
  libs/androidfw/fuzz/cursorwindow_fuzzer/Android.bp
  native/android/tests/activitymanager/UidImportanceHelperApps/Android.bp
  native/android/tests/activitymanager/nativeTests/Android.bp
  packages/SettingsLib/BannerMessagePreference/Android.bp
  packages/SettingsLib/CollapsingToolbarBaseActivity/Android.bp
  packages/SettingsLib/EmergencyNumber/Android.bp
  packages/SettingsLib/FooterPreference/Android.bp
  packages/SettingsLib/MainSwitchPreference/Android.bp
  packages/SettingsLib/TopIntroPreference/Android.bp
  packages/SettingsLib/UsageProgressBarPreference/Android.bp
  packages/overlays/AccentColorAmethystOverlay/Android.bp
  packages/overlays/AccentColorAquamarineOverlay/Android.bp
  packages/overlays/AccentColorBlackOverlay/Android.bp
  packages/overlays/AccentColorCarbonOverlay/Android.bp
  packages/overlays/AccentColorCinnamonOverlay/Android.bp
  packages/overlays/AccentColorGreenOverlay/Android.bp
  packages/overlays/AccentColorOceanOverlay/Android.bp
  packages/overlays/AccentColorOrchidOverlay/Android.bp
  packages/overlays/AccentColorPaletteOverlay/Android.bp
  packages/overlays/AccentColorPurpleOverlay/Android.bp
  packages/overlays/AccentColorSandOverlay/Android.bp
  packages/overlays/AccentColorSpaceOverlay/Android.bp
  packages/overlays/AccentColorTangerineOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationCornerOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationDoubleOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationHoleOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationNarrowOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationTallOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationWaterfallOverlay/Android.bp
  packages/overlays/DisplayCutoutEmulationWideOverlay/Android.bp
  packages/overlays/FontNotoSerifSourceOverlay/Android.bp
  packages/overlays/IconPackCircularAndroidOverlay/Android.bp
  packages/overlays/IconPackCircularLauncherOverlay/Android.bp
  packages/overlays/IconPackCircularSettingsOverlay/Android.bp
  packages/overlays/IconPackCircularSystemUIOverlay/Android.bp
  packages/overlays/IconPackCircularThemePickerOverlay/Android.bp
  packages/overlays/IconPackFilledAndroidOverlay/Android.bp
  packages/overlays/IconPackFilledLauncherOverlay/Android.bp
  packages/overlays/IconPackFilledSettingsOverlay/Android.bp
  packages/overlays/IconPackFilledSystemUIOverlay/Android.bp
  packages/overlays/IconPackFilledThemePickerOverlay/Android.bp
  packages/overlays/IconPackKaiAndroidOverlay/Android.bp
  packages/overlays/IconPackKaiLauncherOverlay/Android.bp
  packages/overlays/IconPackKaiSettingsOverlay/Android.bp
  packages/overlays/IconPackKaiSystemUIOverlay/Android.bp
  packages/overlays/IconPackKaiThemePickerOverlay/Android.bp
  packages/overlays/IconPackRoundedAndroidOverlay/Android.bp
  packages/overlays/IconPackRoundedLauncherOverlay/Android.bp
  packages/overlays/IconPackRoundedSettingsOverlay/Android.bp
  packages/overlays/IconPackRoundedSystemUIOverlay/Android.bp
  packages/overlays/IconPackRoundedThemePickerOverlay/Android.bp
  packages/overlays/IconPackSamAndroidOverlay/Android.bp
  packages/overlays/IconPackSamLauncherOverlay/Android.bp
  packages/overlays/IconPackSamSettingsOverlay/Android.bp
  packages/overlays/IconPackSamSystemUIOverlay/Android.bp
  packages/overlays/IconPackSamThemePickerOverlay/Android.bp
  packages/overlays/IconPackVictorAndroidOverlay/Android.bp
  packages/overlays/IconPackVictorLauncherOverlay/Android.bp
  packages/overlays/IconPackVictorSettingsOverlay/Android.bp
  packages/overlays/IconPackVictorSystemUIOverlay/Android.bp
  packages/overlays/IconPackVictorThemePickerOverlay/Android.bp
  packages/overlays/IconShapeHeartOverlay/Android.bp
  packages/overlays/IconShapePebbleOverlay/Android.bp
  packages/overlays/IconShapeRoundedRectOverlay/Android.bp
  packages/overlays/IconShapeSquareOverlay/Android.bp
  packages/overlays/IconShapeSquircleOverlay/Android.bp
  packages/overlays/IconShapeTaperedRectOverlay/Android.bp
  packages/overlays/IconShapeTeardropOverlay/Android.bp
  packages/overlays/IconShapeVesselOverlay/Android.bp
  packages/overlays/NavigationBarMode2ButtonOverlay/Android.bp
  packages/overlays/NavigationBarMode3ButtonOverlay/Android.bp
  packages/overlays/NavigationBarModeGesturalOverlay/Android.bp
  packages/overlays/NavigationBarModeGesturalOverlayExtraWideBack/Android.bp
  packages/overlays/NavigationBarModeGesturalOverlayNarrowBack/Android.bp
  packages/overlays/NavigationBarModeGesturalOverlayWideBack/Android.bp
  packages/overlays/OneHandedModeGesturalOverlay/Android.bp
  packages/services/CameraExtensionsProxy/Android.bp
  services/core/java/com/android/server/speech/Android.bp
  services/musicrecognition/Android.bp
  services/searchui/Android.bp
  services/smartspace/Android.bp
  services/tests/PackageManagerServiceTests/host/libs/IntentVerifyUtils/Android.bp
  services/tests/PackageManagerServiceTests/host/test-apps/DeviceSide/Android.bp
  services/tests/PackageManagerServiceTests/host/test-apps/IntentVerifier/Android.bp
  services/tests/PackageManagerServiceTests/host/test-apps/IntentVerifierTarget/Android.bp
  services/tests/PackageManagerServiceTests/host/test-apps/UsesStaticLibrary/Android.bp
  services/tests/PackageManagerServiceTests/unit/Android.bp
  services/tests/inprocesstests/Android.bp
  services/tests/mockingservicestests/jni/Android.bp
  services/tests/servicestests/test-apps/PackageParsingTestManifests/Android.bp
  services/texttospeech/Android.bp
  services/translation/Android.bp
  tests/BatteryStatsPerfTest/Android.bp
  tests/FlickerTests/test-apps/Android.bp
  tests/Input/Android.bp
  tests/SilkFX/Android.bp
  tests/SurfaceViewBufferTests/Android.bp
  tests/UpdatableSystemFontTest/Android.bp
  tests/UpdatableSystemFontTest/testdata/Android.bp
  tests/benchmarks/internal/Android.bp
  tools/powerstats/Android.bp
  tools/processors/intdef_mappings/Android.bp
  tools/xmlpersistence/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I1b8d155a26a1a589a38abedea5f7f366e00346c6
2021-02-23 13:18:34 -08:00
Stanley Wang
85852786bc Update MainSwitch widget.
- Fix the MainSwitchBar overlapping issue.
- Add setTitle method to support string resource id.
- Add setChecked method to fix the state of switch not sync issue.
- Get the resource id of title from xml.

Fix: 178425979
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: I332b017c6a6e32e5ea3929d4b3c7e81104445bcc
2021-02-05 17:47:03 +08:00
Stanley Wang
832d478662 Update Main Switch widget.
- Update switch size
- Update title magrin right
- Use default text color
- Update switch margin right
- Support xml title attribute

Fix: 177967927
Fix: 177968636

Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: I226abbffc1539cc31e64f4a3b3723c95b40e5780
2021-02-02 12:39:06 +00:00
Stanley Wang
a949d3e8f0 Update padding of MainSwitchBar title.
Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Ie7e53604b8c5fe4af9914af21debbe17e5739736
2021-01-15 15:43:59 +08:00
Stanley Wang
90089f9e1e Update background color of main switch track.
Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Ie5bdb40a5cc1be17b6ebdb910dfbbaeb4042fb39
2021-01-12 22:53:55 +08:00
Stanley Wang
3b9574c80d Update background color of main switch bar.
Bug: 175181773
Test: Run robotest and apply the widget in Settings and see the ui
Change-Id: Ia4f6d5f38dcadcdf07aec9aacd607a8c31427709
2021-01-11 14:35:11 +08:00
Stanley Wang
44f041dec3 Add new methods to MainSwitchBar.
Methods isChecked and getSwitch will be used by Settings.

Bug: 175181773
Test: Run robotest
Change-Id: I9984cc1b1eef70709b84f475a99852000d44ad74
2020-12-30 14:20:25 +08:00
Stanley Wang
5728b5be2f Create a main switch preference widget.
Based on our ux spec, we create this widget to
let everyone can follow up our spec easily.

Bug: 175181773
Test: Run robotest and apply this widget in Settings and see the ui
Change-Id: I4ea5f38c44aacfeb2c8dbe4a7d31159712f95441
2020-12-24 17:35:08 +08:00