Commit Graph

25 Commits

Author SHA1 Message Date
Wilson Wu
a7620427b5 Fix wrong user in personal profile
If the user is profile, it should use the current
user's profile parent to create the context instead
of always using the primary user(system user).

Bug: 264867495
Test: Manual test with work profile enabled, multi user flow, etc
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableVirtualKeyboardFragmentTest
Change-Id: I66d1462441359c40dda2a38c7534500791db9c83
2023-03-29 17:36:34 +08:00
Wilson Wu
237a06e0c1 Fix keyboard settings crash in multi-user case
We have CL[1] to fix the NPE when keyboard settings
is launched by work app. CL[1] overlooked the work
profile with multi-user case.

Work profile user ID is not available(return null)
when calling Utils#getManagedProfile by work identity.

For work case, distinguish it's running on managed
profile user(launched by work app) or not. And use
corresponding userId as:

-. If it's a managed profile user, use currentUserId.
-. For a owner user, get managed profile userId.

[1]: Iea573922ee789d9932c0de05bf71179c4f005eeb

Bug: 216395439
Test: Manual test with bugs steps
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableVirtualKeyboardFragmentTest
Change-Id: If018d2fddbbcf932927d2235bb8e99393df1e67c
2022-04-08 11:04:52 +08:00
Pavel Grafov
f8ba876fbe Merge "Make distinction between null and empty IM list." 2022-02-11 12:13:28 +00:00
Wilson Wu
ddb5147649 Fix NPE if keyboard settings is launched by work apps
IME apps can request users to enable them by directly
launching the on-screen keyboard settings page.

If keyboard settings is launched by works apps, the
current userId would be work userId. There is no managed
profile for work user so the exception happened.

-. Use current userId if it's launched by work user
-. Use primary user info for personal fragment

Fix: 216395439
Test: Manual test with issue steps
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableVirtualKeyboardFragmentTest
Change-Id: Iea573922ee789d9932c0de05bf71179c4f005eeb
2022-02-10 15:13:26 +08:00
Pavel Grafov
0b3c4b8a53 Make distinction between null and empty IM list.
* null means no policy is enfrced, any IM is allowed.
* empty means no IMs is allowed except system IMs.

Bug: 211063191
Test: manual, CtsVerifier/BYOD managed provisioning/Policy transparency
Change-Id: I35665a547c1e99129c70c834083b3183ba00208d
2022-02-08 14:47:36 +00:00
Wilson Wu
56d8703fcb Introduce AvailableVirtualKeyboardFragmentTest
Add a test for AvailableVirtualKeyboardFragment

Fix: 207452897
Test: make RunSettingsRoboTests ROBOTEST_FILTER=AvailableVirtualKeyboardFragmentTest
Change-Id: I83d30ae9d085c2b90fd16e5f6c4100bb82b6b588
2022-01-25 14:29:24 +08:00
Wilson Wu
97635f53e6 Make on-screen keyboard settings support tab layout
Introduces following fragments for work flow.

- Add ProfileSelectKeyboardFragment which used to display
  personal/work fragment when user has work profile.
- Introduce UserAwareContext in AvailableVirtualKeyboardFragment
  to support personal/work user installed input methods handling.

Bug: 174360557
Bug: 197707782
Test: Manual test as bug video
Change-Id: I1019e375c5d42de7bc7c048d5d66e8e2f58acce8
2021-11-23 17:10:34 +08:00
Wilson Wu
bc72945561 Use AvailableVirtualKeyboardFragment for IME settings
CL[1] make InputMethodPreference support:
-. Tap to corresponding IMEs settings
-. Using switch to enable/disble IMEs

Using AvailableVirtualKeyboardFragment for
language and input settings entries and
remove unused files.

[1]: I445551e4112117aabd8d7a48f53c29b7ffd8bafd

Bug: 197705032
Test: Manually test settings keyboard flow, test video in bug
Change-Id: I4d74df7d2dda71661e3298c7070459885aa308cb
2021-09-15 18:10:47 +08:00
Alex Johnston
a47f5c1a1c Allow enabled IMEs to be disabled in Settings
* If an IME is not in the permitted IME list and is enabled,
  the user should be able to disable it.
* This prevents the IME from being stuck in a state where the
  user cannot disable it and as a result the user's device
  becomes uncompliant with their IT admin's policy.

Manual testing steps:
* Install TestDPC
* Set up work profile using TestDPC
* Install swiftkey in the work profile
* set permitted input methods (in TestDPC) to only system
* Use adb to enable Swiftkey
* Go to Settings and verify Swiftkey can be disabled
* Once disabled, verify Swiftkey cannot be re-enabled.

Bug: 180517539
Test: manual testing
Change-Id: I7bdd3a0c4fed4d16006445b7774fd1006cc2b569
2021-03-16 10:12:46 +00:00
Raff Tsai
ac3e0d0988 Directly use BaseIndexableProvider
- Add function getXmlResourceId, Fragments don't need to write
xml resource id twice.
- Remove getPreferenceControllers from Indexable.java. Because it will
move to SettingsLib later for other apps which don't need this function

Bug: 135053028
Test: robolectric
Change-Id: I1e74519aecdea3dde64a5aea79f08d766dbc0003
2019-09-24 00:35:52 +08:00
Yohei Yukawa
8cb387adae Let Settings app use InputMethodInfo#loadIcon()
This is a follow up CL to my previous CL [1], which attempted to show
the most appropriate IME icon even when multiple IMEs are implemented
in a single APK.

This CL simplifies the way how IME icon is obtained in the Settings
app, by simply using InputMethodInfo#loadIcon(), which already does
what we want.

Notable user-visible behavior changes are:
 - Like before my previous CL was submitted, android:logo will not be
   used in the IME settings (again).
 - Icons shown in IME settings start having (user) badges like other
   settings pages.
 - If no icon is available in IME,
   PackageManager#getDefaultActivityIcon() will be used. This is
   actually consistent with other settings pages.

 [1]: I406ccc0d53e6ec69793c2fc8be8c6c1c90b34811
      2cae5b8952

Bug: 28204635
Fix: 131432102
Test: Manually verified as follows.
  1. Build aosp_taimen-userdebug and flash it
  2. Install TestDPC.
  3. Set up a work profile
  4. Open Settings App -> System -> Languages & input
     -> Advanced -> Virtual keyboard for work
  5. Make sure the icon of "Android Keyboard (AOSP)" has a small badge.
  6. Tap "Manage keyboards"
  7. Make sure the icon of "Android Keyboard (AOSP)" has the same icon
     as the step 5.
  8. Open Settings App -> System -> Languages & input
     -> Virtual keyboard
  9. Make sure the icon of "Android Keyboard (AOSP)" does not have a
     small badge on it.
 10. Tap "Manage keyboards"
 11. Make sure the icon of "Android Keyboard (AOSP)" has the same icon
     as the step 9.
Change-Id: Ie9be1eb3071abcc2df7723ceb10d76fe458c4808
2019-04-29 18:11:33 -07: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
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
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
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
e3535d9998 Delete DynamicindexableContentMonitor & all refs to it
Convert input device search into a search query loader

And remove old logic from DynamicIndexableContentMonitor

Change-Id: If652b1ea7c8add9185bbd025055e14925d3a8eec
Bug: 64310452
Bug: 63831980
Test: robotests
2017-08-09 17:27:02 -07:00
Tony Mantler
2ec69563cd Add AvailableVirtualKeyboardFragment to TV
Allows enabling/disabling IMEs on TV.
Moves InputMethodPreference to SettingsLib.
Also minor code tidying

Bug: 36079941
Test: Keyboard settings still work on Fugu and Ryu
Change-Id: Idf42cf5c46d5bb32db59924819d64f73d533d105
2017-03-31 14:19:29 -07:00
Tony Mantler
4d27b2ce5b Move InputMethodAndSubtypeEnabler to SettingsLib and port to TV
Bug: 35315463
Test: adb shell am start -a android.settings.INPUT_METHOD_SUBTYPE_SETTINGS
Change-Id: I17e6e64ff2c01577d4036bccafe7d0b4ad1d5ca5
2017-02-17 14:04:40 -08:00
Tadashi G. Takaoka
e776821a8d Move IME related seach landing pages to its fragments
This CL moves the code building index of IMEs from
InputMethodAndLanguageSettings to VirtualKeyboardFragment and
AvailableVirtualKeyboardFragment, so that a search landing page of IME
becomes one of the fragment correctly depending on the IME state.

Bug: 32643633
Test: Manually installing/uninstalling AOSP LatinIME.apk while
      Settings app is/isn't running, then search AOSP and verify the
      landing page is correctly determined by the IME's enable state.
Test: Update robolectric DynamicIndexableContentMonitorTest
Change-Id: Ie44f358c2d3919fc864f4f88e6229293113823dd
2017-01-10 17:07:50 +09: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
Fan Zhang
6507613ebc Log visibility change for all fragments.
Bug: 30681771
Test: SettingsUnitTests

Refactor visibility logging from InstrumentedFragment into a mixin. And
apply mixin in remaining fragments.

Change-Id: Ibbb59904336254a3e4bb9e8c7d0b36e5a6bc2622
2016-08-18 14:04:13 -07:00
Yohei Yukawa
2cae5b8952 Use IME service logo or icon if exists.
With this CL, AvailableVirtualKeyboardFragment searches icon resource in
the following order, which makes it easier to find a certain IME when
one APK contains multiple IMEs.
 1. Service Logo
 2. Service Icon
 3. Application Logo
 4. Application Icon

Bug: 28204635
Change-Id: I406ccc0d53e6ec69793c2fc8be8c6c1c90b34811
2016-04-16 15:52:06 +00:00
Jason Monk
3e19fc5600 Move temporary metrics constants to proto
Change-Id: I8fb3ac22df7bdc52039dd640f7696ebd32281f0b
2016-03-08 14:18:30 -05:00
Abodunrinwa Toki
567ebd68e1 Settings app: Include package icons in list of virtual keyboards
Bug: 25752812
Change-Id: I2070de953c92cce90dbf178c9ffdbe300d4c2646
2016-01-25 22:19:23 +00:00
Abodunrinwa Toki
976bb3f459 Change Input Settings UI flow.
1. Introduces new UI components as per the new flow
2. Temporarily disables components in the old flow that are to be
   replaced by the new flow. This is done so we can neatly revert
   to the old flow if there are issues with the new flow
3. AvailableVirtualKeyboardActivity now responds to
   android.settings.INPUT_METHOD_SETTINGS intents instead of
   InputMethodAndLanguageSettingsActivity

Bug: 25752812
Change-Id: I728d7ee185827ed328c16cb7abce244557a26518
2016-01-22 18:24:44 +00:00