Commit Graph

252 Commits

Author SHA1 Message Date
Tarandeep Singh
4513699583 Make few of the new IMS API methods final
d8d03a8e1b added new methods to
InputMethodService.
Allowing IME developers to override some of these methods would introduce
unnecessary complexity. Making these methods final makes sure developers
cannot inject some unexpected behavior when called by system.

Bug: 73701052
Test: atest InputMethodServiceTest
Test: atest CtsInputMethodServiceHostTestCases
Change-Id: I1af4ed05a0b7306d840a21129e921a57b4a5fc33
2018-03-08 19:25:38 +00:00
Tarandeep Singh
164cfba536 IME API: rename IMS methods.
Incorporating API Review feedback:
* Use IMS.switchInputMethod(id) instead of IMS.setInputMethod()
* Use IMS.switchInputMethod(id, subtypeId) instead of
  IMS.setInputMethodAndSubtype()
* Renamed switchToLastInputMethod() to switchToPreviousInputMethod()

Bug: 73954137
Test: atest InputMethodServiceTest
Test: atest CtsInputMethodServiceHostTestCases
Change-Id: I6efd5ca473e33e6faeadb7eea7772b9d2b8ca12b
2018-03-06 02:23:15 +00:00
tiansiming [田思明]
f96309e812 Merge "Modify javadoc for onWindowShown" am: 2d46e07e48 am: d5d1718c4a
am: b95b38ca3a

Change-Id: I04bbf26857e60a1129c6947cb91fffef2c939edf
2018-02-09 06:51:32 +00:00
tiansiming [田思明]
b95b38ca3a Merge "Modify javadoc for onWindowShown" am: 2d46e07e48
am: d5d1718c4a

Change-Id: I82c1c9a4601e579b34e6f8c40f80258b78a8a7d8
2018-02-09 06:39:54 +00:00
tiansiming [田思明]
b9025932bc Modify javadoc for onWindowShown
onWindowShown is more like it should called after mWindow.show()
in InputMethodService. Considering the compatibility problem, just
make its javadoc clearer to the IME developers rather than
change the calling order.

Bug: 72922821
Test: N/A

Change-Id: Ibfe20f40a65475f39c8e79d10e2c494e212cf054
Signed-off-by: tiansiming [田思明] <tiansiming@xiaomi.com>
2018-02-07 15:40:07 +00:00
Jon Dormody
8ea40cf752 Merge "Docs: Inserting a line to include the documentation for keyPreviewHeight." into oc-mr1-dev am: 7b3c924114
am: afb592c4bf

Change-Id: I2276021c9c2ae453add4e139b677dcfe7e71facd
2018-01-29 19:52:56 +00:00
Tarandeep Singh
3fecef119e Make IMS.setBackDisposition() work.
InputMethodService.setBackDisposition() has been broken from a long
time. This is how setBackDisposition() is supposed to work
1. BACK_DISPOSITION_WILL_DISMISS:
When Keyboard is visible back button will show as down arrow (in
navigation bar) and tapping it will dismiss keyboard.
2. BACK_DISPOSITION_WILL_NOT_DISMISS:
When keyboard is visible, back button will be shown as BACK arrow and
tapping it will send the back event to current activity. If activity
doesn't handle onKeyDown() for back button, activity will finish and
keyboard will hide.

Note: backDisposition flags reset when finishInput() is called.

Bug: 38513361
Test: Manual with apk attached in bug
Test: atest InputMethodServiceTest
Change-Id: I99e7c413fe1a93f8d8cff897b5c5f0947690d2c0
2018-01-23 14:56:06 -08:00
Jonathan Dormody
bfaf862130 Docs: Inserting a line to include the documentation for
keyPreviewHeight.

Test: make ds-docs

Bug: 68838052
Change-Id: I25c58d2cfd2fe3637edcd6962202e5b0d1632e0e
2018-01-22 15:49:04 -07:00
TreeHugger Robot
4ae9eacc84 Merge "Unhide InputMethodService#requestShowSelf()" 2018-01-16 16:10:53 +00:00
Yohei Yukawa
fbc2f7acd5 Unhide InputMethodService#requestShowSelf()
This is a follow up CL to a recent CL [1], which aimed to move several
APIs only for InputMethodService from InputMethodManager to
InputMethodService.

This CL removes InputMethodService#hideSoftInputFromInputMethod(),
which is exactly the same as InputMethodService#requestHideSelf() that
is already available as a public API for IME developers.

This CL also virtually renames
InputMethodService#showSoftInputFromInputMethod() to
InputMethodService#requestShowSelf(), which has existed as a
private method but not been exposed to IME developers yet.

 [1]: I3163f3cbe557c85103ca287bee0874a3b4194032
      d8d03a8e1b

Bug: 70282603
Test: atest CtsInputMethodTestCases
Change-Id: If6a786c5774805d041ea9672ef2721e4a38df7fc
2018-01-16 08:09:11 -08:00
TreeHugger Robot
2bb444136a Merge changes I30b40c48,I7d02c54c,Id68ebd35
* changes:
  Use lambda when appropriate
  Remove redundant type casts
  Fix JavaDoc errors
2018-01-15 02:19:15 +00:00
Yohei Yukawa
623e94b857 Use lambda when appropriate
This is a safe refactoring that should have no behavior change in
terms of semantics and performance characteristics.

Test: make -j checkbuild
Change-Id: I30b40c483e490ff42c1c707233ca5cc7b67da28f
2018-01-14 16:30:59 -08:00
Yohei Yukawa
31a260f144 Remove redundant type casts
Test: make -j checkbuild
Change-Id: I7d02c54c09543848711c1f3204719a79593a3cbd
2018-01-14 16:24:26 -08:00
Yohei Yukawa
2b63434b93 Follow method renamings
This is a follow up CL to a recent CL [1], which deprecated several
APIs InputMethodManager class but forgot to update some of existing
call sites in InputMethodService to use new method names.

This CL only addresses deprecated API usage warnings.  There should be
no behavior change.

 [1]: I3163f3cbe557c85103ca287bee0874a3b4194032
      d8d03a8e1b

Bug: 70282603
Test: atest CtsInputMethodTestCases
Change-Id: I709ca997523ac9a9cd2d236f3158bbb18cf2edc3
2018-01-14 16:15:31 -08:00
Yohei Yukawa
b2a0e0509a Fix JavaDoc errors
Test: make -j checkbuild
Change-Id: Id68ebd3588cd286c821da49e3bda4299d311e8b9
2018-01-14 16:06:16 -08:00
Yohei Yukawa
8f162c6e84 DecorView#mNavigationGuard is gone
With this CL, DecorView#mNavigationGuard that handles navigation bar
only for IME windows [1] is finally gone and replaced with the
standard mechanism to handle navigation bar layout padding /
background color.

This CL addresses multiple anomalies regarding how the following APIs
work for IME windows.

 * Window#setNavigationBarColor()
   * Previous behavior:
    - Only works for Color#TRANSPARENT [2].
    - Ignores FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS.
   * New behavior:
    - Works as documented.
    - Requires FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS to work.

 * SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION flag
   * Previous behavior:
    - The system automatically sets
      SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION to the IME windows [3].
    - Does not work as documented. Content area is not extended to the
      navigation bar area.
    - Manually unsetting SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION can cause
      unexpected layout, because the system expects that this flag is
      always set to the IME window.
    - Had a special logic for FLAG_LAYOUT_IN_OVERSCAN [4].
   * New behavior:
    - Works as documented.
    - Can set/unset as necessary.

From the viewpoint of IME developers, this CL enables IME windows to
 * correctly extend the input view to the navigation bar region by
   using SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION as documented, instead of
   relying on a special hack with FLAG_LAYOUT_IN_OVERSCAN hack.
 * use Window#setNavigationBarColor() to easily change the navigation
   bar background color, like other non-floating windows.

Note that SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR is not yet supported for
IME windows, which will be implemented in a subsequent CL.

 [1]: I6a93f30aec83f1cecfb854073046cbc87ab4aa66
      ae3349e1c3
 [2]: Iea77915ecc55eedaf19899e72c44f704ba9d852c
      0a9d1ea015
 [3]: I460912ee7c117480c57b947ed31eca330819f32c
      c68d577f29
 [4]: Ic38f204a892bf34e8dae65990d5aa8c95af555d8
      9b32a35aa7
 [5]: I4b10a19641bd3ce6c43e7629404b6f202d4186e8

Fix: 25706186
Bug: 69002467
Test: ThemedNavBarKeyboard sample [5] works for the following cases
      * Extended Dark Navigation Bar
      * Separate Dark Navigation Bar
      * Floating Mode (if the target app uses dark navigation bar)
Change-Id: I664630099b6eb3fe31675444ba94944cb0eb98b0
2018-01-10 13:18:09 -08:00
Tarandeep Singh
d8d03a8e1b Move IME related API methods from IMM to IMS.
InputMethodManager is public InputMethod API for apps. The methods
that take Window-token as parameter are restricted to system
and/or IME developers. Such methods should really live
in InputMethodService.
This CL deprecates such methods in IMM and moves them to IMS.

This is the first step towards simplifying IME APIs.

Bug: 70282603
Test: atest InputMethodManagerTest
Change-Id: I3163f3cbe557c85103ca287bee0874a3b4194032
2017-12-08 10:40:38 -08:00
Eugene Susla
d4128ec0df Revert "Don't generate irrelevant a11y events - framework"
This reverts commit 8ddfb4794f.

Test: presubmit
Bug: 69975306
Change-Id: I05cb545eb0adc77298dddf2dea2997ef36b58a5f
2017-12-05 13:08:51 -08:00
Svet Ganov
8ddfb4794f Don't generate irrelevant a11y events - framework
Now before we fire an a11y event we check if this event has an
observer. As a bonus we don't push the state to clients if the
dynamic service config did not change.

Test: cts-tradefed run cts-dev -m CtsAccessibilityServiceTestCases

bug:69427760

Change-Id: Ie208e13b8557bb7a120198a43efcb79c2752f5db
2017-11-28 17:58:38 -08:00
Tarandeep Singh
1d113d041f Skip blocking InputConnection APIs after unbind
InputConnectionWrapper has several synchronous methods which have a
timeout. If the application's UI thread hangs, all these synchronous
methods are blocked and IME stays on-screen.

This CL aims to improve the responsiveness of IMEs by rejecting
any blocking calls of InputConnection APIs once
IInputMethod#unbindInput() is issued by InputMethodManagerService
(IMMS).

Currently #unbindInput() is issued only from
IMMS#unbindCurrentClientLocked(), which basically means that the
previous application is losing the IME focus.

Underlying #onUnbindInput() signal is still immediately delivered
to the IME process, but it's just waiting to be consumed on the UI thread.
Hence in theory we can change the behavior of InputConnection seen
from the IME once the signal is delivered to the IME process.

This CL does not interrupt already blocked API calls, which is one of
future work for this scenario. This CL relies on:

 A. IInputMethod is marked as oneway
 B. IMMS guarantees that IInputMethod#bindInput() and
     IInputMethod#unbindInput() are always paired without nesting,
     and IInputMethod#startInput() is called 0 or more times only
     during that pair.

In this case, the system guarantees that IInputMethod methods
will be called back in the IME process in the same order, and only
one IPC thread is handling those IPCs at the same time. See the
JavaDoc of IBinder#FLAG_ONEWAY for details.

Bug: 36897707
Test: Manual: using the apk in the linked bug:
1. Make sure that a valid InputConnection is established between
   the test app and a test IME.
2. Let the test app start blocking the UI thread.
3. Let the test IME call InputConnection#getTextBeforeCursor()
   three times.
4. Tap the Home button on the NavBar.
5. Make sure that the test app is immediately dismissed.
6. Make sure that InputConnection#getTextBeforeCursor() starts
   returning immediately, once after the initial call was timed-
   out after 2 sec (InputConnectionWrapper#MAX_WAIT_TIME_MILLIS)

Change-Id: I0f816c6ca4c5c0664962432b913f074605fedd27
2017-10-19 17:55:41 -07:00
Yohei Yukawa
930328ca97 Annotate threads for some IME handling methods
This is a preparation to work on Bug 36897707.

For instance, the reason why most of IME-related callbacks in
InputMethodService get called on the main thread is because
IInputMethodWrapper keeps forwarding incoming IPCs into the
main looper of the IME process as follows:

  InputMethodManagerService (IMMS)
        ------
    -> one-way binder IPCs over	IInputMethod
        ------
      -> IInputMethodWrapper (on the binder thread(s))
       -> Handler (to dispatch tasks to main thread)
        -> InputMethodImpl.* (on the main thread)
         -> InputMethodService.* (on the main thread)

By adding explicit annotations such as @BinderThread and @MainThread
in relevant methods, this CL makes that kind of investigation much
easier than before.

Bug: 36897707
Test: compile
Change-Id: I8f9afe9a1986a9fa41fb66fdc64e8f0f67e45c2e
2017-10-18 20:19:53 -07:00
Yohei Yukawa
16f0407708 Add missing JavaDoc for IMS.InputMethodImpl
Bug: 36897707
Test: checkbuild
Change-Id: If1f7cfbfe333f30468d551e8a92bba9f987e8a06
2017-10-18 20:19:43 -07:00
Yohei Yukawa
6f0bf747eb No-op code cleanup for IInputMethodWrapper
This CL is a safe and no-op code clean-up, including dead code removal.
There should be no behavior change.

Test: continuous tests
Bug: 36897707
Change-Id: I4a1ad9cb764c7ba82b32e325c4a4b1c8e7296bbf
2017-10-18 20:19:33 -07:00
Tarandeep Singh
e1cfcf4c4d Fix keyboard focus in VR
Consider this VirtualDisplay (VD) scenario:
HostActivity creates a VD which holds SettingsActivity. When EditText
on SettingsActivity is tapped, it gains focus.
On eventual taps, it loses focus i.e. the Window in VD loses focus and
the host activity in primary display gets the focus instead. This
happens because WM's TaskTapPointerEventListener.onPointerEvent()
is called on the default display only.

Root cause:
1. Tap detector isn't registered for non-default display.
2. Tap detector has no info on which displayId touch was received.
3. InputFlinger doesn't deliver InputMonitor events for
non-default displays (fixed in a separate CL)

Fixing above results in onPointerEvent(MotionEvent) to deliver the
Touch events successfully to VD. We restrict these changes to physical
multi-displays and VR VirtualDisplays (which uses virtual touch device).
[VrManagerService calls WMInternal.setVr2dDisplayId(int)]

In future, displayId should be part of InputEvent. Bug: 64258305

Bug: 62033391
Test: bit FrameworksServicesTests:com.android.server.wm.DisplayContentTests
Change-Id: I3626f4de5aa9bcf905da9abd39f3ab1baefc4c48
2017-08-02 10:46:22 -07:00
Alan Viverette
51efddbd3b Remove unnecessary casts on calls to findViewById
Just frameworks/ this time. More paths to come.

Bug: 24137209
Test: make -j32
Change-Id: Iff27abd26fa43296ac2fff8f534fc6742d2ae80c
2017-04-14 11:15:50 -04:00
Mark Renouf
270e4953d2 Corrects CompactExtractEditLayout to account for systemWindowInsetBottom am: d1a0d19794
am: 8f9a6c3e89

Change-Id: I10087b9982b3eceb200b447d4faecad4eb8d19fe
2017-03-31 15:20:24 +00:00
Mark Renouf
d1a0d19794 Corrects CompactExtractEditLayout to account for systemWindowInsetBottom
Percentage-base sizes involving screen height are incorrect for watch
devices with non 1:1 display metrics. These are round screens with an
inactive bottom portion. To maintain the correct proportions the
bottom inset must be added to the height.

BUG: 36728475
Change-Id: Ibe351d1db7964b4b89ce9a588c171cd8407e2a50
2017-03-30 15:01:55 -04:00
Phil Weaver
385912ee2d Deprecate "speak passwords" setting.
This will now be controlled by individual accessibility services.
We'll provide the password information to them, and they can
present or hide the information as it makes sense for their users.

Password information was anyway provided when a headset was
connected.

Bug: 28139568
Test: Manually verified that TalkBack now speaks passwords on the
lock screen and in text views. Since I'm removing functionality
that didn't have tests, it's tricky to have specific tests.
Change-Id: Ic3c724ccce5762ee9dcd9e7dcbd4eae6734dd05e
2017-02-21 15:24:54 -08:00
Yohei Yukawa
4e28668a15 Fix duplicate calls of IMS#doStartInput()
This is another follow up CL to my previous CL [1], which had a bug
that InputMethodService#doStartInput() is now always called back twice.

There was a careless mistake when rebasing the CL [1] onto the previous
CL [2], which ended up with dispatching startInput() twice in
IInputMethodWrapper.

In short, InputMethod#dispatchStartInputWithToken() is the new way to
dispatch startInput()/restartInput(). We do not need to call both of
them.

 [1]: I9921b381e02106dbffff5e0b3d13f0a1245ce807
      6db3bfe33d
 [2]: I476d0cf8cbb0a0134941854f9337d9ad15e66a71
      f7526b5896

Test: Set true to InputMethodService#DEBUG and make sure startInput()
      and restartInput() are called in the following scenario.
      1. Complete the setup wizard.
      2. adb shell am start -a android.app.action.SET_NEW_PASSWORD
      3. Proceed to "Choose your password" page
      4. Make sure startInput() gets called only once.
      5. Type "aaaa" then hit "CONTINUE" button.
      6. Make sure restartInput() gets called only once.
Bug: 35079353
Fixes: 35442939
Change-Id: Ifde16c3fad5b787d4c9a11bd886943dfe96f9eb9
2017-02-16 17:19:00 -08:00
Yohei Yukawa
6db3bfe33d Track event flow to IMMS#setImeWindowStatus
This is part of work to introduce historical debugging infrastructure
for Android IME.

In this CL, we will focus on the following two event flows.

 A1. IMMS#attachNewInputLocked() queues MSG_(RE)START_INPUT to deliver
     new InputConnection/EditorInfo to the current IME
 A2. The IME triggers IMS#onStartInput()/IMS#onRestartInput() and
     updates the following fields:
      - InputMethodService#mStartedInputConnection
      - InputMethodService#mInputEditorInfo

 B1. IME is expected to call back IMM#setImeWindowStatus() to notify
     its window visibility change to IMMS.
 B2. IMMS updates the following field if the caller is still the
     current IME.
      - InputMethodManagerService#mImeWindowVis

What this CL aims to do is to enable IMMS to access A1 state when it
was in B2 state, by considering that for given a B1 the last A2
happened before B1 is the cause of B1 and B2.

To do this, IMMS issues a binder token in A1 and each IME keeps it
so that it can be passed in B1. By using this Binder token as a key,
IMMS can keep tracking state snapshot taken from each A1. Note that
those state snapshots keep alive until the Binder token's proxy in the
IME process loses strong reference from its GC root.

Test: Make sure `adb shell dumpsys input_method | grep mImeWindowVis`
      matches to the IME window visibility.
Test: Make sure the current IME is not receiving any
      InvalidParameterException from IMMS.
Bug: 35079353
Change-Id: I9921b381e02106dbffff5e0b3d13f0a1245ce807
2017-02-13 12:04:41 -08:00
Yohei Yukawa
f7526b5896 Merge restartInput into startInput in internal IPC
This is the 2nd attempt to merge restartInput into startInput in
internal IPC after fixing the mistake in new parameter order in
the previous CL [1].

As a preparation to start tracking all the event flows that
cause InputMethodManagerService#setImeWindowStatus(), this CL
merges an internal IPC method IInputMethod#restartInput() into
IInputMethod#startInput() in favor of simplicity.

This is a refactoring CL that should have no behavior change.

 [1]: Ifda6f74ac1b1370d9e9a9fe60354b692121fdcb9
      1a5838e966

Test: Set true to InputMethodService#DEBUG and make sure startInput()
      and restartInput() are called in the following scenario.
      1. Complete the setup wizard.
      2. adb shell am start -a android.app.action.SET_NEW_PASSWORD
      3. Proceed to "Choose your password" page
      4. Make sure startInput() gets called.
      5. Type "aaaa" then hit "CONTINUE" button.
      6. Make sure restartInput() gets called.
Bug: 35079353
Change-Id: I476d0cf8cbb0a0134941854f9337d9ad15e66a71
2017-02-11 20:57:10 -08:00
Yohei Yukawa
3eaf867487 Revert "Merge restartInput into startInput in internal IPC"
This reverts commit 1a5838e966 [1].

Reason of revert:
There was a mistake in the parameter order of MSG_START_INPUT.

 [1]: Ifda6f74ac1b1370d9e9a9fe60354b692121fdcb9

Test: none. This is a revert.
Bug: 35079353
Change-Id: Ic1487768932febe0f1f1b6e71929464e91f357e0
2017-02-11 23:42:15 +00:00
Yohei Yukawa
1a5838e966 Merge restartInput into startInput in internal IPC
As a preparation to start tracking all the event flows that
cause InputMethodManagerService#setImeWindowStatus(), this CL
merges an internal IPC method IInputMethod#restartInput() into
IInputMethod#startInput() in favor of simplicity.

Test: Done some quick manual testing to make sure that IME is
      still working
Bug: 35079353
Change-Id: Ifda6f74ac1b1370d9e9a9fe60354b692121fdcb9
2017-02-11 02:56:48 +00:00
Yohei Yukawa
2bc66171cc Eliminate out-of-sync IMM#mFullscreenMode error
As explained in the commit message of my previous CL [1], we have
had a design issue in how to notify the full-screen mode change
from the IME to InputMethodManager running in the target application.

Histrically we have done this by using hooking the following IPC
from the IME to the target application.

  InputConnection#reportFullscreenMode()

However, since we also want InputConnection to be deactivated in some
situations such as the when the target application is no longer
focused. In other words, InputConnection is not a reliable way to
notify something.

As a result, we have suffered from many stale state issues.
Bug 21455064 and Bug 28157836 are such examples.  In Android N, we
introduced yet another hack to work around those issues, but it is
really time to fix the protocol design instead.

The new strategy is to rely on internal IPCs provided by
InputMethodManager to deliver such critical notifications from one
process to the other. This is actually more natural because our goal
is to make sure that InputMethodManager#isFullscreenMode() always
returns the latest value as long as the caller is the focused
application.

For backword compatibility, applications that are monitoring
this callback should continue working, as InputMethodManager emulates
the previous behavior.  However, as updated in JavaDoc, IMEs are no
longer allowed to invoke InputConnection#reportFullscreenMode(),
which should be OK because even on previous releases IMEs should rely on
InputMethodService#updateFullscreenMode() instead.

 [1]: Iba184245a01a3b340f006bc4e415d304de3c2696
      1544def0fa

Fixes: 28406127
Test: Make sure Bug 21455064 is still fixed.
       1. Input some words in extract mode.
       2. Select a word.
       3. Perform copy.
       4. Select a word.
       5. Rotate the device.
       6. Try to select a word.
       7. Make sure he word is selected and action mode starts.
Test: Make sure Bug 28157836 is still fixed.
       1. Rotate device to landscape mode.
       2. Tap on EditText and start full screen extracted mode.
       3. Rotate device to portrait mode.
       4. Long press to start action mode.
       5. Make sure Action mode gets started.
Test: `adb shell dumpsys input_method` to make sure that fullscreen
      state is synchronized across the app, IMMS, and the IME.
Change-Id: If23e7c7c265ab3dfb48c2fb6fdb361b17d22c594
2017-02-09 00:51:18 +00:00
Yohei Yukawa
d033283508 No warning/info log for expected/normal situations
This CL hides warning and info log messages from
InputMethodManagerService (IMMS) and InputMethodService (IMS) behind
DEBUG flag like other logs unless the state is certainly unusual.

Of course the definition of "unusual" is still an open question, but
basically that we should not see any suspicious message from IMMS/IMS
just by turning on a new phone, launching some applications, typing
something, and turning off the device. IMMS and IMS should expect all
events that can (easily) occur in that scenario, and no log is
necessary for such things.

Note that warnings suppressed with TODO comments will be tracked
under Bug 34851776 (and Bug 34886274).

Test: adb logcat -s InputMethodManagerService:* InputMethodService:*
      to monitor log in the following scenario:
       1. Boot the device.
       2. Complete the setup wizard.
       3. Launch Dialer and type something on it.
       4. Launch Contacts app and type something on it.
       5. Try some special modes:
           - Turn on/off display
           - Recents screen
           - Split-window mode
           - Guest user
           - Multi user
           - Direct-boot (setup a device password and reboot)
      except for logs about actual IPC calls from a background user.
Bug: 34838583
Bug: 34851776
Bug: 34886274
Change-Id: I3fcdeb919bb2f2940da9ff45e17ac00baa1253f4
2017-02-01 13:59:43 -08:00
Elliot Waite
0ce4b0e4c3 Fix @links in reference docs. am: 54de77470d am: ab978c035e am: 28ba4722a9
am: 9b21265b2c

Change-Id: If246ebdb36cf2832d5a6c42cbe752e290b6fb6e8
2017-01-26 04:49:33 +00:00
Elliot Waite
54de77470d Fix @links in reference docs.
Change-Id: I40cea46efd80c448640ff69753698fe8404da40b
2017-01-25 17:00:55 -08:00
Yohei Yukawa
ac0211a478 Update JavaDoc for IMS#enableHardwareAcceleration
This makes it clear that on Android L+ devices IME developers basically
no longer need to call InputMethodService#enableHardwareAcceleration(),
because it is deprecated in Android L[1][2].  On L+ devices what IME
developers need to do is to make sure that their IMEs are compatible
with both hardware and software rendering so that the system can choose
the best rendering method.

This is basically a code clean-up that should not change any actual
behavior.

 [1]: I906d48cb07af50fa02dae4f4ecdb5e65211fc6ef
      5e1565ead6
 [2]: I126ea823eb2eeabb29d30999dec9c9411b33b315
      e07b595519

Bug: 31202732
Change-Id: I416669b172737e3eb3d77165dcea50289d207514
2016-09-01 12:41:58 -07:00
Yohei Yukawa
a3fd8bfdfe Merge \"Merge \\"Use a flag to grant a temporary URI permission.\\" into nyc-mr1-dev am: cb56978912\" into nyc-mr1-dev-plus-aosp
am: c58ffb3f9c

Change-Id: Iddc693412d20b86c3a916dd09764d14d23c4fcf4
2016-06-27 20:34:58 +00:00
Yohei Yukawa
45700fa135 Use a flag to grant a temporary URI permission.
It turns out that we can let the system to call
InputMethodService#exposeContent(InputContentInfo, EditorInfo), which
added in my previous CL [1], during the IME is calling
InputConnection#commitContent() as follows.

  [IME]
  InputContentInfo contentInfo = new InputContentInfo(
          contentUri,
          new ClipDescription(description, new String[]{mimeType}),
          linkUrl);
  getCurrentInputConnection().commitContent(
          inputContentInfo,
          InputConnection.INPUT_CONTENT_GRANT_READ_URI_PERMISSION,
          null);

  [App]
  try {
      contentInfo.requestPermission();
      // Load inputContentInfo.getContentUri() here.
  } finally {
      contentInfo.releasePermission();
  }

This gives us flexibility to let InputConnection#commitContent() do all
the magic for IME developers like other APIs such as
Context#startActivity(), rather than asking them to call one more API to
grant a temporary URI permission like a scenario where
Context#grantUriPermission() is used.

 [1]: I2772889ca01f2ecb2cdeed4e04a9319bdf7bc5a6
      25e0813e6e

Bug: 29450031
Change-Id: I99536cd58c9984af30b0bafb4a1dd25a26634a2d
2016-06-23 17:12:59 -07:00
Yohei Yukawa
bf055ba658 Merge \\"Add InputMethodService#exposeContent()\\" into nyc-mr1-dev am: dc42d7dd13
am: d02470f5a8

Change-Id: Id551d53ae3d7c34157ddf166aa44bdef67d46853
2016-06-23 01:37:10 +00:00
Yohei Yukawa
25e0813e6e Add InputMethodService#exposeContent()
This is a follow up CL to my previous CLs [1][2] that introduced
InputConnection#commitContent(InputContentInfo, Bundle) API to enable
IMEs to send a content to the target application.

With this CL, IME developers are able to temporarily expose
InputContentInfo object to the target package without permanently
granting URI permission.  Although calling IMS#exposeContent() is
allowed only for the IME that is currently selected, the client is able
to request a temporary read-only access even after the current IME is
switched to any other IME as long as the client keeps InputContentInfo
object.

Here is a sample code snippet about how to use this mechanism.

  [IME]
  InputContentInfo contentInfo = new InputContentInfo(
          contentUri,
          new ClipDescription(description, new String[]{mimeType}),
          linkUrl);
  exposeContent(contentInfo, getCurrentInputEditorInfo());
  getCurrentInputConnection().commitContent(inputContentInfo, null);

  [App]
  try {
      contentInfo.requestPermission();
      // Load inputContentInfo.getContentUri() here.
  } finally {
      contentInfo.releasePermission();
  }

 [1]: Iaadf934a997ffcd6000a516cc3c1873db56e60ad
      152944f490
 [2]: Ica1ba3154795c1bf44e140dfe639b299f83cd8af
      adebb52588

Bug: 29450031
Change-Id: I2772889ca01f2ecb2cdeed4e04a9319bdf7bc5a6
2016-06-22 16:31:41 -07:00
Aurimas Liutikas
514c5ef8d5 Add missing @Deprecated annotations.
Add missing @Deprecated annotations for methods with @deprecated tag
in javadoc.

Change-Id: I35b78ccb97832d86b914c21a300444ba29e33844
2016-05-24 15:22:55 -07:00
Yohei Yukawa
833bdcedce Make IMS#clearInsetOfPreviousIme() reliable.
This is a follow-up to my previous CL [1] for Bug 15922840 so that we
can clear the following variables in a more reliable way.
 - PhoneWindowManager#mLastInputMethodWindow
 - PhoneWindowManager#mLastInputMethodTargetWindow

The idea behind CL [2] is that when InputMethodManagerService (IMMS) is
switching from an IME to another IME, IMMS can send a signal to
WindowManagerService (WMS) to remember the current IME's inset so that
the system can continue using it to reduce jank until the new inset is
specified by the next IME.  As summarized in Bug 28781358, however, if
the next IME does not show the window after the IME switch, WMS (or
PhoneWindowManager to be precise) keeps using the previous IME's inset
unexpectedly until the new IME shows its window.  All we have seen in
Bug 15922840 and Bug 26663589 fall into this category.

The idea of this CL is just adding a hidden API to InputMethodManager so
that InputMethodService#clearInsetOfPreviousIme() can surely terminate
the IME transition state managed in PhoneWindowManager, rather than
relying on a hack of calling SoftInputWindow#show() and
SoftInputWindow#hide(), which actually does not work for Bug 26663589.

 [1]: Ib04967f39b2529251e4835c42e9f99dba2cf43f2
      2977eb7b6c
 [2]: I5723f627ce323b0d12bd7b93f5b35fc4d342b50c
      792faa2c16

Note that addressing all the corner cases in [2] still requires lots of
non-trivial change.  Hence this CL focuses only on Bug 26663589 (and
the case we handled in Bug 15922840).

Bug: 26663589
Change-Id: Ib567daa009c1139858dccadcfc6a04465ebecf36
2016-05-15 20:05:56 -07:00
Yohei Yukawa
d0d0797474 Fix a behavior change in "Show software keyboard".
This bug was a corner case of stopping lying about
Configuration#keyboard when "Show software keyboard" is turned on, which
was done by my CL [1] in Android N development cycle.

Previous implementation

  if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {

had relied on the fact that the system was lying about config.keyboard,
which is no longer valid.  We need to change the behavior of
InputMethodService#onShowInputRequested() depending on
Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD like we did for
InputMethodService#onEvaluateInputViewShown() in [1] to minimize the
impact on stopping lying about Configuration#keyboard.

 [1]: Id4d332e3909590c68345e10e1f2e18650efb2eb7
      7b739a802c

Bug: 28423439
Change-Id: I8a774cbf61ac706d8446be91b17bceee57a13656
2016-05-04 11:56:35 -07:00
Mark Renouf
91eb2651a0 Customizes input extract edit view for Wear
Provides an alternate presentation of the extract edit area
of an input method window, designed for sub 250dp width screens.

An icon is used on a round material style button in place of a text
action, providing more horizontal space for the editing area.

BUG: 28098677
(cherry picked from commit fd71a6a5d99bad5d3ab32edc328fb5b026b66215)

Change-Id: I0e559d17f78d1a48b37979a49e11ae1aad7503f4
2016-04-12 15:05:13 +00:00
Yohei Yukawa
757224008e Revert "Customizes input extract edit view for Wear"
This reverts commit 880602eb64 [1],
which was committed with a wrong author email address and lacked license
notice in some files.  To avoid confusion, this we decided to
temporarily revert that CL so that we can commit it with proper license
notice and author address again.

 [1]: I16226ce393f2d15065d08e66a36d008eb1a0c8a1

Bug: 22512982
Bug: 28098677
Change-Id: I3dd3c7bf0ee9634fc4f3bf433bf5023675873e46
2016-04-09 15:24:02 -07:00
Mark Renouf
880602eb64 Customizes input extract edit view for Wear
Provides an alternate presentation of the extract edit area
of an input method window, designed for sub 250dp width screens.

An icon is used on a round material style button in place of a text
action, providing more horizontal space for the editing area.

BUG: 22512982
Change-Id: I16226ce393f2d15065d08e66a36d008eb1a0c8a1
(cherry picked from commit fd71a6a5d99bad5d3ab32edc328fb5b026b66215)
2016-04-08 16:56:25 -04:00
Yohei Yukawa
2dbc532429 Fix a regression in SHOW_IME_WITH_HARD_KEYBOARD handling.
This is a follow up CL to my previous CL [1], which caused a regression
that LatinIME does not correctly initialize its UI when:
  1. Make sure SHOW_IME_WITH_HARD_KEYBOARD is off.
  2. Pair a hardware keyboard.
  3. Reboot.
  4. Make sure the hardware keyboard is paird.
  5. Focus in a text box.
  6. Make sure that LatinIME does not show software keyboard.
  7. Tap the IME switcher and turn of "Show Input Method" toggle.

Previously IMS had called many methods from
IMS#onConfigurationChanged(), which was just replaced with
IMS#restartInput() by my CL [1] then broke some assumptions in LatinIME.
This could also break other IMEs' assumptions as well.

To avoid unexpected regressions between M and N like this, this CL
ensures that those methods are called as we have done until [1].

 [1]: Id4d332e3909590c68345e10e1f2e18650efb2eb7
      7b739a802c

Bug: 26985193
Change-Id: Iebd98f26d388b64cb318ac202b3bcdd956bd3a27
2016-04-06 05:47:14 +00:00
Yohei Yukawa
ef5b4657a8 Fix a bug that IMS#mShowInputFlags is never updated.
As a preparation to fix bug 26985193, this CL fixes a bug that
IMS#ShowInputFlags is never updated.  As a result,
IMS#onConfigurationChanged() has always called
IMS#onShowInputRequested() with specifying 0 to flags parameter, which
is wrong.

With this CL, we can assume that IMS#mShowInputFlags keeps tracking the
last value when it should do.  Also, we can remove IMS#mShowInputForced
since it is now determined by IMS#mShowInputFlags.

Bug: 26985193
Change-Id: Ieff634b69ce941d78ffe208547f7edd19ea28643
2016-04-03 22:50:11 -07:00