Commit Graph

212 Commits

Author SHA1 Message Date
Elliot Waite
54de77470d Fix @links in reference docs.
Change-Id: I40cea46efd80c448640ff69753698fe8404da40b
2017-01-25 17:00:55 -08: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
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
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
Yohei Yukawa
1064d35307 Merge "Tell IMS about missing InputConnection methods." into nyc-dev 2016-03-19 00:36:22 +00:00
Yohei Yukawa
19a80a1e80 Tell IMS about missing InputConnection methods.
Summary:
  This CL introduces a unified mechanism to deal with the situation
  where the application directly implements InputConnection but some of
  methods are not implemented.  Note that there should be zero overhead
  when the application extends BaseInputConnection or
  InputConnectionWrapper.

Background:
  When ever we add a new method to InputConnection, there has been a
  risk that existing applications that directly implement
  InputConnection can get java.lang.AbstractMethodError exception at
  runtime, because older SDKs do not require the application developer
  to implement the methods that are newly added in later SDKs.  Because
  of this we strongly discouraged developers to directly implement
  InputConnection interface, and encouraged them to subclass
  BaseInputConnection or InputConnectionWrapper instead.  That said, as
  requested in Bug 26945674, there is a certain demand to be able to
  implement InputConnection without depending on BaseInputConnection.
  The goal of this CL is to provide a reliable and sustainable solution
  to above missing method scenario in InputConnection.

  One of the reasons why dealing with missing InputConnection methods is
  so difficult is that what InputMethodService receives to communicate
  with the target application is actually a proxy class
    com.android.internal.view.InputConnectionWrapper
  that runs in the IME process and immediately returns true for most of
  methods in InputConnection such as #commitText() and
  #finishComposingText().  Because of this asynchronous nature, it is
  too late to change the actual return value that the IME receives when
  the application receives those one-way asynchronous IPC calls.

Solution:
  To handle those cases, this CL checks the availability of
  InputConnection methods that did not exist in the initial release
  before the target application calls startInput(), and let the
  application to send its availability bits to IMMS so that
  InputConnectionWrapper running in the IME process can be initialized
  with such availability bits.  Note that we do know that
  BaseInputConnection and its subclasses support all the InputConnection
  methods, hence for most of applications we can just assume that all
  the methods are available without reflection.

  With such availability bits, InputConnectionWrapper is now able to
  gracefully return failure code to the IME because the availability of
  those methods is immutable, except for a tricky case where the
  application relies on a proxy object that dynamically changes the
  dispatch target.

  Here is the list of APIs that we start checking the availability in
  this CL.
    [API Level 9+]
     - InputConnection#getSelectedText(int)
     - InputConnection#setComposingRegion(int, int)
    [API Level 11+]
     - InputConnection#commitCorrection(CorrectionInfo)
    [API Level 21+]
     - InputConnection#requestCursorUpdates(int)}
    [API Level 24+]
     - InputConnection#deleteSurroundingTextInCodePoints(int, int)
     - InputConnection#getHandler()

Ideas alternatively considered: Default methods in InputConnection
  We once considered having default methods in InputConnection but
  abandoned this idea because it does not directly solve the problem
  about how to tell the that the API does not take effect.
  Also having default methods would make it difficult for application
  developers to be aware of newly added methods in InputConnection.

Bug: 27407234
Bug: 27642734
Bug: 27650039
Change-Id: I3c58fadd924fad72cb984f0c23d3099fd0295c64
2016-03-15 06:43:39 +00:00
Keisuke Kuroyanagi
755c0095a1 Fix: onExtractedDeleteText deletes unintended region.
InputMethodService#onExtractedDeleteText doesn't reset composing
region and InputConnection#deleteSurroundingText deletes text around
the composing region. As a result, #onExtractedDeleteText can delete
unintended region of the text.
This happens when a user perform Drag&Drop or tap "Delete" in
SuggestionsPopup in full screen extracted mode.

Bug: 22440907
Bug: 27536702
Change-Id: I875f2919896f8ff453a77fb4a1b642ad78079b78
2016-03-14 19:09:20 +09:00
Yohei Yukawa
cf8403bc36 Suppress NPE in IMS#onEvaluateInputViewShown().
This is a follow up CL for the previous commit [1], which may have
triggered an unknown bug in either Android Framework or LatinIME.

  [1]: Id4d332e3909590c68345e10e1f2e18650efb2eb7
       7b739a802c

InputMethodService#mSettingsObserver is initialized in #onCreate() and
cleard with null in #onDestroy().  Hence hitting NPE against it implies
that InputMethodService#onEvaluateInputViewShown() can be called before
InputMethodService#onCreate() or after InputMethodService#onDestroy().
Both possibilities are equaly problematic.  Note that this might be a
long-standing issue that just became obvious because of [1].

This CL does not attempt to fix the root cause but just tries to
suppresses the NPE to unblock QA tasks.  A proper fix should be made in
subsequent CLs.

Bug: 22517687
Bug: 26511607
Change-Id: I6bc87c3d18b560fe2253fb9f05557b95b04d0cf0
2016-01-12 12:17:42 -08:00
Yohei Yukawa
7b739a802c Stop lying about hardware keyboard presence.
Here is a brief history of "Use Physical Keyboard", or "Show input
method", or SHOW_IME_WITH_HARD_KEYBOARD.

In Honeycomb, we introduced a mechanism which allows users to temporary
disconnect the physical keyboard connection from a UI [1].  That state
was temporary and non-persistent, but it was implemented to have
system-wide effect.  Whenever the user turned on that temporarily
disconnected state, not only IMEs but also other processes would be
notified that Configuration#keyboard was changed to KEYBOARD_NOKEYS.
The UI to do that was available only in tablet UI at that point and
nothing changed in phones.

In JellyBean, we decided to port that UI to phone, and the "Use Physical
Keyboard" toggle switch found its new home on the IME switcher
dialog [2].

In Lollipop, we revised the wording for the toggle switch on the IME
switcher dialog.  Now it's labeled as "Show input method" [3].

In Lollipop, we also decided to make the settings of "Show input method"
to be persistent as @hide entry in the secure settings [4].

  [1] 2992ea782f
      I136087ca4f726d0068d5983d7d3686787ba60c55
  [2] cb598b11ea
      (Ica768083f95c33dc1e494a28ba7d8b6eb989b0ef)
  [3] be11f3a5cea67c68a08c8da9ce85b3418501060a
      (I9c8a7eb98b5277f1d09cc19fa7402e9b4cf51d92)
  [4] b64e56aad3ffb267aec44308f57641a4c91caa83
      (I2237ded850a0d4ab43ca441d0b7df13e0958e630)

Now, we have hard time making everyone happy.  Having an easy way to
bring software keyboard back is probably still a valid use case, but
after several wording changes it is no longer obvious why
onConfigurationChanged() event is sent to all the processes as a
consequence of tapping that toggle.

In order to address above confusions, this CL removes the concept of
"temporarily disconnected physical keyboard" but tries to implement
"Show input method" functionality in InputMethodManagerService and
InputMethodService to keep the affordance that has been offered in the
IME switcher dialog.  As long as the IME overrides
InputMethodService#onEvaluateInputViewShown() as follows, the behavior
of "Show input method" toggle remains the same except for processes
including IMEs no longer receive onConfigurationChanged() event with
faked Configuration#keyboard value.

  @Override
  public boolean onEvaluateInputViewShown() {
      // If the default implementation returns true, recommend honoring
      // it.
      if (super.onEvaluateInputViewShown()) {
          return true;
      }

      // Implement the logic that is specific to your IME here.
      return myOnEvaluateInputViewShown();
  }

Bug: 22517687
Change-Id: Id4d332e3909590c68345e10e1f2e18650efb2eb7
2015-12-21 13:30:44 -08:00
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