Commit Graph

10236 Commits

Author SHA1 Message Date
Marcin Oczeretko
e0ef793d0a Merge changes If217a9a8,I35af3a9c
* changes:
  LooperStats - don't create entries for unsampled sessions
  Add work source uid collection to LooperStats
2018-09-20 19:43:07 +00:00
Marcin Oczeretko
a674bc9eaf LooperStats - don't create entries for unsampled sessions
This should reduce the size of the data, because we will
not track the very rare calls unless we are collecting
a detailed sample.

Test: Manual and UTs
Change-Id: If217a9a848935878a6efcdfac9df723c6ce54361
2018-09-20 10:52:18 +01:00
Marcin Oczeretko
ec7587283f Add work source uid collection to LooperStats
Add ThreadLocalWorkSourceUid and Message.workSourceUid
which will store the UID which caused, directly or
indirectly, the Message to be enqueued.

This was needed because using Binder.getCallingUid() does
not give us enough data since quite a few Binder services
call Binder.clearCallingIdentity() when processing the
call.

Test: UT and manual
Change-Id: I35af3a9ca5193477070990b41ff5d9c52f420069
2018-09-20 10:52:08 +01:00
Yohei Yukawa
a71bb25cff Let IMMS be responsible for IInputMethodClient lifecycle
This is the last step to remove the dependency on IInputMethodClient
from WindowManagerService.

With my previous CL [1], now WindowManagerService (WMS) depends on
IInputMethodClient just because it implements lifecycle management of
IInputMethodClient on behalf of InputMethodManagerService (IMMS).

This CL mechanically moves that responsibility from WMS to IMMS for
better separation of concerns.  It is a bit ironic that this CL is
partly undoing my previous CLs [2][3] that removed
IInputMethodManager.addClient() though.

This CL aims to preserve the current observable behavior (e.g. when
InputMethodManager instance is being created) as much as possible.
Most likely there would be no observable behavior difference when seen
from other components.

 [1]: I444077b1e4af4033f67ab72c181fac85b601e08a
      41f89c3bcc
 [2]: I453200fd5847e9a78876affb6a1caec221525e1d
      e24ed79edb
 [3]: Id91dd600120e4981aa1d9005ce644728968430c9
      fffc0e53c6

Fix: 115993358
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I7726c70613ea72d6e78fa5754e9fc840f0a40f11
2018-09-19 19:21:24 -07:00
Yuzhou Jia
35339498ef Merge "Make Changes to VoiceInteraction API for supporting System checking an assistant voice action availability on AAE." 2018-09-20 01:02:44 +00:00
TreeHugger Robot
b6ffc07e06 Merge "Remove the dependency on IInputMethodClient from IME focus check" 2018-09-20 00:19:35 +00:00
Yohei Yukawa
41f89c3bcc Remove the dependency on IInputMethodClient from IME focus check
This is a preparation to remove the dependency on IInputMethodClient
from WindowManagerService.

What inputMethodClientHasFocus(IInputMethodClient) is currently doing
is basically equivalent to comparing PID (and UID), because
InputMethodManager is a per-process instance and comparing two
IInputMethodClient Binder proxies is no more or less than comparing
PID (and UID pair).  We can just change its method signature to
achieve the same behavior by taking a PID/UID pair instead of taking
IInputMethodClient.

Note that we can later add display ID to this method to support
multi-display scenario.

This CL also renames inputMethodClientHasFocus() to
isInputMethodClientFocus() for better consistency with other methods.

There should be no observable behavior difference in this CL anyway.

Bug: 115993358
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I444077b1e4af4033f67ab72c181fac85b601e08a
2018-09-19 14:30:04 -07:00
jiayuzhou
21a353b701 Make Changes to VoiceInteraction API for supporting System checking
an assistant voice action availability on AAE.

Test: build and test on AAE.
Bug: 110587280

Change-Id: If37036e0dbe021fee9c95caf7e450330ca24ae32
2018-09-19 10:21:59 -07:00
TreeHugger Robot
bd5fed399f Merge "Let InputMethodPrivilegedOperationsRegistry deal with its singleton-ness" 2018-09-19 16:48:54 +00:00
Tony Huang
b3e5edd5ea Merge "Fix ExternalStorageProvider always throw exception when rename" 2018-09-19 02:56:00 +00:00
Yohei Yukawa
d746a7e893 Let InputMethodPrivilegedOperationsRegistry deal with its singleton-ness
This is a preparation to allow InputMethodManager to have per-display
instances rather than the current per-process singleton instance.

When I introduced InputMethodPrivilegedOperationsRegistry [1], there
was an assumption that InputMethodManager was a per-process global
singleton object.

Now that we are going to break up that global per-process instance
into multiple per-display instances, having multiple
InputMethodPrivilegedOperationsRegistry instances probably does not
make much sense, because it would likely to increases the risk of
compability issues in existing IMEs.  Although IME developers soon
really need to use the right Context to obtain the right instance of
InputMethodManager anyway, unnecessarily introducing compatibility
pitfalls that can be avoided in the Framework side is not my
intention.

With this CL, following 9 methods can continue to work no matter
whether InputMethodManager is a per-process singleton or not.
This is fine because those APIs had been mistakenly exposed in
InputMethodManager and already deprecated in favor of newly added ones
in InputMethodService.

 * InputMethodManager.hideSoftInputFromInputMethod
 * InputMethodManager.hideStatusIcon
 * InputMethodManager.setInputMethod
 * InputMethodManager.setInputMethodAndSubtype
 * InputMethodManager.shouldOfferSwitchingToNextInputMethod
 * InputMethodManager.showSoftInputFromInputMethod
 * InputMethodManager.showStatusIcon
 * InputMethodManager.switchToLastInputMethod
 * InputMethodManager.switchToNextInputMethod

 [1]: If762714b2003fa6477e1318110f63e13968c1d7e
      eec552e9e9

Bug: 115893206
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I4a61470f06ffac5f7a512536f8431489db0108f4
2018-09-18 18:55:02 -07:00
TreeHugger Robot
3427156b2c Merge "More robust read mechanism in KernelCpuProcReader" 2018-09-18 23:54:14 +00:00
Mike Ma
9dcf7e342f More robust read mechanism in KernelCpuProcReader
KernelCpuProcReader used FileChannel to dump bytes into a large enough
ByteBuffer. However, FileChannel#read stops as soon as there is nothing
left to read. Since the kernel may not deliver all parts of a proc file
simultaneously, previous read mechanism would possibly read only a
portion of the proc file. The impact is that KernelUidCpuFreqTimeReader
gets an incomplete UID list.
New mechanism uses a loop to turn non-blocking FileChannel#read into a
blocking operation. It does not return until hitting EOF. The reason
not to use Files#readAllBytes is that we want to reuse the byte[].

Bug: 111805985
Test: atest KernelCpuProcReaderTest
Test: compared KernelCpuProcReader#readBytes against Files#readAllBytes
      locally
Change-Id: If0d2b6742489632e22c8fec34c627851cda875f2
2018-09-18 22:14:26 +00:00
Bookatz
c77b02028e Merge "Unifying source of statsd BleScan calls and cleaning it up." am: 056a095dd3 am: 7ed0147613
am: 18852e3636

Change-Id: Ifcc5f22a921f6f4d50eb47a329aa2e3db61410ef
2018-09-17 14:59:41 -07:00
Bookatz
18852e3636 Merge "Unifying source of statsd BleScan calls and cleaning it up." am: 056a095dd3
am: 7ed0147613

Change-Id: Ied0f4683311276d2c643e882f57f8a21943aebe3
2018-09-17 11:45:14 -07:00
Bookatz
7ed0147613 Merge "Unifying source of statsd BleScan calls and cleaning it up."
am: 056a095dd3

Change-Id: I5ddc0d20c96439328c37d0a49f7fa6c4c90d6e14
2018-09-17 11:28:30 -07:00
Marcin Oczeretko
3e6494eb3e Prepare LooperStats to be collected as a Westworld gauge matric
- call LooperStats.reset() from StatsCompanionService
- add screen_interactive to the LooperStats atom
- temporarily set uid = 1000 to avoid statsd warnings that the uid is invalid

Bug: 113651685
Test: Manual and UTs
Change-Id: Iacf45fcb746c6bb9837456a2a0c74f5a073ff822
2018-09-17 17:25:55 +01:00
Rhed Jao
b11b75ac50 Merge "Spoken feedback when a11y shortcut dialog is shown" 2018-09-17 08:37:11 +00:00
TreeHugger Robot
6c054d118a Merge "Fix velocity reporting for negative values > -1" 2018-09-15 21:00:22 +00:00
TreeHugger Robot
134ffb0c25 Merge "Move 3 IMMS utility classes to services.jar" 2018-09-15 17:20:28 +00:00
TreeHugger Robot
a02f4332b3 Merge "Extract constructLocaleFromString()" 2018-09-15 16:58:05 +00:00
TreeHugger Robot
ef25beb18a Merge "Extract getSuitableLocalesForSpellChecker()" 2018-09-15 16:40:23 +00:00
TreeHugger Robot
abcfcbbbfe Merge "Move LazyIntToIntMap to services.jar" 2018-09-15 01:07:59 +00:00
Michael Dooley
c106550132 Merge "Revert "Adding getModelState API to sound trigger"" 2018-09-14 16:21:17 +00:00
Michael Dooley
81f71f1c27 Revert "Adding getModelState API to sound trigger"
This reverts commit 4f809fe73e.

Reason for revert: fix build breakage

Change-Id: I75a54189f96fc21f6cb12dd8a05e513b1bda027c
2018-09-14 16:09:18 +00:00
Mathew Inwood
db0657a4f4 Merge "Move some members to the "Q blacklist"." 2018-09-14 13:54:28 +00:00
Michael Dooley
a707ba1cb0 Merge "Adding getModelState API to sound trigger" 2018-09-14 12:32:09 +00:00
Mathew Inwood
8c854f86a4 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I719b5c94e5b1f4fa562dd5d655953422958ad37e
2018-09-14 13:18:34 +01:00
Bookatz
ae6738ed2a Unifying source of statsd BleScan calls and cleaning it up.
Bug: 80308558
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases
Change-Id: I0b4a0b56631b4354b73f0fafea2c0dc7dff248d1
2018-09-13 18:48:10 +00:00
TreeHugger Robot
7a21a3128d Merge "Support IME Window to show in secondary display." 2018-09-13 07:54:47 +00:00
lumark
90120a8b5b Support IME Window to show in secondary display.
1) Moving WMS.setInputMethodWindowLocked to DisplayContent,
   each display can have its own IME window.
2) Add getDisplayIdFromWindow in WindowManagerInternal,
   used for InputMethodManagerService to know which display
   for given IME window token.
3) Support add / remove IME window according displayId.
4) Modify WMS.inputMethodClientHasFocus to traverse all active display
   if inputMethodClient focused.
5) Add displayId parameter for IInputMethod.initializeInternal to
   update context display then client can addView to right display.

Note: 1) There should be zero behavior difference as long as the target
         app is running on the default display.
      2) The current implementation is not final and there are still
         chances that the current IME may not work well or even crash
	 depending on how the IME is implemented.

Bug: 111364446
Test: manual, use ActivityView & launch Messages in VirtualDisplay,
      tap search icon to see if soft input keyboard shown &
      app window size is adjusted by soft input.
Change-Id: I8da315936caebdc8b2c16cff4e24192c06743251
2018-09-13 12:52:40 +08:00
Yohei Yukawa
e6b6e0e785 Move 3 IMMS utility classes to services.jar
Short summary:

There is no need to have these 3 utility classes in frameworks.jar,
because these classes are used only from InputMethodManagerService
(IMMS) and its utility classes. We should move them to services.jar.

Long summary:

 * InputMethodSubtypeSwitchingController

This class was mistakenly placed in the current Java package since its
beginning [1].  This class is purely a state machine that is designed
to be used only from IMMS hence there has been no way for app
processes to use this class in a meaningful way.

 * LocaleUtils

This class was also mistakenly placed in the current Java package
since its beginning [2].  This class is purely a state machine that is
designed to be used only from IMMS hence there has been no way for app
processes to use this class in a meaningful way.

 * InputMethodUtils

The situation of InputMethodUtils is a bit different.  It was
introduced in the right place actually [3], because the original
purpose of this class was to share some utility methods between IMMS
and the Settings application.  For that purpose, having this class
under frameworks/base/core/java instead of frameworks/base/services/
totally made sense.

What was unfortunate is that we have kept adding more and more utility
methods into InputMethodUtils since then, even though most of methods
have been used only from IMMS.  To make things worse, more and more
random components started depending on this utility class.  When we
realized it, we were in the situation where we could not even easily
refactor methods in InputMethodUtils without updating a bunch of
call-sites across repositories, including multiple platform-specific
Settings app and SetupWizards.

This is basically why I decided to stop allowing Settings apps and
SetupWizard to use InputMethodUtils, and decided to let them depend on
SettingsLib [4] instead.  After many cleanup CLs [5], we have finally
achieved the state where InputMethodUtils is used only from the system
server process.

 * A special bonus

With my previous CL [6], we can even make these 3 utility classes
package-private, which guarantees that only IMMS and its utility
classes directly depends on these utility classes.

 * Risk

Now that this is purely a mechanical refactoring of an implementation
detail within frameworks/base, there should be no observable behavior
difference.

 [1]: I11ed9a767588f8080753cd9bce011dac7db579ad
      d7443c83ce
 [2]: I315cf3722a06e00bdbfac284c4949578da8fe78d
      102ff0726d
 [3]: I0bc9954f163a3ec38d08b9ba842a8a31176eb6a6
      8e303cc5dd
 [4]: frameworks/base/packages/SettingsLib
 [5]: CLs that have Bug 77730201 in their commit messages
 [6]: I023d8f2863601ee54f304988117d8ea750770f70
      603f4d00c6

Bug: 77730201
Bug: 114660660
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Test: atest FrameworksServicesTests:com.android.server.inputmethod
Change-Id: I37594096151d77adb6741a41d7985a4506f96ccb
2018-09-12 16:42:48 -07:00
Yohei Yukawa
835ab94bdb Extract constructLocaleFromString()
The main motivation of this refactoring is to move InputMethodUtils to
com.android.server.inputmethod as a package-private class.  With a lot
of cleanup CLs in Bug 77730201, the only remaining utility method that
is used by multiple Java package is this constructLocaleFromString()
method.

This is purely a mechanical refactoring.  There should be no
observable behavior difference.

Bug: 114660660
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Change-Id: Ic47b680ad9efde104015d34311f49e224d3fb56f
2018-09-12 16:23:26 -07:00
Lucas Dupin
a354763925 Merge "Pitch black SysUI theme" 2018-09-12 23:05:05 +00:00
Yohei Yukawa
3781ca8c64 Extract getSuitableLocalesForSpellChecker()
When I needed to introduced a new helper method for
TextServicesManagerService (TSMS) to fix Bug 22042994 [2] I was just
lazy and decided to put it into InputMethodUtils instead of creating a
new utility class for TSMS.

Now that InputMethodUtils is going to be moved to
com.android.server.inputmethod as a package-private utility class, it
is time to pay off my laziness.

With this CL, getSuitableLocalesForSpellChecker() will be extracted
out from InputMethodUtils to a new package-private utility class
com.android.server.textservices.

This is purely a mechanical refactoring.  There should be no
observable behavior difference.

 [1]: I094f1c33430f7904a1dac6167431d6df64a07212
      174843afb6

Bug: 77730201
Bug: 114660660
Bug: 115516399
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Test: atest FrameworksServicesTests:com.android.server.textservices
Change-Id: If6cd051aa0ae7780631d5bec5b7d01faac4a83a0
2018-09-12 15:36:03 -07:00
Yohei Yukawa
81e806a72a Move LazyIntToIntMap to services.jar
This class should have lived in services.jar.  When I introduced
LazyIntToIntMap [1] to re-enable cross-profile use of spell checker
APIs, I unnecessarily put this class in frameworks.jar despite the
fact that this utility class is used only in the system server
process.

This CL also makes this utility class package-private so that other
component will not accidentaly depend on it.

This is purely a mechanical refactoring.  There should be no
observable behavior difference.

 [1]: Ic046f832f203115106409a53418a5746eb6d4939
      3f8c568883

Bug: 115516399
Test: atest FrameworksServicesTests:com.android.server.textservices
Change-Id: I9390ba11687e1db66d02fe1cdfb9ed59adde3768
2018-09-12 15:33:25 -07:00
Chih-hung Hsieh
38158dd171 Merge "Use multiple patterns and emails in per-file syntax." am: d3f10fe89c am: 697a0b6634
am: 7a84739070

Change-Id: Ibb610fabef94dfe309275f9d1dcb29e5ddf8f270
2018-09-12 14:13:10 -07:00
TreeHugger Robot
3f2333b050 Merge "Revert "Prepare to make InputMethodUtils package-private"" 2018-09-12 20:42:45 +00:00
Chih-hung Hsieh
7a84739070 Merge "Use multiple patterns and emails in per-file syntax." am: d3f10fe89c
am: 697a0b6634

Change-Id: Ie36d24fa75121430db5ec9cfd73aec36efd0a706
2018-09-12 13:21:25 -07:00
Chih-hung Hsieh
697a0b6634 Merge "Use multiple patterns and emails in per-file syntax."
am: d3f10fe89c

Change-Id: If9c5cda9043bb21b256ab614133ad8a57c312517
2018-09-12 11:38:48 -07:00
Yohei Yukawa
24d8f6d0ff Revert "Prepare to make InputMethodUtils package-private"
This reverts commit 16703c4b47.

Reason for revert:
Just realized that this was not the best approach.

We could already make LocaleUtils package-private too before this CL.
So the right approach was moving these methods to new Java class(es)
instead of moving these methods to LocaleUtils.

Bug: 77730201
Bug: 114660660
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Change-Id: I29c87b9692f0f5e8255835579e2fb5270bc6c9c3
2018-09-12 17:26:55 +00:00
Tony Huang
7bf90408e3 Fix ExternalStorageProvider always throw exception when rename
ExternalStorageProvider always throw exception when renameDocument
because it will check file exist when getFileForDocId. However,
beforeVisibleFile is not exist after rename, it will throw
exception. Fix it by put getting beforeVisibleFile before rename.

Test: manual test rename in DocumentsUI
Test: atest RenameActualProviderUiTest
Fix: 113302685
Fix: 115304092
Change-Id: I45d60d2f940e3dbc2b121f7cd28acc3c2d085ec4
2018-09-12 16:04:15 +08:00
TreeHugger Robot
cdc36adcda Merge "Fix a JavaDoc link to inputMethodClientHasFocus()" 2018-09-12 01:37:17 +00:00
Lucas Dupin
d26faccd0c Pitch black SysUI theme
Test: visual
Bug: 110758454
Change-Id: Id673133763e5624f380facf008ecc4c78092fe13
2018-09-11 15:24:22 -07:00
Yohei Yukawa
603f4d00c6 Move InputMethodManagerService to com.android.server.inputmethod
This CL moves InputMethodManagerService (IMMS)
  from com.android.server
    to com.android.server.inputmethod
so that we can mechanically factor out inner classes from IMMS to
separate package private classes.

This is purely a mechanical refactoring of an implementation detail.
There should be no observable behavior difference.

Fix: 114660660
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Change-Id: I023d8f2863601ee54f304988117d8ea750770f70
2018-09-11 15:04:58 -07:00
Yohei Yukawa
e302d2ea28 Fix a JavaDoc link to inputMethodClientHasFocus()
I forgot to update this JavaDoc in my recent CL [1] that moved
inputMethodClientHasFocus() from WindowManagerService to
WindowManagerInternal.

 [1]: I20c618174d8279a9a57f458fb908235f452b2281
      cf93f9a53f

Bug: 112722651
Test: compile
Change-Id: I46cc9dd7479cc178770098a7bb6f0785598db3cf
2018-09-11 14:23:31 -07:00
TreeHugger Robot
5789fa6b73 Merge "Prepare to make InputMethodUtils package-private" 2018-09-11 21:19:48 +00:00
TreeHugger Robot
48c882b485 Merge "Move notifyUserAction() to IInputMethodPrivilegedOperations" 2018-09-11 21:11:41 +00:00
Sudheer Shanka
61585a8094 Merge "Add javadoc for package-name arg passed during the process start." 2018-09-11 19:53:06 +00:00
Yohei Yukawa
c07fd4c284 Move notifyUserAction() to IInputMethodPrivilegedOperations
This CL re-implements the way to propagate user action on an IME to
InputMethodManagerService (IMMS) so that we can dynamically update IME
Subtype rotation list discussed as requested in Bug 7043015.

It turns out that my previous CLs [1][2][3][4] are unnecessarily
complex because I tried to monitor user behavior in the IME client
process rather than in the IME process.  In the end, I ended up
introducing a sequence number protocol for the sake of performance
with a ton of complexity.

This could have been implemented in a much safer and simpler way by
sending user action signals from the IME process to IMMS, because

 A. IME already knows when it switches to a new subtype. IME needs to
    send a signal only once per subtype change.  There is no need to
    use sequence counter.
 B. Malicious IME client is unable to disturb IME rotation list by
    sending a fake signal because the IPC endpoint is no longer exposed
    to IME client processes.

In case there remain some applitations that still call this hidden API
via reflection without gracefully handling exceptions, this CL keeps
InputMethodManager.notifyUserAction() as a stub method so as not to
break such applications.

 [1]: I11ed9a767588f8080753cd9bce011dac7db579ad
      d7443c83ce
 [2]: I7f3e13a7226ef0dceee82b67e8a0d8536f7e9807
      2a6a8d2fbb063c84e388c185402c4ca788618c72
 [3]: I19ad8542659bc092b92ee13eb9f1d68ddd4b815a
      b56c6c721fc01fba8e36632d8e28f5123831abc5
 [4]: I03fa436df0a5e348b3f93170aab3a8ac5a7e1677
      c21ccc151631663d71230a3c1c756d94b575ab9e

Bug: 113177698
Fix: 114159783
Test: Manually verified as follows
  1. Build and flush aosp_taimen-userdebug
  2. make -j SoftKeyboard
  3. adb install -r $OUT/system/app/SoftKeyboard/SoftKeyboard.apk
  4. adb shell ime enable com.example.android.softkeyboard/.SoftKeyboard
  5. Open AOSP Keyboard settings
  6. Enable "English (US)", "French", and "German"
  7. Open SoftKeyboard settings
  8. Enable "English (United States)", "English (GB)"
  9. Open the Dialer app and tap the top edit field.
 10. Make sure that the IME layout rotation order when tapping the
     globe key will be updated only when you tap the keyboard to enter
     some character.
 11. Also confirm it with "adb shell dumpsys input_method" by checking
     "mSwitchingController:" section there.
Change-Id: Icc1f9c7f530f0144ecfd460e86114e109ae0044e
2018-09-11 11:37:13 -07:00