1534 Commits

Author SHA1 Message Date
Yohei Yukawa
868d19b93b Use BCP-47 LanguageTag in IME/Spell-Checker.
The primary goal of this CL is to make it clear that BCP-47 is the
expected format to annotate locale information for each
{InputMethod, SpellCkecker}Subtype.  In order to avoid possible
compatibility issues, this CL introduce a new "languageTag" attribute
instead of reusing existing "imeSubtypeMode" and "subtypeLocale"
attributes.

For IME developers, this CL changes nothing unless "languageTag"
attribute is specified.  To summarize:

  A: If only legacy locale-string is specified
     (existing IMEs/Spell-Checkers fall into this category):
    -> The system uses locale-string.

  B: If only LanguageTag is specified:
    -> The system uses LanguageTag.

  C: If both locale-string and languageTag are specified:
    -> The system uses LanguageTag.  Legacy locale-string is ignored.

For application developers, there should be some follow-ups CLs because
even with this CL most likely they would still have to take care of
previous versions of Android where:
  - Locale#forLanguageTag()              (N/A in API Level 20 and prior)
  - Locale#toLanguageTag()               (N/A in API Level 20 and prior)
  - InputMethodSubtype#getLocale()       (Deprecated in N)
  - SpellCheckerSubtype#getLocale()      (Deprecated in N)
  - InputMethodSubtype#getLanguageTag()  (N/A in M and prior)
  - SpellCheckerSubtype#getLanguageTag() (N/A in M and prior)
One idea would be is in the official support library to provide a utility
method that takes care of above tasks and just returns a Locale object.
If we had a utility method in the support library, probably not
returning a Locale object from #getLanguageTag() would make sense.

From performance point of view both existing legacy locale-string
attribute and new LanguageTag attribute are just String objects that
travel from XML manifest to system services to applications via IPCs.
Hence there are no performance implications except for having one more
String objects.

Bug: 22858221
Change-Id: I6db107ad2afc7709167f7c4e5d24bd589ac8bd70
2015-12-08 12:27:55 -08:00
Yohei Yukawa
0894319162 Add subtypeId for SpellCheckerSubtype.
What this CL actually does is just copying the existing concept
"subtypeId" from InputMethodSubtype to SpellCheckerSubtype.

To recap, the underlying problem is that the system has stored only the
return value of SpellCheckerSubtype#hashCode() to track the set of
enabled subtypes, and SpellCheckerSubtype#hashCode() has been
implemented as Arrays.hashCode(new Object[] {locale, extraValue}), which
is problematic because:
  - Spell checker developers cannot change "locale" and/or 'extraValue'
    if they want to keep enabled subtypes enabled.
  - Android Framework developers cannot change the hash function even
    when new fields are added if they want to keep enabled subtypes
    enabled.
InputMethodSubtype has had the same issue, and what we did was
introducing a concept "subtypeId", which allows IME developers to
specify the return value of #hashCode().

For instance, suppose that a subtype X has already been used in
production with the following attributes:
  - locale: "tl_PH"
  - extraValues: "key1=value1,key2=value2"

With "subtypeId", you can change the attributes of subtype X without
losing the enabled state of subtype X on devices as follows.
  - locale: "fil_PH"
  - extraValues: "key1=value1,key2=value2,key3=value3"
  - subtypeId: Arrays.hashCode(new Object[] {
            "tl_PH", "key1=value1,key2=value2"})

This CL also deprecates existing public constructor of
SpellCheckerSubtype, which was probably published as a public API by
mistake.  Note that the constructor of SpellCheckerInfo class is @hide.
Also there is no public API that receives SpellCheckerSubtype object
instantiated by developers with custom data.  Making developers to be
able to instantiate SpellCheckerSubtype does not make sense right now.

Bug: 11736916
Bug: 22858221
Change-Id: I98f05c1e9421c47a93769bc4a6fe11b678bc2509
2015-12-04 16:16:47 -08:00
Yohei Yukawa
eae60ba5a4 Rewrite a fake language code "tl" in SpellChecker.
With following CLs, we already have a special rewrite rule of "tl" to
"fil" for IMEs that are targeting older versions of Android earlier than
Lollipop that did not support three letter language codes and used
"tl" (Tagalog) as the language string for "fil" (Filipino).
  - 92280cd309b0f5967dd253280962d8581844db89 [1]
  - ed65bc0c62ca99a118057db7ad54c4ccc14d52d0 [2]

  [1]: I94f203bddceb9c87710cb187cc3cc0ee6d9092a5
  [2]: Ica9cd2baac002c406f92331aadd7725d7424046a

With this CL, we have the same rewrite rule for spell checker services.

Bug: 20696126
Change-Id: I0af0f520a15337e33973391c9965364e3ae1ee4c
2015-12-04 14:43:17 -08:00
Yohei Yukawa
658c29e86e retry: Add @hide SpellCheckerSubtype#getLocaleObject().
This is the 2nd try of I39dc0c310158ad23ba6c987efce07deaf30ce693.

This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

No behavior change is intended.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I51be014c752b736a808e2b0d56e664941a218a2f
2015-12-04 14:43:01 -08:00
Yohei Yukawa
8687b42463 Merge "Revert "Add @hide SpellCheckerSubtype#getLocaleObject()."" 2015-12-04 22:30:45 +00:00
Yohei Yukawa
80a918c3bd Revert "Add @hide SpellCheckerSubtype#getLocaleObject()."
This reverts commit e3c761c87efdee7c28461559015fa76602d4605a.

Previous CL unintentionaly contained behavior change.

Change-Id: I1e350f224df815e991d9f42ac4145ecfc5c1c8b0
2015-12-04 22:26:41 +00:00
Yohei Yukawa
ab004d5ad8 Merge "Add @hide SpellCheckerSubtype#getLocaleObject()." 2015-12-04 22:17:32 +00:00
Yohei Yukawa
34e284acce Merge "Add SpellCheckerSubtypeTest." 2015-12-04 22:12:36 +00:00
Yohei Yukawa
e3c761c87e Add @hide SpellCheckerSubtype#getLocaleObject().
This is a mechanical refactoring with no behavior change.

With this CL, InputMethodSubtype and SpellCheckerSubtype have the same
getLocaleObject() hidden API, which makes it easy to share the logic in
subsequent CLs.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: I39dc0c310158ad23ba6c987efce07deaf30ce693
2015-12-04 22:07:39 +00:00
Yohei Yukawa
9534ae1858 Add SpellCheckerSubtypeTest.
Before introducing behavior changes, this CL adds
SpellCheckerSubtypeTest to make the current behavior clear.

Bug: 11736916
Bug: 20696126
Bug: 22858221
Change-Id: Ied18580f31497156510e1b785adfc248683ba94d
2015-12-04 13:05:20 -08:00
Jeff Sharkey
9d8a1048bb Handle non-encryption-aware accounts and sync.
The system can now boot in a "locked" state where only encryption
aware (EA) components can be safely started.  When in this state,
PackageManager already filters away non-EA components, but system
services like AccountManager and SyncManager need to carefully handle
these temporarily "missing" components.

As a guiding principle, all known Accounts are still present when
the device is locked, but communication with underlying non-EA
authenticators is blocked.

To keep things simple for now, all SyncManager requests are kept
dormant until the user enters the unlocked state.

The core of this logic is that RegisteredServicesCache now works
with all components regardless of EA status, which prevents us from
accidentally thinking a service was removed when the user is locked.

Bug: 25945136
Change-Id: I8714121f6236b00821769023c4df7de1c8a99944
2015-12-04 09:36:39 -07:00
Yohei Yukawa
226c4bba67 Add a test for constructLocaleFromString(String).
This is a follow up CL for ed65bc0c62ca99a118057db7ad54c4ccc14d52d0 [1],
which fixed special handling of a fake language code "tl".

  [1] Ica9cd2baac002c406f92331aadd7725d7424046a

Bug: 20696126
Change-Id: Ifc8bf2ff6bd617a215e4b68f6b2bf9b94e80db07
2015-12-03 15:21:15 -08:00
Alex Klyubin
dd4e412172 Merge "Stop using 512 bit RSA keys in keyset unit tests." am: 59c9bfd41b am: b1e7f6d287
am: 64868d11dd

* commit '64868d11dd1597267631bc6b519c1eacbfd90396':
  Stop using 512 bit RSA keys in keyset unit tests.
2015-12-03 21:33:44 +00:00
Alex Klyubin
377e70ae9f Stop using 512 bit RSA keys in keyset unit tests.
This switches keyset unit tests from two unrealistically short 512 bit
RSA keys to a more realistic 2048 bit RSA key and a NIST P-256 EC key.

Change-Id: If615b97dff22a2a4f7f0e6015e410e98b8d395cd
2015-12-03 12:52:23 -08:00
Colin Cross
242f927555 Merge "Don\'t hardcode expected path to mainDexClasses" am: be1613379e am: 38400b4696
am: 6b644ec528

* commit '6b644ec528f62b74850e8566132a790e8f9f00da':
  Don't hardcode expected path to mainDexClasses
2015-12-03 01:35:41 +00:00
Colin Cross
b4ff8e4815 Don't hardcode expected path to mainDexClasses
Use MAINDEXCLASSES defined by the build system instead of manually using
$(HOST_OUT_EXECUTABLES)/mainDexClasses.

Change-Id: Iede13c243ef0c4e374c8e80bab4a995cea76b9b1
2015-12-02 16:24:08 -08:00
Keisuke Kuroyanagi
5f71b5afe8 Make drag handle tests stable.
The center position of a drag handle can be outside of the
screen. In such cases, selection handle tests can be failed.
Changed to drag the visible position to deal with it.

Bug: 25730231
Change-Id: Id9270fc03d0f39041f243c9e9d17deca19925e09
2015-12-02 15:02:05 -08:00
Daniel Cashman
66623fb218 Merge "Fix getKeySetByAlias PackageMgr test." 2015-12-02 15:35:28 +00:00
dcashman
c4d372f6ff Fix getKeySetByAlias PackageMgr test.
commit 42aed1b8ecf591009f9e2df8eaca4f41074c37c8 changed the hidden
KeySet API to allow packages to retrieve keysets of other packages.
Change the PackageManagerTests to not expect a SecurityExeption
anymore and also make sure that this is supported.

Bug: 25935839
Change-Id: I18c00997a627c9df1eb3826650c1aa71f563a2bd
2015-12-02 15:34:46 +00:00
Todd Kennedy
6c2ce9afc9 Merge "Fix tests" 2015-12-02 15:25:31 +00:00
Keisuke Kuroyanagi
2ff41d4afc Add TextView mouse tests for long click and double click.
Bug: 19544351
Change-Id: I4f3fe633c01c443441ff0ef1617bad34c17ab508
2015-12-01 16:58:53 -08:00
Todd Kennedy
9f3a78cbaa Fix tests
The majority of the test failures were around the method assertInstall()
failing a check for a symlink between the data directory in /data/data/
to the application directory in /mnt/asec/. There are a handful of other
failures that will be dealt with separately; those have all been suppressed
from running.

Also took the opportunity of adjusting some of the tests to ensure the
device is properly cleaned up. Packages remained installed after a failure.

Bug: 18048725
Change-Id: Id8f6ac53cfe17de43b5d527993d57812b1a63bef
2015-12-01 15:56:27 -08:00
Abodunrinwa Toki
fc6e25ef6e TextView tests to check that selection handles appear on selection
Bug: 25730231
Change-Id: I66e44b6375e1a76e8537fca5dc5090ff841cc934
2015-12-01 10:36:51 +00:00
Keisuke Kuroyanagi
877a4e09ea Merge "Selection Test: selection handle snaps to word boundaries." 2015-11-25 07:37:29 +00:00
Keisuke Kuroyanagi
68e1945c39 Merge "Selection Test: selection handle doesn't pass anther one." 2015-11-25 07:37:10 +00:00
Keisuke Kuroyanagi
e85a2687ae Merge "Add selection handle multiline dragging tests." 2015-11-25 07:31:37 +00:00
Keisuke Kuroyanagi
d3c48931ea Merge "Add selection handle dragging tests." 2015-11-25 07:24:17 +00:00
Keisuke Kuroyanagi
ec913c0eb6 Selection Test: selection handle snaps to word boundaries.
Bug: 25730231

Change-Id: I12d3fde4ff5b52aa6673de915c53b6a5f72f4b35
2015-11-25 16:15:20 +09:00
Keisuke Kuroyanagi
cb6e8420cb Selection Test: selection handle doesn't pass anther one.
Bug: 25730231
Change-Id: Ibca75126a0b2d4320d1f67dc35a2b0ac20fcdcd2
2015-11-25 16:15:20 +09:00
Keisuke Kuroyanagi
c24c2bbb69 Add selection handle multiline dragging tests.
Bug: 25730231

Change-Id: I23b9e35d7a5ea8d03d8634ffca0e186ea76ebc99
2015-11-25 16:15:19 +09:00
Keisuke Kuroyanagi
da79ee683d Add selection handle dragging tests.
- Set an id for each HandleView to access the hanlde.
- Rename DragOnTextViewActions to DragAction to use it for
dragging handles.
- Introduce HandleCoordinates to provide proper coordinates
for handles.

More tests will be added in following CLs.

Bug: 25730231
Change-Id: I9276bf2f983983ec9aae0ddcf674d3dcee566892
2015-11-25 16:15:15 +09:00
Seigo Nonaka
a71a244ec6 Make suggestion window style material.
To make suggestion window style Material, this CL does following things:
1. Introduce LinearLayout to be able to split suggestion item and menu.
 Currently suggestion menus, "Add to Dictionary" and "Delete" buttons
 are children of ListView. It is necessary to introduce LinearLayout
 and move these two menus from ListView to this LinearLayout to have a
 divider between suggestion items and menus.

2. Extract suggestion window layout definition from Java.
 Currently almost all layout of suggestion popup window is done by
 Editor.java. By extracting this logic from Java and move it to XML
 files, it becomes easy to support both Holo and Material theme.

3. Introduce Material Design.
 Suggestion window should respect the running application's theme since
 suggestion window is shown as the part of the application.
 This patch introduces Material themed suggestion window, and at the
 same time, the old window is also kept as the Holo themed suggestion
 window.

Bug: 15347319
Change-Id: Ieccea12db95c0a040b38680ae794b1cf6971736f
2015-11-24 12:05:48 +09:00
Przemyslaw Szczepaniak
3f72604be8 Use HexDump instead of java.lang.IntegralToString
java.lang.IntegralToString is being removed, replaced
all its usage by com.android.internal.util.HexDump.

Bug: 24932279
(cherry-picked from 15fc0548a536750110e159e06a39ba943eccdd81)

Change-Id: Id6ab88337af12d93cd73c41775b9d5baa1e61d96
2015-11-20 14:11:02 +00:00
Seigo Nonaka
bb1a96647a Make Paint.hasGlyph variation selector aware.
With this CL, Paint.hasGlyph returns true if the typeface supports
the passed code point and variation selector pair.

Bug: 11256006

Change-Id: If29cd0c5942dc78bd862804106e29539bdeee569
2015-11-18 21:17:58 +09:00
Fyodor Kupolov
1682dad7ed Moved system user apps whitelisting to PM
Previously applications where uninstalled for the system user at a later stage
in a boot process, when PM has already been initialized and registered as
a service. This was causing a flood of PACKAGE_REMOVED broadcasts.

Applications are now uninstalled at an earlier stage, when PM hasn't been
registered. Packages can simply be marked as not installed and broadcast
can be skipped.

Bug: 25626819
Change-Id: Ib64e7c45619809b0efb99cc566a9a2120ed48cd3
2015-11-12 13:48:18 -08:00
Seigo Nonaka
a17d8766d4 Merge "Clear suggestionSpan reference once popup window is closing." 2015-11-12 06:55:34 +00:00
Doris Liu
81963e3d56 Add tests for calling end() before start() on ValueAnimator
Bug: 23713124
Change-Id: I55c86a43249fd36a9e633a6f75d6316c2e69ec61
2015-11-09 14:41:07 -08:00
Abodunrinwa Toki
a295ef2f33 Merge "Fix failing TextActivityTest." 2015-11-03 16:06:38 +00:00
Abodunrinwa Toki
e36c7112e7 Fix failing TextActivityTest.
It seems like setOrientation(...) is not working.
Instead, fix the orientation of TextViewActivity to portrait.
See: I2f9372997f8301d800109981c6e1a6d4419b641d
Bug: 24495166

Change-Id: I0c5480b7ce6ba1fb8e4e4e3daabe94ebccca4dfd
2015-11-03 14:08:03 +00:00
Jeff Sharkey
46cfd93aa2 Let's sprinkle some FastJNI into Resources.
Before:

               benchmark   us linear runtime
                GetColor 14.9 ===========
              GetInteger 19.9 ===============
    GetLayoutAndTraverse 38.4 =============================
               GetString 38.5 ==============================

After:

               benchmark   us linear runtime
                GetColor 13.9 ==========
              GetInteger 18.8 ==============
    GetLayoutAndTraverse 38.1 =============================
               GetString 38.2 ==============================

Change-Id: I8c20e14182d2645bc62a0e7fc6345e298b11933c
2015-11-02 19:49:11 -08:00
Fyodor Kupolov
9147ce4cf9 Merge "Enable default system IMEs for system user" 2015-10-28 17:05:58 +00:00
Erik Kline
7ae47acb0b Merge "Also treat loss of IPv6 as a loss of provisioning." 2015-10-28 07:07:51 +00:00
Fyodor Kupolov
b3b4f61525 Enable default system IMEs for system user
Added GET_DEFAULT_IMES flag to AppsQueryHelper. Default system IMEs are now
enabled for system user.

Bug: 25276229
Change-Id: I38d74903951200e2207e1864bb3a815f8f2d572f
2015-10-27 13:55:40 -07:00
Keisuke Kuroyanagi
ead6ba3a63 Stop making a reversed selection with mice.
Bug: 24889605
Bug: 24475013
Change-Id: I6d39e050656dc28e523fab862c84054169e6300b
2015-10-27 17:26:07 +09:00
Erik Kline
1ad4e22534 Also treat loss of IPv6 as a loss of provisioning.
Bug: 23226635
Change-Id: Icebb7d83ed5b3b796901b9f023909a02eb461941
2015-10-27 17:11:27 +09:00
Keisuke Kuroyanagi
09424c83d6 Merge "Add mouse interaction UI test for TextView." 2015-10-27 05:46:00 +00:00
Mitchell Wills
61da59bd9c Merge "Fix TimeUtils.formatDuration for exactly one of a unit" 2015-10-26 23:53:57 +00:00
Jerry Wong
32d52f344a Incorrect time used in some NTP server responses
Per RFC 4330, a NTP server response should be discarded when:
    - the stratum is 0 (unspecified), or
    - the leap indicator is 3 (unsync'ed), or
    - the mode is not 4 (server) / 5 (broadcast), or
    - the transmitted time is 0.

Update SntpClient so that such responses would be discarded.

Additionally:
    - make some variables suitably "final"
    - enable logging
    - add alternate requestTime() for testing
    - add some miniscule test coverage

Cherry-picked from Jerry Wong's

    https://partner-android-review.googlesource.com/#/c/460074

Bug: 24719581
Change-Id: Id11a79a6e53ce95500ed4b4d691a29c260666f6c
2015-10-17 03:36:32 +09:00
Seigo Nonaka
7afa67ca22 Clear suggestionSpan reference once popup window is closing.
Clear suggestionSpan reference since it is not necessary once the
suggestion window is closed.

suggestionSpan is kept for identifying the target text region in
onItemClick method.

This CL is a part of groundwork for Bug 15347319 and no user visible
change is intended with this CL.

Change-Id: Ie0edf215a1b90629e280ce09df4fd6f5d95fbb06
2015-10-15 19:11:50 +09:00
Doris Liu
a0942e2121 Test ValueAnimator when duration scale is set to 0
Change-Id: I33a90bc39d3b451696752eae02edfacb4ddfd80e
2015-10-14 11:02:25 -07:00