This is a preparation to mark
InputMethodManager#setCurrentInputMethodSubtype() deprecated.
InputMethodManager#setCurrentInputMethodSubtype(), which was
introduced in Android 4.0 ICS [1], was probably mistakenly exposed as
a public API, because it has required WRITE_SECURE_SETTINGS that
typical applications cannot have.
Keeping maintaining InputMethodManager#setCurrentInputMethodSubtype()
is not that simple because now we are about to enable per-profile IME
mode, where this method needs to have a more clear spec about what
"Current" means.
An ideal solution is just removing this method, because if the caller
already has WRITE_SECURE_SETTINGS permission, they can just directly
update Settings.Secure.SELECTED_INPUT_METHOD_SUBTYPE to achieve the
same goal. However, given that this has been a public API, it would
probably make sense to provide a fallback implementation like I did
for null IME token in InputMethodManager#setInputMethod() [2].
Either way, InputMethodManager#setCurrentInputMethodSubtype() will be
marked as deprecated in a subsequent CL.
[1]: I55daa19ba924999def544bf841f00bf54852f3e1
b66d287e30
[2]: I42dd0325b01c527009bf85566ca8ba0766b2294e
0c1ebffdb3
Bug: 123249820
Test: manually done with a test app that has WRITE_SECURE_SETTINGS
Change-Id: I76da83c57cffc6b73defccfd4a1b5734c958a97e
This CL marks InputMethodService#onViewClicked() deprecated. There is
no actual implementation change at this moment, but developers should
avoid relying on this callback in general not only on futuer versions
of Android but also on existing devices.
Since this API was implemented in Android 4.0 ICS [1] it never worked
well for WebView and any other UI libraries that expose themselves as
a giant "Canvas", which can host their own UI hierarchy and sub focus
state.
If IME developers want consistent and reliable user interaction across
devices and applicactions, implementing IMEs' own UI on top of
CursorAnchorInfo API would be a good choice.
If IME developers just want to be notified an existing input
connection is interrupted, they can just monitor
InputMethodService#onFinishInput().
[1]: Ia71ad325e50a20e9e1001def662ef992bb50a9d0
863fcd6217
Fix: 123245358
Test: make -j checkbuild
Change-Id: I37a6c6d82d4a424f0df84633b09bca4881efbf02
A system API VrManager#setVrInputMethod(), which was originally
introduced in Android P [1], has hever been used actually. To avoid
unnecessary maintenance burden in the Android Framework, this CL makes
VrManager#setVrInputMethod() no-op.
For those who want to develop VR Keyboard, they should be able to use
Android P build to see if it actually works and it's actually what
they want. In the future, if we can have a working prototype, we can
revisit here to see if we want to restore the framework implementation
or not.
Note that with this CL IMEs that have android:isVrOnly="true" will
always be ignored.
There should be no user/developer visible behavior change because this
is about an unused system API.
[1]: I1db7981b5198e7e203d4578cae7e5b6d20037d0d
89a6c48a8b
Bug: 72522822
Fix: 122058241
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:InputMethodInfoTest
Test: atest FrameworksServicesTests:InputMethodManagerServiceTests
Change-Id: I5464ff74b92ff4a0d30002d643bd3c89925f0f0c
* changes:
Unhide parts of SurfaceControl API in SDK.
Replace SurfaceView background with boundless color layer.
SurfaceControl: Accept instance rather than handle for reparent
GestureDetector can now send the long press event sooner,
if a force touch has been detected by the system.
At the same time, we need to inhibit any scrolling action whenever the
CLASSIFICATION_AMBIGUOUS_GESTURE is set.
Bug: 62940136
Test: used HeatMapDemo app to register GestureDetector
and print out messages. Also observed the CLASSIFICATION_DEEP_PRESS
to ensure events are correlated.
Change-Id: I82ac1cc43d35df69a7a9649c628b995074394be6
WebView will use the node addresses as the id, and these address are 64 bits.
Fixes: 123234726
Test: atest ContentCaptureSessionTest ViewNodeTest ContentCaptureSessionTest \
CtsContentCaptureServiceTestCases \
CtsAutoFillServiceTestCases:VirtualContainerActivityTest \
CtsAutoFillServiceTestCases:VirtualContainerActivityCompatModeTest
Test: m update-api
Test: manual verification with Webview, as CtsAutoFillServiceTestCases:WebViewActivityTest is broken
Change-Id: Iaf3008ed2dd530e596489cb144da678a4dac48ca
In parity with the recently exposed NDK APIs. In addition removing @hide
we make a few changes to prepare the APIs for being public.
1. Use a hidden singleton SurfaceSession
2. Expose a Surface constructor for ANativeWindow inter-op
3. Mark SurfaceControl final
4. Implement setGeometry as public version of setPosition/matrix/crop.
5. Add a visibility toggle method (as opposed to show/hide methods) for
parity with NDK.
Bug: 111297488
Test: android.view.cts.SurfaceControlTests
Change-Id: Iac043658a360a48086ef4701a6a8ba2396878e81
In preparation for making SurfaceControl final, as part of API
publication.
Bug: 111297488
Test: Manual
Change-Id: I08a9a86b5341e146a62e39dfd876a48d965bce41
Previously, privileged processes (w/ INTERACT_ACROSS_USERS_FULL) that
run as user X are automatically allowed to connect to the current IME
even when it runs as a different user Y.
However, as explained in my previous CL [1], there are many text
operations that are already fully multiuser-aware hence need to be
connected to the right user's services.
If EditorInfo#targetInputMethodUser [2] is not correctly set when it
should have been, it's highly likely that the IME client would need to
call TextView#setTextOperationUser() [3] as I did for System UI [1].
To detect such problems as early as possible, with this CL
IMMS#startInputOrWindowGainedFocus() no longer resolves null
EditorInfo#targetInputMethodUser as the current IME user for
privileged processes that have INTERACT_ACROSS_USERS_FULL permission.
If this CL broke some IME use case, most likely the IME client app
would need to be fixed.
[1]: Ibabe13e5b85e5bb91f9f8af6ec07c395c25c4393
7276946b92
[2]: Ia7ea944438d69669ccdf9111b34ba400e786a602
0f5eade4a4
[3]: I6d11e4d6a84570bc2991a8552349e8b216b0d139
401e3d4c84
Bug: 34886274
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: per-profile mode still works.
Test: Manually tested multi-user 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.
16. Set up a text screenlock.
17. Turn off the display.
18. Turn on the display.
19. Make sure that SoftKeyboard Sample IME is shown.
Change-Id: Ieb94ed14698ee2669adc5fb2ea0e93c7d0e09e8b
Instead of turning off the new window insets system fully on or
off, we introduce three modes:
0: Old system
1: New system for IME only
2: New system for IME + system bars
This allows us to launch the feature in IME only mode, in order to
avoid a lot of compatibility fallout around system bars.
Test: adb shell setprop persist.wm.new_insets 0/1/2
Bug: 118118435
Change-Id: Iaa49e62930b2539770cd313567dde4b102216097
This CL deprecates SuggestionSpan#ACTION_SUGGESTION_PICKED and related
constants [1].
There are multiple security concerns, open questions about
compatibility, and maintainance challanges in this protocol.
IME developers can implement their own suggestion picker UI on top of
CursorAnchorInfo API to achieve safer, should give more flexible UI
options, better security, and better compatibility.
[1]: Ia539de0acf66053e0349daec459d75e36805f6bf
f9f0100862
Fix: 123160396
Test: make -j checkbuild
Change-Id: I6d39e838ae47488055162cd44b5f553f68869b17
It was calling isVisibleToUser(), which is expensive.
Bug: 121039624
Test: atest CtsContentCaptureServiceTestCases
Change-Id: If641a01a5a6706743caefaa5fa34114902cd2c49
They can be expensive to calculate, so the cost/benefit is not worth it...
Bug: 121039624
Test: atest CtsContentCaptureServiceTestCases \
FrameworksCoreTests:android.view.contentcapture.ViewNodeTest
Change-Id: I2950fb5916ab8fceb5c089742e99c197e3d017e9
This flag was meant to indicate when a text was changed by the user (for example, using IME), but
that information is not readly available and would require changes in too many parts of the system,
so it's not worth the effort (at least for now...).
Test: m update-api
Test: atest CtsContentCaptureServiceTestCases \
FrameworksCoreTests:android.view.contentcapture.ContentCaptureSessionTest
Fixes: 121045053
Change-Id: Ifcdd5e5bb0c6c5c0f840fe0bbdbda8eca9bdb479
This is a follow up CL to our previous CL [1], which enabled spell
checker for background users. In that CL, we assumed that spell
checker user ID can and should always be determined by the calling
user ID. This assumption is not valid at least for direct-reply
notifications on System UI, because System UI always runs as user 0 no
matter who is the current active user.
In order to allow TextServicesManagerService (TSMS) connect to the
right user for such a special use case, this CL introduces a hidden
parameter "userId" to each IPC so that clients that have
INTERACT_ACROSS_USERS_FULL can override the target user ID when
necessary.
For instance, to interact with user 10's spell checker services, you
can obrain a special instance of TextServicesManager as follows.
TextServicesManager tsmForUser10 = context
.createPackageContextAsUser("android", 0, 10 /* userId */)
.getSystemService(TextServicesManager.class)
If the calling process does not belong to user 10, any operations on
that TextServicesManager will result in SecurityException unless the
calling package needs to have INTERACT_ACROSS_USERS_FULL.
This CL is just a preparation. There should be no user-visible
behavior change yet.
[1]: I06c27ef834203a21cc445dc126602c799384527b
06a2624049
Bug: 123043618
Test: spell checker still works
Change-Id: I31dda3ae8795190d44b0622b8335c34ddbc5dd48
This is a preparation to propagate the expected IME user ID from
direct-reply notification to InputMethodManagerService (IMMS).
When per-profile IME mode [1] is enabled, IMMS basically assumes that
the IME user ID should be determined by calling process's user ID.
This works for most of apps, but does not work for direct-reply hosted
in the System UI process, which always runs as user 0.
With this CL, client apps can explicitly specify the target IME user
ID by using @hide field in EditorInfo. For instance, to tell IMMS to
connect to user 10's IME, do this:
@Override
public InputConnection onCreateInputConnection(EditorInfo info) {
InputConnection ic = super.onCreateInputConnection(info);
info.targetInputMethodUser = UserHandle.of(10); // user 10
return ic;
}
The calling process will receive SecurityException if it does not
belong to user 10 and does not have INTERACT_ACROSS_USERS_FULL.
This CL is just a preparation. There should be no user-visible
behavior change yet.
[1]: Ied99664d3dc61b97c919b220c601f90b29761b96
a878b9500e
Bug: 120744418
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: Ia7ea944438d69669ccdf9111b34ba400e786a602
To facilitate the need of returning color spaces about the composition
pipeline, add an API to query this information. This API will be used by Canvas
and Display, etc.
BUG: 120904891
Test: Build, flash and boot. Verify by checking returned values.
Change-Id: I97123ba1488ca76888a4c004128b4100a7c1f76c
This feature involves generating and loading code on the
application. Applications may use the preferCodeIntegrity flag to indicate they
do not want this behavior, so we need to respect this preference. We also
disable loading precompiled layouts for privapps.
Bug: 111895153
Change-Id: I5c563e9f6eb7dd5eb7aac7df3838888f71b38866