Commit Graph

197 Commits

Author SHA1 Message Date
Clara Bayarri
5ba31aa77d Fix crash in KeyboardView with null Handler
A recent change in how the handler is created in KeyboardView
caused the password change flow to crash in ChooseLockPassword.

Change-Id: Id5fcb256f9a09b75bf91c5c79614d8abfc29747f
2015-10-23 14:27:40 +01:00
John Reck
d0374c6b25 Fix a few view ctors to not call Looper.myLooper
Bug: 25116730
Change-Id: I4e394c281feef6f7987433298d66f2df11352416
2015-10-20 14:20:33 -07:00
Yohei Yukawa
6fcbb56290 Handle BadTokenException exception more reliably.
This is a follow up for I2c21573cf972145ab08e66604cdb9344139a3f31, which
added BadTokenException handler so that we can deal with unavoidable
runtime exceptions. However, it turns out that CL does not work well
in a certain case.

One problem in I2c21573cf972145ab08e66604cdb9344139a3f31 that it added
the exception handler in the call site of
InputMethodService#showWindow(boolean) rather than callee side as
follows.

    try {
        showWindow(true);
    } catch (BadTokenException e) {
        if (DEBUG) Log.v(TAG, "BadTokenException: IME is done.");
        mWindowVisible = false;
    }

However, the above code fails to update #mWindowVisible if an IME
overrides InputMethodService#showWindow(boolean) but catch-and-ignore
BadTokenException as follows.

    @Override
    public void showWindow(boolean showInput) {
        try {
            super.showWindow(showInput);
            // Do something if super.showWindow() succeeds.
        } catch (BadTokenException ex) {
            // Do something if super.showWindow() fails.
        }
    }

With this CL, InputMethodService#mWindowVisible is always updated in
the callee side whenever it should be.

Note that this CL does not change anything about which method can
throw BadTokenException and which method catch-and-ignores it so as
not to break existing IMEs unexpectedly.

Bug: 23798142
Change-Id: Id1e5f236f48c8ef01b7f157ba3f6e7ab2c26b135
2015-09-14 16:48:15 -07:00
Yohei Yukawa
686e03454b Merge "Mechanical merge of nested if statements." 2015-09-14 03:50:22 +00:00
Yohei Yukawa
24182f3dac Remove redundant casts.
This Cl is just a mechanical removal of redundant casts.
Nothing is changed logically.

Bug: 22285167
Change-Id: I460b781753553c002b6cd232ae5918b7acd616d9
2015-09-11 18:33:33 -07:00
Yohei Yukawa
ac8bdd203c Mechanical merge of nested if statements.
This is just a mechanical merge of nested if statements with a dead code
removal.  Nothing is changed logically.

Bug: 22285167
Change-Id: I28c1de84635b68108b25ec32ec58de2128758512
2015-09-11 18:17:11 -07:00
Keisuke Kuroyanagi
2305f99d01 am abe22377: am 7423ca03: am d49c3b65: am 00eb5767: am 437eb6ce: Merge "Fix: Wrong suggestion popup position in extract mode." into mnc-dev
* commit 'abe22377262a2aadbeb3b64d8bc10916b0256d6d':
  Fix: Wrong suggestion popup position in extract mode.
2015-07-21 00:14:50 +00:00
Keisuke Kuroyanagi
fd3eff27bd Fix: Wrong suggestion popup position in extract mode.
Replace text was handled by the original EditText; thus, we
couldn't correctly decide popup window position.
Also, changing selection range replaces entire text of the
extracted EditText. As a result, text cannot be replaced
with the selected item when there is a selection.

This change is a workaround for this issue. This quits
offering "Replace" for selection in extract mode.

Bug: 22038802
Change-Id: I052b027cfd10eeb289f77f4c6b228acf58fea636
2015-07-17 16:36:57 -07:00
Andrei Stingaceanu
e937abe222 am 943b001c: am b9384d5d: am 31ccc9f0: am a7e2ab6e: am 8af7432c: Merge "Fix "Select All" in extracted mode" into mnc-dev
* commit '943b001c80e43d1b36d3f6b8b21673df40942daf':
  Fix "Select All" in extracted mode
2015-07-14 18:47:11 +00:00
Andrei Stingaceanu
a2c1d7841a am 464f4006: am dfa116e2: am 2e59771e: am 0e6360f4: am a9b9907f: Merge "Fix insertion handle disappearing in extract mode" into mnc-dev
* commit '464f40065f0ccd41214733d2a158a035a8b644b6':
  Fix insertion handle disappearing in extract mode
2015-07-14 18:46:57 +00:00
Andrei Stingaceanu
5396c131c0 Fix "Select All" in extracted mode
Stop calling onExtractTextContextMenuItem if "Select All"
is selected (the action does not modify text thus does
not need batch editing). Editor#finishBatchEdit reports
that text changed which in turn can stop the action mode
and the selection after it was started by onPreDraw.

Bug: 22059417
Change-Id: I5354cbe4bae374e0d5f3de39616336170ee33b92
2015-07-14 11:37:28 +01:00
Seigo Nonaka
93c47eab2b Update fullscreen state on hiding window.
Need to update fullscreen state on hiding window as well as showing
window, otherwise IMM#isFullscreenWindow reports obsolete state after
hiding window by back key or device rotation.

Bug: 22238567
Change-Id: Ic8de161cd5d2ee161f32b9942cdc2c331ea4d48e
2015-07-14 15:08:52 +09:00
Andrei Stingaceanu
cfa13a77ed Fix insertion handle disappearing in extract mode
In extract mode, on every screen touch
TextView#setExtractedText gets called which calls
SpannableStringBuilder#sendTextChanged which in turn stops
the action mode. As a fix, if the text is the same only
copy the spans without replacing everything.

Bug: 22315095
Change-Id: I28da760b3dc11e1cfbaf720e547bd817c5b89d7e
2015-07-13 11:14:43 +01:00
Yohei Yukawa
e9311579da am 6a402ca6: am d408d293: am ab142f7f: Merge "Handle back key to cancel text action mode in full-screen IME." into mnc-dev
* commit '6a402ca629185576cf774587da8079977833d25e':
  Handle back key to cancel text action mode in full-screen IME.
2015-06-25 20:16:27 +00:00
Yohei Yukawa
38940aab69 Handle back key to cancel text action mode in full-screen IME.
This CL is a follow up to I7998c8ee2162a0e01525a0cd66ec14fa505,
which completely removed ExtractActionMode including back key
handling in InputMethodService when full-screen mode is enabled.

It turns out that back key events still need to be handled in
InputMethodService when full-screen mode is enabled so that
users can still cancel floating text action mode with back key.

Bug: 22034992
Change-Id: I5f8db34f7425eef343d40d9820925ea6aaf9fccc
2015-06-24 00:20:24 -07:00
Andrei Stingaceanu
ec9e10b74d am 4ca5725f: am 76d2204d: am b1891b3f: Fix selection by double tap in Extracted mode
* commit '4ca5725f95e613a9550f77e4ec155432141a8095':
  Fix selection by double tap in Extracted mode
2015-06-22 13:36:36 +00:00
Andrei Stingaceanu
b1891b3fc9 Fix selection by double tap in Extracted mode
Select with double tap in extracted mode has suffered
a regression recently: flickers and it does not correctly
select. Found this fix after a lot of trials.

Bug: 20128047
Change-Id: I1bbe8c11982d37e5409bac2b648a31b0ca1f0bbc
2015-06-22 12:42:06 +01:00
Yohei Yukawa
5b2a0987fa Fix JavaDoc error in I392166c77cd9dd2c432dc4f1274312f8355de02b.
Fix confirmed with 'make doc-comment-check-docs'

Bug: 21446448
Change-Id: Ica4359b13ddbc790740cc22c95b9e002f7c8e4b8
(cherry picked from commit fd65287cfd)
2015-06-12 04:57:29 +00:00
Yohei Yukawa
fd65287cfd Fix JavaDoc error in I392166c77cd9dd2c432dc4f1274312f8355de02b.
Fix confirmed with 'make doc-comment-check-docs'

Bug: 21446448
Change-Id: Ica4359b13ddbc790740cc22c95b9e002f7c8e4b8
2015-06-11 21:42:49 -07:00
Yohei Yukawa
b75c59ffd0 am 4878a26c: am bbbe13d5: am d4673355: Merge "Keyboard.Key#onReleased() should handle inside parameter." into mnc-dev
* commit '4878a26cb6bf9367ec438621bb6506385eee6604':
  Keyboard.Key#onReleased() should handle inside parameter.
2015-06-12 01:36:50 +00:00
Yohei Yukawa
d46733556b Merge "Keyboard.Key#onReleased() should handle inside parameter." into mnc-dev 2015-06-12 00:38:25 +00:00
Yohei Yukawa
5c31de33cc Keyboard.Key#onReleased() should handle inside parameter.
The boolean parameter of Keyboard.Key#onReleased(boolean) has
been somehow ignored since Capcake.  With this CL, that method
starts working as documented.

Alternatively we could fix the issue when and only when the
application's targetSdkVersion >= 23.  We didn't do that because:
- Although Keyboard.Key class is a public API, it is supposed to
  be used almost only by android.inputmethodservice.KeyboardView.
  The risk of unwanted compatibility problems is low.
- Fixing that is beneficial for users because it actually fixes
  UX issue when applications/IMEs that still rely on KeyboardView
  run in Android M.
- All the fields that are related to Keyboard.Key#onReleased are
  public fields so developers can easily work around anyway.

Bug: 21446448
Change-Id: I392166c77cd9dd2c432dc4f1274312f8355de02b
2015-06-11 11:45:34 -07:00
Andrei Stingaceanu
710645eb36 Remove ExtractEditAction - part 1
Use the floating toolbar action mode instead.
This change is identical to 7315b15a034eeb2d9a4cd24c100023c048ca
(minus string changes). Due to scary conflicts in strings I will
make the string changes in the next CL.

Change-Id: Ia66ef5e886df1fc42a8e1ba52d77141e1e88dbd4
2015-06-11 18:35:00 +01:00
Andrei Stingaceanu
1036c74784 Revert "Completely remove ExtractActionMode - master cherrypick"
This reverts commit 00245473db.

Change-Id: If078c09fbdfd00d005ff58d543f03601b96eef0a
2015-06-11 14:34:50 +00:00
Andrei Stingaceanu
00245473db Completely remove ExtractActionMode - master cherrypick
Use the floating toolbar action mode instead.
This CL is identical to ag/701639. The merge to master was skipped
due to a conflict. This is the 'manual merge'

Bug: 20128047
Change-Id: I5ef9b4b5b9574a4a360a853b2d1abd5b374f2fd5
2015-06-11 14:43:41 +01:00
Andrei Stingaceanu
4c1b7315b1 Completely remove ExtractActionMode from ExtractEditLayout
Use the floating toolbar action mode instead.

Bug: 20128047
Change-Id: I7998c8ee2162a0e01525a0cd66ec14fa5050a953
2015-06-09 10:50:48 +01:00
Seigo Nonaka
e937216c33 Catch BadTokenException and continue in clearInsetofPreviousIme.
This is a follow up CL for Ib04967f39b2529251e4835c42e9f99dba2cf43f2.
As well explained in the I2c21573cf972145ab08e66604cdb9344139a3f31,
the race condition here cannot be avoided without an unacceptable
performance penalty.  For now, we follow the same way.

Bug: 21600287
Change-Id: I0ffdf8bf7e8a53cf8aba1339024b32da65d4f32d
2015-06-08 12:47:25 +09:00
Clara Bayarri
7938cdbf98 Separate the SelectionActionMode into Insertion and Selection.
When we got rid of the paste popup, we merged it into the Selection
ActionMode and moved all its invocations to the ActionMode. Some apps
actually want the paste popup without the Selection ActionMode, hence
separating them again allows them to cancel the one they want.

Bug: 21571422
Change-Id: I91bcd0d9c3e68d9c736698fe0bec010b4c9f5cf3
2015-06-04 20:46:19 +01:00
Yohei Yukawa
2977eb7b6c Clear the inset of previous IME when necessary.
In the following scenario, the system continues keeping the previous
IME's inset in the display until the new IME shows its window.
1. an IME shows its software keyboard with reporting non-empty inset.
2. the user switches to another IME, which does not show the software
   keyboard when it is selected (e.g., because the physical keyboard
   is connected.)

This CL tries to address above situation by introducing a new state
flag IMMS#mShouldClearInsetOfPreviousIme to clear the previous IME's
inset when necessary.

Bug: 15922840
Change-Id: Ib04967f39b2529251e4835c42e9f99dba2cf43f2
2015-05-28 22:52:49 +00:00
Seigo Nonaka
98d88028ae Notify IME visibility when showWindow is called.
To change the back icon, need to notify IME visibility to the
InputMethodManagerService when guest IME service calls showWindow().

IME can call showWindow() if it want to show software input, but it
doesn't send IME_VISIBLE state to the InputMethodManagerService,
hence the arrow icon is different from what we expect. This
typically happens when Latin IME shows Emoji panel by left-alt keys.

Bug: 20318050

Change-Id: I0ec2c71ad9bc3b7e9259d9180375d9062fc7e154
2015-04-24 13:17:03 -07:00
Adam Powell
a3f3a309cd am 66a51c70: am da1bc605: am 7a3c8c70: Merge "Fixed memory leak in ExtractEditLayout finish()"
* commit '66a51c7080f26219652f84ae8d10b1e4d63409af':
  Fixed memory leak in ExtractEditLayout finish()
2015-04-07 22:02:48 +00:00
Johan8 Persson2
567267015d Fixed memory leak in ExtractEditLayout finish()
When marking text and opening the edit text dialog
and then rotating the device would result in references
being kept to the edit text dialog and the memory would
never get released again.

Change-Id: I3e95083e4923844d2b496ea79174ef97e77f8686
2015-03-27 13:23:11 +01:00
Tor Norbye
7b9c912f53 Add @ResourceInt annotations on APIs
Change-Id: I119cc059c2f8bd98fd585fc84ac2b1b7d5892a08
2015-02-18 07:49:03 -08:00
Yohei Yukawa
32acf753e8 am 83c804be: Merge "Prevent duplicated registration of OnComputeInternalInsetsListener" automerge: efd9abb
* commit '83c804be9c1f33ff4bafbfd60218751a00c7d2b9':
  Prevent duplicated registration of OnComputeInternalInsetsListener
2015-02-14 15:17:17 +00:00
Seonggoo Kang
72745fffe8 Prevent duplicated registration of OnComputeInternalInsetsListener
OnComputeInternalInsetsListener is added when initViews is called,
and initViews is called by onCreate and onConfigurationChanged.
But it is removed only by onDestroy.
Therefore listeners are accumulated and it results performance issue.
So before adding, remove mInsetListener that was previously added.

Change-Id: I494d3f1875613d73d3f9b8e2af286b5800f03196
2014-12-24 14:05:17 +09:00
Alan Viverette
9752428dc1 Use CURRENT_OR_SELF when checking SPEAK_PASSWORD setting
Using CURRENT isn't always safe.

BUG: 18557273
Change-Id: I12e197ab25b8ffdc04c5e74836945177870698a2
2014-12-02 16:24:24 -08:00
Alan Viverette
b6e0cb97b7 Load SPEAK_PASSWORD from currently active user rather than self
Also fixes a typo in UserHandle's docs.

BUG: 18295054
Change-Id: I1f5384f84062b9ea7dcbebe1e5f64af331028d41
2014-11-25 16:08:03 -08:00
Yohei Yukawa
a277db28e9 Remove CursorAnchorInfoRequest and related stuff
This CL removes CursorAnchorInfoRequest and related stuff
in favor of InputConnection.requestUpdateCursorAnchorInfo,
which is more easy to understand. This CL also deprecates
InputMethodManager#updateCursor and related stuff.

Rationale:
1. The spec of #updateCursor says that it provides the cursor
   position in local coordinates, while the input method
   requires it in the screen coordinates.
2. #updateCursor has never been enabled in AOSP, because
   InputMethodManager#isWatchingCursor always returned false.
3. There has been no way to let
   InputMethodManager#isWatchingCursor return true.
4. In L, InputMethodManager#updateCursorAnchorInfo is
   introduced to address all the issues above.

Given that we no longer need to support #updateCursor,
CursorAnchorInfoRequest is overkill when we need to convey
just a couple of parameters.

BUG: 17185263
BUG: 17182367

Change-Id: I4a577bfd02b37b9e56c80b8b41bb25afa95dd8ef
2014-08-22 00:55:06 -07:00
Alan Viverette
e07b595519 Deprecate InputMethodService.enableHardwareAcceleration()
BUG: 16951553
Change-Id: I126ea823eb2eeabb29d30999dec9c9411b33b315
2014-08-14 20:06:02 +00:00
Yohei Yukawa
0023d0e0c4 Polish new IME API for L part 2: CursorAnchorInfo
This CL addresses feedbacks from internal customers for new
input method APIs that are mainly used for physical keyboard
support in L.

For performance reasons, #onUpdateCursorAnchorInfo is not called
back by default and each input method has to enable this
event notification explicitly whenever fine-grained character
locations are needed.

In L-preview, InputMethodSession#setCursorAnchorMonitorMode was
introduced for this purpose.  However, we got several feedbacks
to be addressed.
- The effect of #setCursorAnchorMonitorMode is not preserved
  during focus change.  IMEs need to call
  #setCursorAnchorMonitorMode every time when #onStartInput is
  called.  This is tricky and hard to understand.
- As #onUpdateCursorAnchorInfo is a new API, not all
  applications/text editors have supported it. Therefore IMEs
  can't always rely on it. However, there is no way to query
  if the attached target is supporting this new API or not.
  It would helpful for IME authors if we can provide a
  reliable way to query if the attached input target is
  supporting the new API or not.

In order to address these issues, the triggering method has
moved from InputMethodSession to InputConnection in this CL,
as an analogy of existing InputConnection#getExtractedText API,
which has provided similar functionality including optional
reactive event callbacks from the application to the IME.

BUG: 15812658
BUG: 16118603
Change-Id: I3c6b69bd9d79b199afe68d838f25effa6048e5cc
2014-07-11 21:13:17 +09:00
Dianne Hackborn
20d9474904 More work on voice interaction visuals.
There is now a special theme for voice interaction activities
to use, so they can be a panel that is better intergrated with
the rest of the voice interaction experience.  This is still
not completely working, I have some hacks in the demo app to
get it right; I'll fix that in a future change.

Also improve VoiceInteractor to be retained across activity
instances, for things like rotation.

And bump up the number of concurrent broadcasts that are allowed
on non-svelte devices, since they can handle more and this makes
the boot experience better when dispatching BOOT_COMPLETED.

Change-Id: Ie86b5fd09b928da20d645ec2200577dee3e6889d
2014-05-30 10:06:16 -07:00
Dianne Hackborn
e30e02f5d9 Add system layer for voice interaction services.
New window layer that voice interaction service windows
go in to.  Includes a new voice-specific content rectangle
that voice activities are placed in to.

Add specific animations for this layer, sliding down from
the top (though this can be customized by the voice interaction
service).

Also add the concept of activities running for voice interaction
services for purposes of adjusting the animation used for them,
again sliding from the top, but not (yet?) customizable by the
voice interaction service.

Change-Id: Ic9e0e8c843c2e2972d6abb4087dce0019326155d
2014-05-28 17:16:51 -07:00
Yohei Yukawa
c2ddd60236 Introduce new API for floating window support
This CL introduces a new API IMM#updateCursorAnchorInfo for
floating window support.

BUG: 14579622
Change-Id: I61dec2f8fa671ba891da1d4af08975750e3acb04
2014-05-09 19:17:15 +09:00
Alan Viverette
5effd7e89f Partial revert "Load device default theme mapping from resources"
This reverts commit e4ab72d54cf41d16819b72e94d9b0d0d51289647.

Change-Id: Id17170312c75993fc1f7859d52c7e050b2aeaf80
2014-05-05 12:26:03 -07:00
Dianne Hackborn
c03c9167c2 Further work on voice interaction services.
This makes VoiceInteractionSession a more first-class
concept.  Now the flow is that a VoiceInteractionService
calls startSession() when it wants to begin a session.
This will result in a new VoiceInteractionSession via the
VoiceInteractionSessionService containing it, and the
session at that point an decide what to do.  It can now
show UI, and it is what has access to the startVoiceActivity
API.

Change-Id: Ie2b85b3020ef1206d3f44b335b128d064e8f9935
2014-05-05 11:18:08 -07:00
Alan Viverette
0810b63739 Load device default theme mapping from resources
Also adds a few missing styles and reorganizes some XML files. Makes
stackViewStyle public since it's defined in DeviceDefault.

Change-Id: I8f6a0f93410948b38619594474d60dc40ece5917
2014-05-01 14:42:56 -07:00
Yohei Yukawa
c644ff6d4f Revise Javadoc for CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT
This is a follow-up CL for I3acf2317ae1d763d11 to improve the
Javadoc for CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT

BUG: 14323360
Change-Id: Ie8948eda3ce57da282bd82e8e9a44997f6d53245
2014-04-29 05:01:08 +09:00
Yohei Yukawa
4de04795f9 Return the cursor position in screen coordinates
From its beginning, InputMethodService#onUpdateCursor has
provided the cursor position in local coordinates in the attached
view. However, the local coordinates is not useful for IMEs
to render a floating UI near the cursor because the IME is not
able to know the origin of the attached view.

With this CL, CURSOR_ANCHOR_MONITOR_MODE_CURSOR_RECT also means
that the IME will receive the cursor position in screen
coordinates. Because this is a new constant in the next release,
conditionally changing the coordinates never causes
compatibility issues as long as its behavior is well documented.

BUG: 14323360
Change-Id: I3acf2317ae1d763d11dae5ef73c2a1348b377c71
2014-04-29 03:53:34 +09:00
Yohei Yukawa
b7b7907fb5 Allow IMEs to start/stop receiving onUpdateCursor callback
This CL introduces an API which allows IMEs to start/stop
receiving onUpdateCursor callback upon their request.

BUG: 13388665
Change-Id: I987326872def181dda5d9d701b762f088e0d9c39
2014-04-04 04:34:44 +09:00
Alan Viverette
6259933ec9 Switch framework Holo references to Quantum.Light
Change-Id: Ib545a143f1959b6104adbc9d594dd626851d90b3
2014-04-01 14:57:39 -07:00