Android implements many complex text-related operations as per-user
out-of-process services. Notable examples are:
* InputMethodServices
* SpellCheckerService
* TextClassifierService
* AutofillService
For service client processes to connect to the right user's services
often the system assumes that a process that runs as user X should
connect to services that run as user X. While this approach works for
most of cases, there is at least one exception, System UI, which
always runs as the primary user (unless the device enables special
mode e.g. UserManager.isSplitSystemUser()) no matter who is the
current foreground user.
In order to deal with this special case, we recently introduced an
@hide API TextView#setTextOperationUser() [1] to centralize cross-user
special logic inside TextView. With this CL, KeyguardPasswordView and
RemoteInputView actually start calling it.
Note that TextView#setTextOperationUser() already takes care of IMEs
and SpellCheckers hence those two operations start working as expected
with this CL. Once TextView#setTextOperationUser() start taking care
of other operations such as text classification and clipboard,
KeyguardPasswordView and RemoteInputView will be automatically taken
care of with no code change.
[1]: I6d11e4d6a84570bc2991a8552349e8b216b0d139
401e3d4c842ce86569de4477138137dc07a6aa6f
Fix: 120744418
Fix: 123043618
Test: atest SystemUITests
Test: Manually tested Bug 120744418 scenario as follows.
1. Build and flash an AOSP build
2. adb root
3. adb shell setprop persist.debug.per_profile_ime 1
4. adb reboot
5. Install Test DPC
6. Enable managed profile with Test DPC
7. make -j SoftKeyboard
8. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
9. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
10. adb shell ime set com.example.android.softkeyboard/.SoftKeyboard
11. make -j EditTextVariations
12. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
13. adb shell am start --user 0 \
-n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
14. Tap the menu icon on the EditTextVariations then click "Direct Reply"
15. adb shell am start --user 10 \
-n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
16. Tap the menu icon on the EditTextVariations then click "Direct Reply"
17. Open notification shade.
18. Tap reply icon on "Message from UserHandle{0}".
19. Make sure that SoftKeyboard Sample IME is shown.
20. Tap reply icon on "Message from UserHandle{10}".
21. Make sure that AOSP Keyboard is shown.
22. Tap reply icon on "Message from UserHandle{0}" again.
23. Make sure that SoftKeyboard Sample IME is shown again.
Test: Manually tested Bug 123043618 scenario as follows.
1. Build and flash an AOSP build
2. Create a secondary user then switch to it.
3. make -j SoftKeyboard
4. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
5. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
6. adb shell ime set com.example.android.softkeyboard/.SoftKeyboard
7. make -j EditTextVariations
8. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
9. adb shell am start \
-n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
10. Tap the menu icon on the EditTextVariations then click "Direct Reply"
11. Tap reply icon on "Message from UserHandle{10}".
12. Make sure that SoftKeyboard Sample IME is shown.
13. Type "ggggg" then hit the space key.
14. Make sure that red underline is drawn under "ggggg"
15. Make sure that AndroidSpellCheckerService runs as user 10.
Test: Manually tested multi-user scenario with per-profile mode as follows.
1. Build and flash an AOSP build
2. adb root
3. adb shell setprop persist.debug.per_profile_ime 1
4. adb reboot
5. Create a secondary user then switch to it.
6. make -j SoftKeyboard
7. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
8. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
9. adb shell ime set com.example.android.softkeyboard/.SoftKeyboard
10. make -j EditTextVariations
11. adb install -r $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
12. adb shell am start \
-n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
13. Tap the menu icon on the EditTextVariations then click "Direct Reply"
14. Tap reply icon on "Message from UserHandle{10}".
15. Make sure that SoftKeyboard Sample IME is shown.
16. Type "ggggg" then hit the space key.
17. Make sure that red underline is drawn under "ggggg"
18. Make sure that AndroidSpellCheckerService runs as user 10.
19. Set up a text screenlock.
20. Turn off the display.
21. Turn on the display.
22. Make sure that SoftKeyboard Sample IME is shown.
Change-Id: Ibabe13e5b85e5bb91f9f8af6ec07c395c25c4393
There's been a long-standing bug where secondary external storage
volumes were being scanned into a single "external" database. We've
had the logic in MediaProvider for a long time to support individual
databases on a per-UUID basis, but that regressed at some point.
This change revives that logic, which has the benefit of greatly
speeding up media scanning of secondary storage devices, since we can
preserve those databases instead of churning the primary "external"
database whenever they're ejected and reinserted.
Future work will clean up stale databases in the recently added idle
maintenance service.
Bug: 117932814, 122060093
Test: atest MediaProviderTests
Test: atest cts/tests/tests/media/src/android/media/cts/MediaScanner*
Test: atest cts/tests/tests/provider/src/android/provider/cts/MediaStore*
Change-Id: Ib48577a2146758acd882db0b1767e88f3a70247f
The new format is described in tools/metalava/FORMAT.md.
Fixes: 116589402 Switch signature files over to the v2 format
Fixes: 112626813 Drop "synchronized" modifier from the signature format
Fixes: 122358225 Omit overriding methods that only differ in final [...]
Fixes: 73088715 API Review: Need doclava to output nullability
Fixes: 79739773 API Review: Metalava enforcing constants are constant
Exempt-From-Owner-Approval: Large-scale tooling change
Test: make sdk, make update-api, make checkapi
Change-Id: Ia248aece5250e84e47c815c601133b698bf644c2
This CL introduces a unified way for framework developers to specify
whose components should be interacting with the given TextView. An
important use case is the direct-reply UI notification hosted in
System UI, which always runs as user 0 no matter who is the current
user.
For instance, to let the given EditText interact with user 10's input
methods and spell checkers, you can call setTextOperationUser() as
follows.
editText.setTextOperationUser(UserHandle.of(10));
In this way we can easily propergate the same user ID to other
components such as autofill and text classifer as necessary in the
future.
No one calls TextView#setTextOperationUser() yet hence there should be
no user-visible behavior change.
Bug: 120744418
Bug: 123043618
Test: spell checker still works
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I6d11e4d6a84570bc2991a8552349e8b216b0d139