Commit Graph

189 Commits

Author SHA1 Message Date
Raff Tsai
1f30b1cd67 Merge similar BaseSearchIndexProvider code together
Bug: 135053028
Test: robolectric, check search_index.db contains the same items
Change-Id: If3c18a170b0e671690df1fdf26e59a421d2c48cd
2019-09-12 11:09:09 +08:00
Sunny Shao
7687e0b17d Use FooterPreference in xml explicitly
Removed the FooterPreferenceMixin from the UserSettings page.

Fixes: 140008560
Test: manual test
Test: make RunSettingsRoboTests ROBOTEST_FILTER=com.android.settings.users
Change-Id: If6da2bd2f6a72d8e61b8c8bca9e3179cfdee05e6
2019-08-26 17:08:31 +08:00
Bookatz
6a3f2bfe2a Merge "If cannot add restricted profile, don't suggest it" into qt-dev
am: a5018be48a

Change-Id: Ic94e5f918a0db96dd21d8f719231bb65f31bd613
2019-06-17 18:43:04 -07:00
Bookatz
673bc9d01c If cannot add restricted profile, don't suggest it
Previously, on devices that cannot add a restricted profile (e.g. most
phones), the Multiple users menu had an option to "Add user", whereas
for devices that can, the option read "Add user or profile". Now it only
says the latter, due to ag/6412347. We add back the original wording
here.

Fixes: 135294519
Test: manual confirmation on a phone that text says "Add user"
Test: m -j ROBOTEST_FILTER=UserSettingsTest RunSettingsRoboTests
Change-Id: Ia166b6ff9c69c0042e8a781be1146a5622177121
2019-06-17 18:33:16 +00:00
Colin Cross
807e861105 Use if instead of switch for resources
Converting to Soong will move some code from directly compiled
into the app to compiled into an Android library and then
shared between the app and the tests.  This will cause resource
IDs in the library to become non-final, which means they can
no longer be used in case statements.  Convert affect case
statements to if blocks.

Test: m RunSettingsRoboTests
Change-Id: I25742a374f06d3fa4decbfc0d223a350acc50881
2019-05-13 13:42:01 -07:00
Raff Tsai
b508184d60 Remove "Add users from lock screen" from secondary users
Fixes: 124885010
Test: Robolectric, manual
Change-Id: I1c940fda2fa5f3da39c19bd119ac483024f5a83b
2019-03-07 13:20:02 +08:00
Pavel Grafov
19cf0b4580 Don't hide "Add user" when disallowed by admin
Bug: 125226170
Test: atest tests/robotests/src/com/android/settings/users/UserSettingsTest.java
Test: manual, with TestDPC
Change-Id: I347fae04030e04325a5ee5c634f782e554ece263
2019-02-21 13:38:53 +00:00
Fan Zhang
31b210017b Migrate all MetricsProto enums to SettingsEnums
Bug: 122855168
Test: rebuild
Change-Id: I962d9a71179f86b7cae9dc5e9a00e0aa1557dc76
2019-01-17 14:55:42 -08:00
Jonathan Scott
ba3b68686d Add policy transparency to disallow remove user.
On the Settings > System -> Multiple users screen, ensures that the"Delete from this device" menu is always available, but is disabled and includes policy information when DISABLE_REMOVE_USER is set.

Change-Id: Ia6c6cfb360f35a6e447bf9d85d2472ac11dde1ac
Fix: 113807450
Test: m ROBOTEST_FILTER=UserSettingsTest -j40 RunSettingsRoboTests; CTS Verifier Device Owner Tests/Policy transparency test/Disallow remove user.
2018-09-19 09:32:35 +01:00
Doris Ling
73d7773eb2 Fix visibility of AddUser when toggling multiuser.
- when enabling multi user, also need to update the visibility of the
Add user preference, but need to check the add user capability as well.

Change-Id: Ia243901c7537bdb39ca3a39aed559b003f803e4d
Fixes: 115397726
Test: make RunSettingsRoboTests
2018-09-12 12:33:46 -07:00
Doris Ling
e845b40f35 Do not show AddUser if adding user is not allowed.
- when multi user is enabled, we should keep the current visibility for
AddUser preference, since earlier check has been done to update its
visibility according to the add user capability. We should only set the
visibility to false if multi user is disabled.

Change-Id: I246e9242f255dbd57c5309b2d16c95d202607531
Fixes: 114241868
Test: make RunSettingsRoboTests
2018-09-07 14:08:49 -07:00
Philip P. Moltmann
e3f721132a RestrictedLockUtils was split into ...Internal
This means that in some cases RestrictedLockUtils has to be used and in
some RestrictedLockUtilsInternal.

This causes a lot of trivial code changes.

I also updated the ordering of the imports in all affected files.

Bug: 110953302
Test: Built
      make -j RunSettingsRoboTests
Change-Id: I9bdf8b89134f853bae4f38c81af436715c73e924
2018-08-30 08:11:39 -07:00
Fan Zhang
a79c377fbc Declare "searchable" attribute for preferences.
Now we can easily mark a preference nonIndexable in xml instead of
adding key into searchIndexProvider.

Bug: 112608186
Test: robotests
Change-Id: I0ff16d44bb7b6ad148d3d35f09ca0da0163f73f4
2018-08-16 09:06:39 -07:00
tmfang
41ab6b4bf8 Migrate all AlertDialogs to AndroidX version
This CL only changed AlertDialog imports.
So, reviewer can review it easily.

Change-Id: I097bc44394195b14287f4f920c570ac8653f356a
Fixes: 111413092
Test: This CL can't pass Robo test.
2018-07-20 11:32:13 +08:00
tmfang
27c84de325 Settings Fragment Migration (Build pass app)
This patch focused on fixing compile errors and some runtime errors.

Test: We can't test it now. But we will have an integration test later.
Bug: 110259478
Change-Id: I16c471ddcd0fa1460c665b7f74d86fcace5ee67b
2018-07-11 18:24:51 -07:00
Yongjiang Wu
5b120e7479 Fix new user setting in a call
In a call, the flag of UserManager is changed, then "Add user" and
"Guest" items in Settings are still enabled.
To fix this issue, these items will be disabled according to
"UserManager#canSwitchUsers".

Bug: 80447394
Test: make RunSettingsRoboTests ROBOTEST_FILTER=UserSettingsTest
Change-Id: Ib4c754603418528f5c6f1c78b8aabf33e863c8b9
2018-07-03 14:20:39 -07:00
Fan Zhang
78ea7da54c Misc tweaks to Indexable usage and tests.
- Make SettingsPreferenceFragment implement Indexable directly
- Add existing fragments that are SettingsPrefFragment but not Indexable
  to grandfather list.
- Fix "font size" fragment so it shows up in search properly.
- Remove duplicates for "lock screen display", "Screen saver".

Bug: 70720645
Test: robotests
Change-Id: I44ce0cac0fdf5e882b315861bb4bebc45dbe01e6
2018-07-02 16:46:23 -07:00
Fan Zhang
c39238c63f Add a switchbar to turn off multi-user feature entirely
Change-Id: Ibf88bf37899af5065c68aeb2337acd4ee48bc13c
Fixes: 72319180
Test: robotest on new controller. Manual test on UserSettings fragment.
2018-06-11 15:00:08 -07:00
Fan Zhang
d63c8ef3b9 No-op clean up on UserSettings to make it more readable
Bug: 72319180
Test: existing tests
Change-Id: Ie7a327658d1fe16055aad7e90ecffc1e56eb6657
2018-06-05 16:29:32 -07:00
hjchangliao
e86eec0c07 Rename SubSettingLauncher.setTitle, add java doc
For make this method usage more clear,
setTitle(charSequence) rename as setTitleText,
add java doc: it is only for user generated string
setTitle(int) rename as setTitleRes.

Change-Id: I972cb6a8ff90873dfdc25c23f6dc3d68103c8e4e
Fixes: 78347436
Test: make RunSettingsRoboTests
2018-05-09 10:00:05 +08:00
Aurimas Liutikas
e0069d332d Migrate Settings to androidx.
Test: make Settings
Bug: 76692459
Change-Id: I941dea40562170649bf056e675cc32e5163c0e39
2018-04-20 12:52:29 -07:00
Tony Mantler
0fcd6cbaa8 Autogenerate SearchIndexableResources subclass
Bug: 77148954
Test: RunSettingsLibRoboTests RunSettingsRoboTests RunSettingsGoogleRoboTests RunArcSettingsRoboTests
Change-Id: I842c42c55014c3310070ef22bd4f0d9a70dfd804
2018-04-03 10:26:55 -07:00
Fan Zhang
ad47e1aada Move Auto sync data prefs from user to account screen
Change-Id: Idb69ed49c6e21f93cafa593ba5e7dffa32f377b7
Fixes: 73739376
Test: existing robotests & atest
2018-03-07 15:53:18 -08:00
Fan Zhang
02caf0f861 Misc fixes to improve search
- Suppress one of results from "On lock screen"
- Remove screen title from sub sections in data usage screen.
- On UserSettins, index using resource instead raw. And build
  non-indexables using getNonIndexable and pref controlleres.

Change-Id: I947a97af60f1a08b237fda2f3c456cf1105b9231
Fixes: 74120518
Fixes: 74119743
Fixes: 74250251
Fixes: 74119687
Test: reindex
2018-03-07 10:00:57 -08:00
Fan Zhang
7cf99f5f12 Migrate more settings to use SubSettingsLauncher
Bug: 73250851
Test: robotests
Change-Id: I08f6f380489646231d6d8ceb1488e2efb036bf69
2018-02-18 21:10:03 -08:00
TreeHugger Robot
7262d37c53 Merge "Highlight row (instead of ripple) when come from search." 2018-02-02 01:15:36 +00:00
Fan Zhang
3d516e7607 Highlight row (instead of ripple) when come from search.
- Moved HighlightableAdapter to its own class
- Replaced ripple with blue background
- Bluebackground only stays for 5 seconds. After that it's replaced by
  ?attr/selectableBackground

Misc fixes.

- Fix NPE in UserSettings
- Update char limit on a new string

Change-Id: I4687e54e71fd7b9243f520b7630563df58be23d4
Fixes: 71715698
Fixes: 72761974
Test: robotests
2018-02-01 12:35:25 -08:00
TreeHugger Robot
b67375876c Merge "Enforce disallow switch user in user settings" 2018-02-01 19:47:44 +00:00
Alex Chau
ffae4c1a0e Enforce disallow switch user in user settings
Disallow the following actions which result in switch user when DISALLOW_USER_SWITCH is set
- Creating guest
- Showing user setup dialog for newly created user
- Clicking uninitialized user preference

Bug: 71694430
Test: CTSVerifier DeviceOwnerPositiveTest - DISALLOW_USER_SWITCH
Test: m -j ROBOTEST_FILTER=UserCapabilitiesTest RunSettingsRoboTests
Test: m -j ROBOTEST_FILTER=AddUserWhenLockedPreferenceController RunSettingsRoboTests
Test: m -j ROBOTEST_FILTER=UserSettingsTest RunSettingsRoboTests
Change-Id: Ia4c7e7b4947bfaf2ebeef4d32a473bdac542d6a6
2018-02-01 17:49:41 +00:00
Fan Zhang
dc2a3528d5 Misc fixes for account/users fragments
- Hide add user button when it's not functional
- Display "No accounts added" under accounts setting when there is no account.

Change-Id: Iefede9939d206eb3064fa22bdcfbcb1e826f29ab
Fixes: 72643060
Test: robotest
Test: 72713118
2018-01-31 10:55:40 -08:00
Fan Zhang
881d579620 Misc fixes for User page and my device info page
- Rename UserAndAccountDashboard* to AccountDashboard*
- Move emergency info from account to device info page

- Move auto sync data toggles (4 of them) from Account page to user page
   - Move the controllers too. UserSettings is a not a DashboardFragment
     so I had to manually call each controller method.
     TODO: refactor UserSettings to a DashboardFragment

- Move legal information/regulatory info above advance button within device info page.

Fixes: 72523158
Bug: 71871075
Test: robotests
Change-Id: I1b8af8af61e49d17926f984978a09a974b6c62e1
2018-01-26 12:39:34 -08:00
TreeHugger Robot
e62023cd1c Merge "Update the usage of getDefaultUserIcon" 2017-11-29 11:13:11 +00:00
Tony Mak
0ba8f51605 Update the usage of getDefaultUserIcon
getDefaultUserIcon now takes resources as parameter for the sake of
resource overlaying.

BUG=69355037
Test: Factory reset and go to settings -> User, observe the new color.

Change-Id: I504acf00c4616c342d2b8e99b061e4043b34c378
2017-11-23 17:08:39 +08:00
Fan Zhang
7d5c9ace64 Add test and fix null keys in search providers.
- Add keys to some screens.
- Remove dynamic saved network/turst agent from search provider.
- Remove dynamic print services from printsettings.

Bug: 69384409
Test: atest
Change-Id: I62dce27d52585badb2a8953a05084e35dbae2f7d
2017-11-16 12:57:45 -08:00
Fan Zhang
4e540db06d Update app icon for ManageDomainUrls setting
Change-Id: I6c26a055983ea72049d1633336d6da8736a78fa0
Fixes: 69057114
Test: robotests
2017-11-09 11:02:23 -08:00
Fan Zhang
a681094e8a Convert SecuritySubSetting into DashboardFragment
Bug: 32953042
Test: robotests
Change-Id: Iecdb0a42695644ff8aa095bcd49b5ccb16aa46d4
2017-11-06 17:26:25 -08:00
xiyuan.wang
c8e304aea6 Merge "Fix app crash while adding new user" am: 1e5cd4c3df am: 5cf3dcd11c
am: 029aeca640

Change-Id: I0c10300fd1714d68769473ab28d90177cbf35162
2017-10-30 18:51:13 +00:00
Fan Zhang
12b03b2794 Clean up: remove dimmableIconPreference
- DimmableIconPreference is not a support pattern.
- Also updated a few icon tint colors to match with the rest of screen.

Bug: 68426851
Test: visual
Change-Id: Ia18d9f74458237403b94d3474cf09050d2039428
2017-10-30 10:06:45 -07:00
xiyuan.wang
b6fa43d980 Fix app crash while adding new user
Settings app crashes when tapping Home key while adding new user because
UserSettings#showDialog() is called after onSaveInstanceState().
To fix this issue, a dialog should not be shown after onPause().

Fixes: 68485787
Test: manual - tap Home key while adding new user

Change-Id: I2ddd119b6558927798a52c7977e6fd8137734c93
2017-10-30 19:55:56 +09:00
Jason Monk
c1cc9fefa8 Allow clicking on guest user
This is needed since the user switch will be hidden by default in
QS and will show up once multi-user has been activated in some way.

Test: click on guest
Bug: 37152893
Change-Id: I351a5d95e9e8a5e47e388d9f0611924b077754da
2017-06-30 11:29:40 -04:00
Maurice Lam
2eb170cd6f Clean up choose lock intent creation
Consolidated the many variants of ChooseLock*.createIntent, so that
it will take the same set of arguments.

Also modified SetupChooseLock*.createIntent to modifyIntentForSetup,
which will take the intent created by ChooseLock* and modify it for
use with setup.

Test: cd tests/robotests && mma
Change-Id: I5ff033f459c33ec9980872a536b3996d89f2bbbb
2017-05-12 15:35:20 -07:00
Doris Ling
81f22e88f9 Update text for Users & accounts page.
- add back the summary loader for UserSettings
- remove "configure" preference category
- add summary for Auto sync data and update the title

Change-Id: Ia00397f775f86d0e160a54783a8518847fce8de8
Bug: 36540644
Test: builds
2017-03-23 12:56:33 -07:00
Doris Ling
ed0fc506a3 Removed emergency info and add user when locked from Users settings.
In new IA, Emergency Info and Add user when locked has been moved to
Users & accounts page.

Change-Id: I1a1e4bd801936b654d8a4ede7cfc64e2ac285019
Fix: 33703736
Test: make SettingsTests
2017-02-24 12:38:57 -08:00
Fan Zhang
c6ca314c0b Log source with visibility change
- Add a method in VisibilityLoggerMixin to log visible event using
  LogMaker, which allows logging additional FIELD_CONTEXT field.
- In Utils.startFragment, add current page's metricsCategory as an extra
  to next page.
- In next page's onResume(), extract the previous page's metricsCategory
  and send it to VisibilityLoggerMixin.visible()
- Update all caller with additional paramters

Change-Id: I8e1f2597fa465b7d3aa16fa1d21c052a3219694a
Fix: 35359289
Test: RunSettingsRoboTests
2017-02-15 17:17:19 -08:00
Fan Zhang
7520e81ab5 Update top level menu items summary text.
- Use static summary for most items
- Move summary for user setting to user&account setting

Bug: 34975053
Test: RunSettingsRoboTests
Change-Id: I9bf87267778dc5933f97f5d3b9ae0f4f0b8da1a8
2017-02-09 15:22:47 -08:00
Lei Yu
3a21de9349 Merge "Add NPE check for method assignDefaultPhoto in Utils.java" 2016-12-28 22:28:10 +00:00
jackqdyulei
8164c64edc Add NPE check for method assignDefaultPhoto in Utils.java
When user press back button while adding user, app may crash because
of null context. In this cl, I add NPE check for context in method
assignDefaultPhoto and change this method to return boolean value.
If the return value is false, then stop the following steps(e.g.
creating a dialog after pressing button may also cause crash.)

Bug: 33829308
Test: make -j40 RunSettingsRoboTests
Change-Id: I811b92c268fb20f8c43ab3b0a9ceebe76f5d83be
2016-12-28 11:30:54 -08:00
Doris Ling
34a4c804f8 Removed emergency info and add user when locked from Users settings.
If new IA is enabled,  Emergency Info and Add user when locked has been moved to
Users & accounts page, so Users page should not show them.

Also fix the issue that update for the add user when locked switch does
not persist correctly.

Change-Id: I26d9f59d0f4bf3fd36a7d07d13f95127b40a8a3e
Fix: 33703736
Test: make RunSettingsRoboTests
2016-12-27 16:35:22 -08:00
Sudheer Shanka
acb1a61f3f Update usage of ActivityManagerNative.
Bug: 30977067
Test: N/A
Change-Id: I46e37a09cff059d2784a819bc2651d6973fbd268
2016-11-14 12:59:11 -08:00
Tamas Berghammer
265d3c2a0c Update package names to work with the proto3 compiler
Bug: b/28974522
Change-Id: I5f3adf4946ee4ba1e09e4f40afe83c151405972a
2016-11-08 14:06:17 +00:00