Commit Graph

95 Commits

Author SHA1 Message Date
Kweku Adams
9a087d6c19 Merge "Revert "Remove duplicate strings."" into udc-dev 2023-03-16 20:14:16 +00:00
Lifu Tang
caa1b51ef2 Revert "Remove duplicate strings."
Revert submission 19748582-settings_yesno

Reason for revert: Common strings in English could be translated into different strings in other languages.

Reverted changes: /q/submissionid:19748582-settings_yesno

Bug: 272603842
Test: build and open Settings app
Test: atest SettingsRoboTests
Change-Id: Iaad301c5513478fb95e40987ea3ccb4f923d71fa
2023-03-15 22:39:24 +00:00
Matías Hernández
2cabe8786e Merge "Delete stuff related to removed "Conversations that can interrupt" settings" into udc-dev 2023-03-15 10:12:23 +00:00
Matías Hernández
0882b04ed5 Delete stuff related to removed "Conversations that can interrupt" settings
Bug: 226486181
Test: N/A, dead code removal only
Change-Id: I100db518880a7eee402af37f49e416ec61ff8486
2023-03-14 16:53:53 +01:00
Matías Hernández
89f93a9bb1 Close ZenModeScheduleRuleSettingsActivity when rule is deleted
This fixes an issue where the ZenRuleButtonsPreferenceController was redirecting to the rule list, but the container fragment was still trying to refresh the rule, leading to a "rule not found" toast. This also makes the transition look nicer, as it's a "back" instead of a "forward" animation now.

Fixes: 244103559
Test: Manually on phone & tablet
Change-Id: Ie26511dcaec4c7976f488936cdc6d417110ca1b1
2023-03-13 12:03:27 +01:00
Julia Reynolds
cb6a88b862 Remove jank on DND schedule page
Only add/or remove preferences when absolutely needed.
Also fix a 'load data from backend' method that wasn't.

Fixes: 216747934
Test: ZenModeAutomaticRulesPreferenceControllerTest
Test: view schedules page
Test: add schedule
Test: remove schedule
Test: view schedule child page and return to schedules page
Change-Id: I237c2ca7ea89ee6e42354470a76712068a7f4dd7
2023-03-01 18:43:02 +00:00
TreeHugger Robot
408a4045f1 Merge "Reduce jank on DND apps page" into tm-qpr-dev am: 694742152d am: 2ecd05add8
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21477350

Change-Id: I06dc22c948192703fdf717a735ef9abc3df58496
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-21 21:32:14 +00:00
TreeHugger Robot
2ecd05add8 Merge "Reduce jank on DND apps page" into tm-qpr-dev am: 694742152d
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/21477350

Change-Id: I3b215c7f5c824c04837cc84f2af1c81e0702aa6c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-21 19:47:05 +00:00
Julia Reynolds
9f7af5946e Reduce jank on DND apps page
1) Remove call to redisplay the api when registering our app listener -
this meant all preferences were always removed/readded on page load
because the app list isn't ready at that time
2) Stop rebuilding the UI for events we don't care about
3) Keep existing preferences when possible and just do the diff of prefs
that need to be added/removed

Fixes: 234298144
Test: ZenModeAddBypassingAppsPreferenceControllerTest
Test: ZenModeAllBypassingAppsPreferenceControllerTest
Test: manually view page; add & remove apps that have dnd breakthrough
Change-Id: I57b36d36135dd25d1d2fd73073cf6b7a033659a6
2023-02-17 13:39:19 +00:00
Yuri Lin
5db22756e4 Merge "Disable zen rule preferences with invalid activities" into tm-qpr-dev am: dc4100f148 am: de8a27b496
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20725886

Change-Id: I4c0309a1b5773d6d92c0f43ba631571e2b375e49
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-16 00:00:17 +00:00
Yuri Lin
de8a27b496 Merge "Disable zen rule preferences with invalid activities" into tm-qpr-dev am: dc4100f148
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/20725886

Change-Id: I609c74ba96e7a32171ff20715d4aa8c68f8a68b9
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-15 16:51:30 +00:00
Yuri Lin
afe52dfae5 Disable zen rule preferences with invalid activities
While resolveActivity is used to determine whether an Intent can be handled by something, this doesn't catch the case of explicit intents whose activity class doesn't exist. Here we check for it through PackageManager.queryIntentActivities instead for existing zen rules (if they were added when the activity exists, but it no longer does).

For new rules, check the validity of the activity for external rules before adding them to the list.

Bug: 238144390
Test: manual via DND app
Change-Id: Ia920ca792f9c17a5d684baf877c882ce7fadffd6
2022-12-14 14:13:36 -05:00
xinghailu
b5293a2d1c Cleanup plurals in Settings, change <one> to <1> in string res file.
"One" and "1" are not same, such as "1st place" vs "a
place". Also in many languages, plurals expression is different with English, for more detail please check: go/android-i18n-plurals.
So in string res file, replace "one" with excat value "1" is a more
proper way.

Test: Existing unit tests still pass.
Bug: 199230342
Change-Id: I832abc38afc5d8816fa803865c25e6017cffa2c6
2022-12-13 18:31:08 +08:00
Chaohui Wang
6ae88c417f Clean up some UnusedResources detected by lint 3
Bug: 234570979
Test: Manual with Settings App
Change-Id: I73d18397b01a9967fd7acb94b133e7d5497a0854
2022-09-13 13:56:26 +08:00
Treehugger Robot
adbd13eb05 Merge "Add null check for mIntent in ZenRulePreference to avoid potential crash risk" am: 36a80cd8e6 am: 3799ecc58a am: 02a5b5e487 am: f8701c71e6 am: b151b094cc
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2200576

Change-Id: Ib0d57ffd2c11e804ae31a0f57846c509100ccf93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 06:17:32 +00:00
Treehugger Robot
b151b094cc Merge "Add null check for mIntent in ZenRulePreference to avoid potential crash risk" am: 36a80cd8e6 am: 3799ecc58a am: 02a5b5e487 am: f8701c71e6
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2200576

Change-Id: I23cc61383530de734ef9f3e8141078757a45ec22
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-02 05:46:17 +00:00
Shen Lin
b25f123d9f Add null check for mIntent in ZenRulePreference to avoid potential crash risk
Bug: 244120502

Test: manual test, ZenRuleScheduleHelperTest for unit test.
Change-Id: Ib7338253783bb09b84b629f2dd891292d82f28b2
2022-08-29 19:19:59 +08:00
Kweku Adams
5949fccc7a Remove duplicate strings.
"Yes" and "no" were redefined many times with no clear benefit, so this
consolidates them into one definition.

Bug: 243843096
Test: Build, install, and open the Settings app
Test: atest SettingsRoboTests
Change-Id: I5f84d09f223efd478461ded93aeac82bf7b128d8
2022-08-26 00:07:08 +00:00
Treehugger Robot
48b4af999a Merge "Fix array-related errorprone warnings" am: a93e78f781 am: a89e7aea3b am: cdacabf984 am: 49a0bbc650 am: ac7a368afd
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2183972

Change-Id: I0ebc25250b00a36bef5a72dd87192013b08e098f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-17 20:53:49 +00:00
Treehugger Robot
ac7a368afd Merge "Fix array-related errorprone warnings" am: a93e78f781 am: a89e7aea3b am: cdacabf984 am: 49a0bbc650
Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/2183972

Change-Id: I9c4c43088154202d5818b29d010f053a7630ec90
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-08-17 20:29:36 +00:00
Treehugger Robot
a93e78f781 Merge "Fix array-related errorprone warnings" 2022-08-17 18:37:46 +00:00
Cole Faust
a21ac03acb Fix array-related errorprone warnings
The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: Ida6513002f8fd845a385924be290b720f06c4748
2022-08-15 18:52:37 -07:00
Chaohui Wang
0441f990f9 Merge "Remove the redundant constructor of SuggestionFeatureProviderImpl" 2022-08-08 06:47:18 +00:00
Julia Reynolds
f3b9bf55a9 Move zen rule deletion
To a non-exported component

Test: manually delete a rule in Settings
Fixes: 233607507
Change-Id: I6c4ac930eb62a2068582021d0ad16b93fbc9bdd3
2022-07-21 14:54:42 -04:00
Chaohui Wang
80a11a251e Remove the redundant constructor of SuggestionFeatureProviderImpl
Fix: 175167313
Test: robotest
Change-Id: I7ebbaf92398a8300971d592e2ee7a6e0d82c1d2f
2022-07-13 03:44:26 +00:00
Yuri Lin
7cbba753dc Change zen mode schedules page rule handling
The approach of reloading all rules (and recreating all ZenRulePreferences) every time the rule set changed causes the switches on the page to stop working.

This change keeps the ZenRulePreference around as long as the rule itself is around and keeps it updated, while re-adding the preferences to the PreferenceCategory if needed due to rules changing.

Fixes: 229879326
Test: manual, ZenModeAutomaticRulesPreferenceControllerTest
Change-Id: I4eba41e8252cedd87ac866e4b97513970ca2d94a
2022-05-05 14:24:42 -04:00
Chaohui Wang
fbafdbdd8f Merge "Fix title clipped for "Custom settings for schedule"" into tm-dev 2022-04-14 23:22:19 +00:00
Julia Reynolds
87bb1b34c5 Add missing extra when launching apps
As promised in the api docs

Test: AbstractZenModeAutomaticRulePreferenceControllerTest, view
schedule DND page
Fixes: 221423986

Change-Id: I7ddc1b112950da225afa2ba13ebf5df481922177
2022-04-12 16:20:01 -04:00
Chaohui Wang
3b3e66c780 Fix the flow for ZenCustomRuleSettingsBase
updateRule() should be called before super.onResume() because rule will
be used in updatePreferenceStates() in super.onResume().

This is follow up of Change: Ief9963091847d58654f26851616563ae910716a5

Bug: 226523115
Test: manual
Change-Id: I2fe0cfb2b4a76273283bb2d3aca629b5d647db91
2022-04-06 17:22:12 +08:00
Chaohui Wang
5d0057615a Fix title clipped for "Custom settings for schedule"
Set rule to header, switch and action buttons controllers before their
isAvailable() is called in onCreate().

Fix: 228262001
Test: manual
Change-Id: Idc0ea779ab768497a8426ac847c4bbb2c6c4faea
2022-04-06 13:57:48 +08:00
Chaohui Wang
bab799899d Fix Flicker for ZenCustomRuleSettingsBase
Fix the following flicker on pages under:
Notifications -> Do Not Disturb -> Schedules -> [One Schedule]

1. Do Not Disturb behavior
2. (1) -> Create custom settings for this schedule
3. (2) -> Calls
4. (2) -> Messages
5. (2) -> Display options for hidden notifications
6. (4) -> custom

Fix: 226523115
Test: On Pixel Phone
Change-Id: Ief9963091847d58654f26851616563ae910716a5
2022-04-04 22:22:10 +08:00
Yuri Lin
e8e40609df Make icons show up on DND bypassing apps page
This change uses the app icon cache to either get the icon from cache or retrieve it on a background thread. The methods previously used to get app icons no longer work in T.

Bug: 222323742
Test: manual
Change-Id: I4960a9297d546cac088e5969a8903391ed994bd4
2022-03-08 14:57:54 -05:00
Jonathan Scott
c3dbc3ffbd Merge "Allow Device Management Role Holder to update Settings strings." 2022-01-31 19:10:30 +00:00
Yuri Lin
0a7554acfa Cosmetic changes to zen mode people & sound/vibration screens
On the people screen, have the footer show up all the time and provide a more relevant message (indicating that the chosen people override any app/etc settings) than the current setting.

On the sound/vibration screen, remove the sub-title since it's a bit confusing what exactly is being turned on or off.

Bug: 190180868
Bug: 215564123
Test: manual
Change-Id: I78d407af350a9f99d26d1e5082b752881bd3f186
2022-01-26 13:01:26 -05:00
Yuri Lin
a91e2daea7 Change zen schedules page to use switches.
Also add clearer summaries for schedule and calendar events (rather than just "Off" and "On"): for schedules, list the days & times for which the schedule is active, and for events, the calendar whose events it triggers on.

Bug: 190180868
Bug: 215564123
Test: manual for switches, ZenRuleScheduleHelperTest for descriptions

Change-Id: I3ad579503adae0a66dfa3093b4e3df77db0ede31
2022-01-26 11:21:53 -05:00
Jonathan Scott
e0d439472f Allow Device Management Role Holder to update Settings strings.
Test: manual
Bug: 188414370
Change-Id: I6e1a06619799a9e99382d791e72e2e4518f93cac
2022-01-25 19:03:24 +00:00
TreeHugger Robot
38fa2c195d Merge "Fix the onCreate crash happened among zen mode rule pages" into sc-v2-dev am: 56c49091a0 am: 5302093d5c
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16432138

Change-Id: Ieba60e9cebdc683fbaa8e382a80d9e4efe666c8f
2021-12-10 17:01:15 +00:00
Jason Chiu
bd8f45b9d4 Fix the onCreate crash happened among zen mode rule pages
Fix: 199229588
Test: manual
Change-Id: I7b0116de8d9760f420c026a8d65b019e6d2d00df
2021-12-10 11:36:55 +08:00
Jason Chiu
7f6b9e26c9 Merge changes from topic "slice-highlight" into sc-v2-dev am: 6821b6be32 am: 026b1b5df6
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/16151654

Change-Id: If46903bb26371ea90075d1c6cc063af4d10a88d4
2021-11-02 02:43:42 +00:00
Jason Chiu
2989c50a23 Add highlight menu keys for all toggle pref controllers and custom slices
Bug: 204695404
Test: manual, robotest build pass, unit
Change-Id: Iad2e28ada8ddb766ffa7eff2c8dc581250cbd6f8
2021-11-01 15:00:18 +08:00
Yuri Lin
00d824657d Merge messages & conversations settings for DND priority senders.
This change explicitly allows for multiselect between priority senders (starred, contacts) & priority conversations, and also allows unchecking boxes by clicking on the same ones again.

Also makes the screens for setting messages and calls in custom rules consistent in behavior with the main DND settings. Since much of the functionality is shared, this change refactors most of the logic into a new helper class used by both.

While these changes also affect how the "calls" screen is constructed, in effect there is no change to the functionality of priority call sender settings except under the hood.

Test: atest ZenPrioritySendersHelperTest; Settings robotests
Bug: 190180868
Bug: 197223270
Change-Id: I894775537a18feb7a891b2668b9a613a203a129c
2021-09-21 15:00:16 -04:00
Julia Reynolds
cf18817877 Add new task to intents that leave Settings am: 76aedd72f0 am: 0d16b9cb68
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/15730311

Change-Id: Ia73f2898a732ac60c43cac5b8cdb372c9e9b8c82
2021-08-31 22:59:20 +00:00
Julia Reynolds
76aedd72f0 Add new task to intents that leave Settings
Test: manual
Fixes: 197702721
Fixes: 197704633
Fixes: 197704125
Fixes: 197704456
Change-Id: Iffeca2d152bd083edafe69a7121d011e284eeb69
2021-08-31 21:13:03 +00:00
Yuri Lin
e9f13fbd5e Rename RadioButtonPreference -> SelectorWithWidgetPreference.
This change is to reduce ambiguity as we're adding the option to style the preference like a checkbox as well.

Bug: 190180868
Test: SelectorWithWidgetPreferenceTest, RunSettingsLibRoboTests
Change-Id: Ie414347bf67ed394ef495604890c5851fc42dbc7
2021-07-20 17:01:21 -04:00
Yi-Ling Chuang
6a83c73624 Fix the non-working DND toggle
The pendingIntent of the DND toggle was set to immutable previously
which doesn't allow any modification. This CL fixes this by making it
mutable.

Fixes: 191865710
Test: Search "dnd" and make sure the toggle has effect upon modification
Change-Id: Iade256cee8885cb80ade5ca95cc50065c2a78da2
2021-06-29 12:46:08 +08:00
Julia Reynolds
4c7981eb0d Disable additional pkgs on DND perm page
Because they will always have access because they hold
the permission to manage notifications.

Test: manual
Fixes: 191973668
Change-Id: I456aec41b401bba6f10d9ea969e2fb8c4300825d
2021-06-25 09:17:41 -04:00
Julia Reynolds
393134f9b1 Validate config activities with their rule owners
Test: RoboTests
Bug: 189332346
Change-Id: Iee1b1caca4d6eb2729feb872c3e4954b6c16519c
2021-06-16 15:40:34 -04:00
Julia Reynolds
eb838f2eef Revert DND toggle back to a button
Test: manual, Robotests
Fixes: 188616179
Change-Id: I70b469ff6ef809056c9eceec7f87f91aed9a23ca
2021-06-02 11:31:59 -04:00
Beverly
06b1ba1d09 Update custom zen settings "off" string
zen_mode_sound_summary_off should only be used when describing the
number of schedules that are enabled (and requires a numeric parameter).
Instead, use the string "off" when a sound isn't enabled by a custom dnd
setting.

Fixes: 189120026
Test: manual
Change-Id: I8bc180353a61455b124801d14f0d319f49bb341c
2021-05-25 13:31:52 -04:00
Julia Reynolds
fef73ef82a Don't show DND access settings in managed users
Test: launch direct intent in a managed user
Fixes: 187304252
Change-Id: I1cfcf8c147fc47b4e2fb2a725cba9846e4f09055
2021-05-11 16:35:42 +00:00