Commit Graph

1871 Commits (810578896e8e86dcb0f3bd685c8c46e716cb1cdd)

Author SHA1 Message Date
Ming-Shin Lu 6c752d8eca Using IME context to inflate layout from S_V2
With CL[1],[2] to migrate InputMethodService as the subclass of the new
introduced class WindowProviderService in S_V2, IME context resources
can be managed by associating the window container of IME window when
its display/window configuration changed.

So we can get rid of createDisplayContext logic from S_V2 with gated
by SDK version and refining the method of get IME context with
documentation to make it clear.

[1]: Ie565e30ed5dd3f2cfe27355a6dded76dc3adc14b
[2]: I64a1614f32d097785915f6105b1813a929e0fe32

Bug: 213118079
Bug: 133825283
Test: manual with below steps
 1) adb install -r EditTextVariations.apk
 2) tapas LatinIME
 3) make
 4) adb install -r out/target/product/generic/system/app/LatinIME/\
        LatinIME.apk
 5) adb shell ime enable com.android.inputmethod.latin/.LatinIME
 6) adb shell ime set com.android.inputmethod.latin/.LatinIME
 5) Enable screen auto-rotation
 7) Launch EditTextVariations from launcher's shortcut
 8) Tap the first EditText field to show IME
 9) Rotate the device to the landscape mode
 10) Expect the IME should not be shrunk

Change-Id: If2cc1c5bdb257a9c0af653fa7157cf781a90bf1d
2022-01-12 11:50:28 +08:00
Ming-Shin Lu 6ae09365a5 Fix Keyboard Theme update when device orientation changed
As CL[1] introduces diplayContext to address
IME service context's Resources / DisplayMetrics update when
switching IME window to another display after onConfigurationChange.

In LatinIME#onInitializeInterface, we only update keyboard theme context
and displayContent when the displayId is changed, but overlooked even
the displayId is the same, the display context's resource configuration
might changed like the device orientation changd.

It leads getDefaultKeyboardHeight will get wrong config_max_keyboard_height
fraction value when rotating to landcape because the context resources
didn't get updated.

Add a check to update keyboard theme context when the current display
configuation is changed accordingly.

[1]: I0ed6a079af1ed90c75fee1d36d5ce3ef3c41f8ed

Fix: 186507147
Test: manual as issue steps
    1) Turn on auto-rotate
    2) Open Settings
    3) Rotating the device to landscape mode
    4) Tap “Search settings", verify if the soft-keyboard shown and the
       size is expected.
Change-Id: I288a31baf04fa2e63d6b4a14ad81b401cb36ece5
Merged-In: I288a31baf04fa2e63d6b4a14ad81b401cb36ece5
2021-06-18 02:16:19 +00:00
lumark 4d464ec07d Create display context when switching IME to new display for AOSP IME
To address IME service context's Resources / DisplayMetrics update
when switching IME window to another display after onConfigurationChange.

We use Context#createDisplayContext to create display specific context when
display changed, to ensure soft keyboard can re-layout with correct resources.

Bug: 126930163
Test: manual with AOSP IME as below steps:
     1) Settings > Developer options > enable "Simulated Display" & "Force desktop mode".
     2) Reboot device
     3) Launch app (i.e. Contacts) with bluetooth or usb mouse in Simulated display.
     4) Tap EditText on app to see see if IME window layout correctly on simulated display.
     5) Launch app (i.e Files) on primary display.
     6) Tap EditText on app to see if IME window layout correctly on primary display.

Change-Id: I0ed6a079af1ed90c75fee1d36d5ce3ef3c41f8ed
2019-07-09 21:08:19 +08:00
lumark b1dec95c37 Merge "Remove extend touchable region for AOSP keyboard"
am: ff1db79a18

Change-Id: Ic162b5e20213a3f1b2aeaf77250bf1d7edc198c5
2019-07-05 07:45:50 -07:00
lumark b4360e65ca Remove extend touchable region for AOSP keyboard
Remove EXTENDED_TOUCHABLE_REGION_HEIGHT from LatinIME#onComputeInsets
to prevent keyboard touch region covered navigation bar
when in split-window mode with display density < 240 case.

Fix: 134893742
Test: manual as below steps:
1) Set window density as 240 with "adb shell wm density 240"
2) Launch a app (i.e. Messages) from recents activity, set as split-screen mode.
3) Tap Search bar to show IME keyboard.
4) Press home / back / recents key if it works, expect it works.

Change-Id: I596b7276041fecc50d2bc095c7e51664f632368d
2019-07-05 03:30:10 +00:00
Yohei Yukawa d762841494 Launch AOSP Keyboard Settings on the same display
This CL demonstrates how an IME can show an Activity on the display
where the IME is shown.  The key points are:

 * The current display ID can be obtained as follows.

    final int curentDisplayId = inputMethodService
            .getSystemService(WindowManager.class)
            .getDefaultDisplay()
            .getDisplayId();

 * When launching an Activity, specify the target display ID as
   follows.

    inputMethodService.startActivity(intent, ActivityOptions
            .makeBasic()
            .setLaunchDisplayId(curentDisplayId)
            .toBundle());

Fix: 131718879
Test: Manually verified as follows.
  1. Build aosp_blueline-userdebug and flash it.
  2. adb shell settings put global force_desktop_mode_on_external_displays 1
  3. adb shell settings put global overlay_display_devices 1920x1080/320
  4. adb reboot
  5. With a mouse, launch any application that has input field
     in the secondary display.
  6. Click that input field to bring up AOSP Keyboard.
  7. Long click the comma key then select the gear icon.
  8. Select "Android Keyboard Settings (AOSP)"
  9. Make sure that the AOSP Keyboard Settings is launched in
     the secondary display, not in the default display.
 10. Go back to the step 7.
 11. Select "Languages"
 12. Subtype Enabler for AOSP Keyboard is shown in the secondary
     display, not in the default display.
Change-Id: I9f89f371c38d9a7b5a06d018d4b41aa09815ea24
2019-05-04 09:52:07 -07:00
Yohei Yukawa fdfc55d3db Introduce a custom intent action to close software keyboard
This CL introduces a custom intent action for apps to ask AOSP Keyboard to
close its software keyboard with guarding it with a signature-protected
permission.

Any app that is signed with the same signature as AOSP Keyboard can have
the following line in AndroidManifest.xml

  <uses-permission
          android:name="com.android.inputmethod.latin.HIDE_SOFT_INPUT"/>

to request AOSP Keyboard to close its software keyboard as follows.

  sendBroadcast(new Intent("com.android.inputmethod.latin.HIDE_SOFT_INPUT")
          .setPackage("com.android.inputmethod.latin"));

Test: Manually verified with a test app.
Fixes: 65270710
Change-Id: I4fd2e3a7336ec66c70582a2f274a200cbf035a7f
2017-09-01 00:22:21 -07:00
Keisuke Kuroyanagi 48adccf349 Start full screen mode on first tap when HW keyborad is connected.
LatinIME checks hardware keyboard presence and software keyboard
visibility to decide whether to start full screen mode.
This doesn't work well with the recent update on "Show input method"
(Bug: 22517687, Id4d332e3909590c68345e).

On the first tap, software keyboard is not shown and hardware keyboard
is connected; so full screen mode is not started. However,
onEvaluateInputViewShown may return true ant software keyboard may be
brought up.
In this care, on the second tap, software keyboard is visible so full
screen mode will be started regardless of hardware keyboard presence.

This CL checks onEvaluateInputViewShown to decide whether to start
full screen mode.

Bug: 27234709
Change-Id: I587262cc36e5fccc59620b4bd2d2c3c05c72232f
2016-03-15 18:42:46 +09:00
Yohei Yukawa 60b59042d1 Fix runtime crash on KitKat and prior.
This is a follow up CL to the previous CL [1], in which we started
calling Window#setNavigationBarColor(int) when the window visibility is
changed.

One thing we missed is that calling Window#setNavigationBarColor(int) on
KitKant or prior devices would result in a runtime crash.  Hence with
this CL we do not call that method unless the OS version is N or leter,
because specifying Color.TRANSPARENT would make sense on N+ devices.

  [1]: I14d9490e00caa852035a05830e76114cbe6af8f2
       6c04339c5a

Bug: 22564251
Bug: 27302540
Change-Id: Ib7299dd8c3dad4271f8fac453e690c83bda4a954
2016-02-22 20:02:27 -08:00
Yohei Yukawa 809c93214b Experimental automatic language switching support.
With this CL, LatinIME switches the current subtype from its enabled
subtypes based on the first locale in EditorInfo#hintLocales.

This functionality is still experimental, and will be triggered only
when EditorInfo#hintLocales is specified by the application.

Bug: 22859862
Change-Id: Ibd0559b370d8aa0d50d1bada8ecfdac0ed8db898
2016-01-22 02:24:28 -08:00
David Riley fdb2cf4950 Merge remote-tracking branch 'goog/mnc-dr-ryu-dev' 2015-12-21 12:37:57 -08:00
Seigo Nonaka 6c04339c5a Change NavigationBar invisible if the input view is not shown.
The opaque navigation bar guard view does not make much sense when the
IME does not show software keyboard at all.  LatinIME does not show
any UI when the hardware keyboard is connected.

With Iea77915ecc55eedaf19899e72c44f704ba9d852c, input method can change
the navigation bar visibility.  This CL changes navigation bar invisible
when the hardware keyboard is connected.

Bug:22564251
Change-Id: I14d9490e00caa852035a05830e76114cbe6af8f2
2015-12-08 19:36:30 -08:00
Dmitry Torokhov 9a438a325b Fix AltR+1 -> ESC shortcuts bringing on-screen keyboard
Change the way we decide whether we want to show on-screen keyboard by
not only paying attention to modifiers, but also keeping track whether
the key sequence started in the right state.

We are still misfiring if user presses a non-modifier key and then our
modifier hot-key, but such sequence is unlikely. Given the fact that we
do not want to store too much state I believe this deficiency is
acceptable.

Bug: 25087681
Bug: 24142161

Change-Id: I1a6b5e8e903c27a87134a6c9a7cd474a0607d5c8
(cherry picked from commit 7c513455918a52bd28c1c8181cb2880db0973b4b)
2015-11-03 17:36:15 +00:00
Dan Zivkovic 1fdb8f3156 Define shortcuts for toggling IME layouts.
Out of the box, we want Alt-Left to toggle Emojis, while Alt-Right
toggles the shifted symbols layout.

Bug: 23954008
Bug: 24369173

Change-Id: I93dd66fb469e5d0a831359ff3a786fe68e1d73ea
(cherry picked from commit 411841b374aa04e333ea5a438dfd539f49ec589a)
2015-10-15 12:47:32 -07:00
Mohammadinamul Sheik 604158669b [LatinIME] Support MNC permissions.
This build has been compiled against API 23

This build is approved to go out with the M OTA, but may NOT be released
to the public until the Play Store has enabled API level 23 apps

Version: 4.1.2300x.build_id

1. Replaces the personalization is on information with the suggest
   contacts.
2. Enables "Use Contacts" only if the app has permission to read
   contacts.
3. Disables the contacts dictionary in the Facilitator.
4. Do not register/read the contacts in the contact observer.

Bug: 22236416
Change-Id: I9674e13d0d0f4a2014c5024fde0178de684c07e7
2015-07-15 22:51:53 +00:00
Dan Zivkovic 9bad1ac33f Look up thresholds during decoder reset.
Bug 20701628.

Change-Id: I4de89587776a0859aeda5d2ed76ab1eb4f918458
2015-05-04 14:48:28 -07:00
Dan Zivkovic fe716f0f73 Resolve some InputLogic todo comments.
Change-Id: Ic3d7d11ad90cc09edf62f48aa5362e71d692f7dd
2015-03-20 10:49:15 -07:00
Dan Zivkovic 755b3d882f Notify the facilitator on IME start/finish.
Allows the facilitator to flush language models without a recurring task.

Bug 19773937.

Change-Id: I01a3c10da26f9df38fee05df33387eb082e2ff33
2015-03-20 09:03:48 -07:00
David Faden 6e86632311 Pass DictionaryFacilitator to GestureConsumer#onImeSuggestionsProcessed.
Bug: 19712589
Change-Id: I81f9bf09b37487450780d85a1e4f752a9ba49370
2015-03-19 18:23:35 -07:00
Chieu Nguyen 8ec36026c9 Disable message if personalization is disabled.
Bug: 19087415.
Change-Id: I3974f1b676aa4a9bb04ab7f609b6daf1860c64f1
2015-03-18 15:30:22 -07:00
Dan Zivkovic 5455179b54 Revert "Next-word suggestion bit in keyboard settings."
This reverts commit 1ae16dc3db.

Bug 19596067.

Change-Id: Ie7286acbb70b215d7bd08e271bcf14526b68576f
2015-03-16 11:23:22 -07:00
Mohammadinamul Sheik 93d2ab3857 Add StatsUtils.onSettingsActivity to collect the settings page stats.
Bug:19214944
Change-Id: I113f47c49d638790d770fe2781afe7cd1565619d
2015-03-13 16:12:14 -07:00
Dan Zivkovic 107fb4c476 Remove ALS from LatinIME.
This fixes unit tests and brings us closer to a green build.

Change-Id: Iffcc392eda4a7671a238b79cc7367320ca648725
2015-03-11 17:29:12 -07:00
Dan Zivkovic 9a289da4e6 Remove deprecated distractor filtering methods.
Change-Id: I10ccf75d9c00d66b4e85de6c3c019242f2e90b0e
2015-03-11 14:39:48 -07:00
Dan Zivkovic bdd6c995ce Delete user history files.
Bug 19669016.

Change-Id: I8069fe561347851bf3c27423dbd8ba99d38c049e
2015-03-11 11:46:15 -07:00
Dan Zivkovic edaa83bb32 Log from LatinIME.
When the DEBUG setting is on, log from this critical class.
This will make it easier to diagnose issues.

Bug 19632709.

Change-Id: I5e14b3705f50cd021ad3d64af106ad28dc8b9321
2015-03-06 14:42:57 -08:00
Dan Zivkovic 1ae16dc3db Next-word suggestion bit in keyboard settings.
This feature works in supported languages.
We don't need a user setting.

Bug 19596067.

Change-Id: Icdded772745f9816da47f8a5e3b87b733083b121
2015-03-04 15:02:53 -08:00
Chieu Nguyen c809dc26a1 Add DictionaryFacilitator dump().
Change-Id: I8b75aded3fc2b9b33128b6ba5a3e8d943dfca352
2015-03-03 14:36:47 -08:00
Chieu Nguyen 0103d75aaf Move dictionary facilitator handling.
Change-Id: Ibd42982996a36ac52b4c916035491b835f8d14f9
2015-03-02 15:24:51 -08:00
Dan Zivkovic edd94a449e Ignore the Emoji key when not connected.
When the LatinIME does not have an active InputConnection, it will not try
to toggle the Emoji keyboard.

Bug 19513415.

Change-Id: I31f928cd7db1cddd771c548cd3dc42f8af64d0e2
2015-02-26 11:10:37 -08:00
Jatin Matani 48b071249c Merge "Share decoders among latinime components." 2015-02-26 17:54:26 +00:00
Dan Zivkovic 7d7f082075 Stop waking up to decay dynamic dictionaries.
Bug 19516048.

Change-Id: Ibc27a792b4fa80fa8c6af4721c47a617526e9584
2015-02-25 20:13:59 -08:00
Jatin Matani b684d2d2e4 Share decoders among latinime components.
Change-Id: I6c8d3cf10e05e606308cea42d1e935a415ada9f8
2015-02-25 17:48:30 -08:00
Mario Tanev 487e038ff3 Use Keyboard in several interfaces.
Simplify interfaces by passing Keyboard instead of
KeyboardLayout and ProximityInfo directly.  Also require
the Keyboard passed be non-null and change the SpellChecker
to bail out if there is no keyboard for the locale.

Change-Id: I960f15ff60171f55d3e0a96fd6469b7dc3a045e2
2015-02-25 17:20:00 -08:00
Chieu Nguyen 53b4bfdba0 Merge "Add StatsUtils method for handling subtype change." 2015-02-23 19:11:15 +00:00
Dan Zivkovic 40b754565c Rename in preparation of caching an instance.
Change-Id: I112c957e20d4573daaa71aa218b575037585385c
2015-02-19 15:41:58 -08:00
Chieu Nguyen 40833d2dd7 Add StatsUtils method for handling subtype change.
Change-Id: I0f334ab5e6f5aa41ad780641276dc3d2aa232f48
2015-02-18 16:00:59 -08:00
Dan Zivkovic 12d80ebead Remove shortcut support from LatinIME.
Note this change does not affect the native decoder interface.

Change-Id: I73b7dc008a5acaf75a31a36a2d332b5afabd82d0
2015-02-11 13:02:41 -08:00
Dan Zivkovic 644a709a5f Remove distracter filter from client.
Bug 19296201.

Change-Id: Ic834e5956347cd86a96bd14024c42ad8ee258659
2015-02-09 11:52:12 -08:00
Dan Zivkovic d6a8adcb04 Cleanup in preparation of distracter change.
Bug 19296201.

Change-Id: If016da2b7f4b3ecb9afd6d7aed9d19fbd4938758
2015-02-06 14:25:37 -08:00
Mohammadinamul Sheik b00c054125 AOSP changes to use KeyboardLayout to support the new DictionaryFacilitator
Change-Id: Ie0c9ce805d9ad009fc9bbaac37b715aff90cd844
2015-02-04 12:50:31 -08:00
Dan Zivkovic 23574d1231 LatinIME portion of "green plus" feature.
Removes the feature that adds strings to the user dictionary,
aka the "green highlight with a plus sign".

Bug 19237189.

Change-Id: I2387129a3add2d69d625f2ff16ed8cab3f10a735
2015-02-03 15:12:01 -08:00
Jatin Matani 15acbdc905 Nuke Amanatto
Change-Id: Ieff2cd37f869dca69abf53ac32a576c2e45cc1e3
2015-02-02 17:10:38 -08:00
Mario Tanev ab6f3b36d0 Change DictionaryFacilitator.java to an interface, create its
implementation DictionaryFacilitatorImpl.java and add a java-overridable
factory DictionaryFacilitatorProvider.java used to create a
DictionaryFacilitator.

Change-Id: Id4a58ae31feaa4d12a048a772c8d76ff82fdee45
2015-01-27 21:38:32 +00:00
Jatin Matani 3e35b8712c [3]Ping dictionary stats:Pass DictionaryFacilitator
Pass dictionaryFacilitator to StatsUtilsManager from
LatinIME
Bug:16553957

Change-Id: I912a0b447e5684909ff67e3653a4bd8649cd03c5
2014-12-18 13:42:41 -08:00
Jatin Matani 20469a8779 Merge "[2]Pass context to StatsUtilsManager for alarms." 2014-12-18 21:35:45 +00:00
Jatin Matani 2b69244555 [2]Pass context to StatsUtilsManager for alarms.
Change corresponding to ag/605384

Bug:16553957

Change-Id: I77024957b9497c45296bbbb24ca972b26348a8c3
2014-12-17 12:16:02 -08:00
Tadashi G. Takaoka 4077a7e52f Merge "Remove SubtypeSwitcher" 2014-12-17 06:39:07 +00:00
Jatin Matani bc4ae6bdc0 Passing account info to dictionaryFacilitator
Attempt to use dictionary facilitor without invoking
preference manager. Instead use account from settings only when
things are being reset/changed. Discussion forked from ag/591663

Overall, the idea here is to maintain an account information
inside dictionary groups. Reset the dictionary groups if
account changes (the way we do for locale). Since only user
history dictionary is currently affected, the check to reset user
history dictionary also includes the check to verify the account.
For other things remain the same.

SettingsValues holds the current account (and is updated if prefs change
due to change in account settings). The updated settings are then
propagated to dictionary facilitator via LatinIME#loadSettings.

Bug:18104749,18469539
Change-Id: I553e776e7ea125d0fb7a1fe70a4c7eb0b2277fb8
2014-12-16 15:56:00 -08:00
Tadashi G. Takaoka 31a10e226d Remove SubtypeSwitcher
Change-Id: Ic4def69a9f742f13c98bc3e518c406658b52797d
2014-12-12 13:45:46 +09:00