1629 Commits

Author SHA1 Message Date
Adam Lesinski
c4dd2e7d52 Merge "Move the guts of Resources to ResourcesImpl" into nyc-dev 2016-03-04 00:16:47 +00:00
George Mount
7d09ca79f1 Merge "Remove animation listener while paused." into nyc-dev 2016-03-03 21:38:25 +00:00
Siyamed Sinir
84d0f8775b Merge "Email address autolink regex updates." into nyc-dev 2016-03-03 18:42:59 +00:00
George Mount
a06b3f19d4 Remove animation listener while paused.
Bug 27418573

While an animator was paused, it continued to receive
Choreographer callbacks. This has been changed now so
that after the first callback, it is removed.

Change-Id: If73483404b38f1f354a63fc98d07696f442987e6
2016-03-03 08:12:58 -08:00
Seigo Nonaka
19f47929ea Merge "Improve forward delete key handling." into nyc-dev 2016-03-03 12:58:03 +00:00
Yohei Yukawa
42275bc8b3 Fix a regression in InputMethodUtils.
It turns out that my previous CL [1] unexpectedly changed the behavior
of InputMethodUtils#getImplicitlyApplicableSubtypesLocked() in terms of
when "EnabledWhenDefaultIsNotAsciiCapable" extra value is taken into
account.

Suppose if an IME X has the following three subtypes:
 A. locale: en_US
    mode: handwriting
    extraValue:
 B. locale: hi
    mode: keyboard
    extraValue:
 C. locale: en_US
    mode: keyboard
    extraValue: AsciiCapable
 D. locale: zz
    mode: keyboard
    extraValue: AsciiCapable, EnabledWhenDefaultIsNotAsciiCapable

Given the above subtypes, here are results of what subtypes are enabled
by InputMethodUtils#getImplicitlyApplicableSubtypesLocked() I) before
the CL [1] and II) after the CL [1].

  - system language: hi:
      I:  B, D
     II:  B, D
  - system language: hi-IN:
      I:  B, D
     II:  B, D
  - system language: en-US
      I:  A, C
     II:  A, C
  - system language: en-GB
      I:  A, C
     II:  A, C
  - system language: ja-JP
      I:  B
     II:  D

What my previous CL actually broke is the the last one, and it's broken
because we accidentally started using
"EnabledWhenDefaultIsNotAsciiCapable" even when there is no subtype that
matches to the requested language.  Previously that attribute was used
if and only if 1) there is a subtype that matches the requested language
and 2) that subtype is not marked to be AsciiCapable.

If there there is no subtype that matches to the requested language,
what we had relied on is actually the result of
InputMethodUtils#findLastResortApplicableSubtypeLocked() called with
  canIgnoreLocaleAsLastResort = true,
which means that we had just picked up the first keyboard subtype as the
last fallback candidate regardless of it's locale.  This is why the
subtype B should be picked up in the last case where system language is
ja-JP.

This CL fixes the above unexpected behavior change regarding
"EnabledWhenDefaultIsNotAsciiCapable" so that the previous behavior can
be preserved.

  [1] Iaf179d60c12b9a98b4f097e2449471c4184e049b
      e985c240e3feb62ea38d5b4e386be083ca0f215b

Bug: 27129703
Bug: 27425459
Change-Id: Icd86cad955bf827a1eb41255f57fdf4ec315b93b
2016-03-03 09:05:11 +00:00
Seigo Nonaka
23a67678e3 Improve forward delete key handling.
Forward delete key now deletes characters until the next grapheme
cluster boundary.

Bug: 25737208
Bug: 27035430
Change-Id: Ie2fb510fefa115657cc48063be5319b1eecb30b9
2016-03-02 17:21:36 -08:00
Adam Lesinski
fb302ccd8e Move the guts of Resources to ResourcesImpl
In order to satisfy the requirement that clients can
cache a Resources object when a configuration change happens,
we move the caches and all other method bodies to ResourcesImpl.
These can then be swapped out for the correct version when needed,
while allowing clients to keep holding the existing Resources references.

This is part 1 of 2 CLs. The next one will do the actual switching of implementations
based on configuration changes for multiwindow.

Bug:26854894
Change-Id: I41156194a3541e59053b4048c3a15981c7d8a506
2016-03-01 16:58:19 -08:00
Todd Kennedy
a67932374d Revert "Revert "Remove deprecated methods / classes""
This reverts commit 5cbeb5902633646fbc0a1be252081e77aaaee7b4.

Change-Id: Id96010364d65e6131221ebbcc8ce5889a2da256c
2016-03-01 07:19:33 -08:00
Siyamed Sinir
0716d5f499 Email address autolink regex updates.
This CL updates the email address pattern with:
* Local-part should be max 64 characters, and domain should be max 255
  characters (it was the opposite before).
* Labels in the domain name should be at most 63 characters.
* Support non-ascii unicode characters.
* Add tests for email address pattern.

Bug:9585450
Change-Id: I983f269904ef014ef625417dd08b6509084e6879
2016-02-25 17:02:43 -08:00
Mitchell Wills
ebc106cb71 Merge "Modify WakeupMessage to only send the message if not canceled" into mm-wireless-dev
am: 9505e0ac3f

* commit '9505e0ac3f6bef7ad850f3b6fc9ec576b65b1e55':
  Modify WakeupMessage to only send the message if not canceled
2016-02-26 00:20:00 +00:00
Mitchell Wills
634c1f9d0d Modify WakeupMessage to only send the message if not canceled
Change-Id: I9ca6d3726fe25c706b644bf61119837a7cbe6db1
2016-02-24 20:17:39 -08:00
Yohei Yukawa
b3fdffbb48 Merge changes Iaf179d60,I315cf372,I21d3c5cc into nyc-dev
* changes:
  Use LocaleList for implicitly enabled subtypes.
  Add a utility method to filter locales.
  Mechanical refactoring in InputMethodUtilsTest.
2016-02-25 02:57:51 +00:00
Yohei Yukawa
e985c240e3 Use LocaleList for implicitly enabled subtypes.
There are two major changes in this CL:

  1. Now IMMS resets its internal state whenever the system locale list
     is changed, rather than just checking the primary system locale.
  2. For software keyboard subtypes,
     InputMethodUtils#getImplicitlyApplicableSubtypesLocked() now takes
     the entire system locale list into account when determining what
     subtypes should be enabled by default when the user does not
     explicitly enable one or more subtypes.

Bug: 27129703
Change-Id: Iaf179d60c12b9a98b4f097e2449471c4184e049b
2016-02-24 18:27:04 -08:00
Yohei Yukawa
102ff0726d Add a utility method to filter locales.
This is a preparation CL to take secondary system locales into
account in InputMethodUtils#getImplicitlyApplicableSubtypesLocked().

Suppose the following situation:

  available subtypes:
    en-US, en-IN, and en-GB, fr, fr-CA, fr-CH, fr (QWERTZ)
  system locales:
    en-GB, en-US, fr-MC

Basically we want to have at most one subtype for each language appears
in system locales.  Hence the goal of this utility method is to filter
the above available subtypes into en-GB and fr.  In other word, we do
not want to enable both en-GB and en-US subtypes in this scenario.

This CL introduces LocaleUtils#filterByLanguage() for this purpose, with
some unit tests.  Note that that method is not used in production yet.

Bug: 27129703
Change-Id: I315cf3722a06e00bdbfac284c4949578da8fe78d
2016-02-24 18:25:16 -08:00
Yohei Yukawa
fc843713bc Mechanical refactoring in InputMethodUtilsTest.
This is a mechanical refactoring in InputMethodUtilsTest that changes
nothing.

Bug: 27129703
Change-Id: I21d3c5cc4cc3018fc844c18362035ebdc656dec1
2016-02-24 00:34:33 -08:00
Joe Onorato
e1acd636d4 Make getBatteryUptimeLocked protected so it can be mocked.
Also fix test names.

Change-Id: I43477e61c22cd36735214951c45c52b39095e1b5
2016-02-23 13:28:03 -08:00
Joe Onorato
abded113bd Add unit tests for BatteryStatsImpl.
- Add a Clocks interface to wrap SystemClock.uptimeMillis and
  SystemClock.elapsedRealtime.
- Make the inner classes static so they can be created independently,
  which meant passing explicit pointers to the BatteryStatsImpl and
  the Uid objects in a lot of places.
- Make several fields protected so they can be accessed by the tests (they are
  still @hidden)
- Add a test suite for the battery stats.
- Add the tests

Change-Id: I4e45afedc64f7050985c28a7eb4f5c1ddbaa63fa
2016-02-23 12:44:22 -08:00
Lorenzo Colitti
2a452d48d5 Merge "Add a unit test for MessageUtils." into mm-wireless-dev
am: 6f027b4f06

* commit '6f027b4f0651837877e0f291bbf121436dfe3958':
  Add a unit test for MessageUtils.
2016-02-23 07:49:06 +00:00
Lorenzo Colitti
f979012c9b Add a unit test for MessageUtils.
Also fix a couple of issues in the code:

1. Check that fields are static before attempting to read them.
   Currently, if a non-static field's name starts with one of the
   specified constant prefixes (by default, "CMD_" and "EVENT_")
   we'd get an NPE.
2. Only read final fields.

Change-Id: I0e07c4c27a66180cbaf7f2b1c235daafc080863b
2016-02-20 23:24:25 +09:00
Aurimas Liutikas
1c8cbb5440 Fix a set of random warnings in frameworks/base/
Bug: 26936282
Change-Id: Ic411d7a1673503d5945f952ebf5a8be964bb54a4
2016-02-19 13:44:25 -08:00
Mitchell Wills
8e2602ea26 Merge "Fix FastXmlSerializerTest" into mm-wireless-dev
am: 3ca1ccb419

* commit '3ca1ccb419ec56a191d724ff75c6943200c8cebe':
  Fix FastXmlSerializerTest
2016-02-19 18:22:51 +00:00
Mitchell Wills
e8bab3cd37 Merge "Remove AsyncChannelTest because it does not test anything" into mm-wireless-dev
am: acd97e2e0f

* commit 'acd97e2e0fdcc50f20bc4836188e781583b10f1e':
  Remove AsyncChannelTest because it does not test anything
2016-02-19 18:19:27 +00:00
Mitchell Wills
3ca1ccb419 Merge "Fix FastXmlSerializerTest" into mm-wireless-dev 2016-02-19 18:13:58 +00:00
Mitchell Wills
acd97e2e0f Merge "Remove AsyncChannelTest because it does not test anything" into mm-wireless-dev 2016-02-19 18:11:20 +00:00
Mitchell Wills
86821c07c2 DO NOT MERGE Disable failing test case
Bug: 27258801

Change-Id: I832505e0feca9f0abbf627d009d5982a4437bf83
2016-02-19 07:59:20 +00:00
Mitchell Wills
733fc6b6f9 Fix FastXmlSerializerTest
Change-Id: Ie984abae588927e65bdeffa5a6f5c58bd6ba0bf1
2016-02-18 23:43:30 -08:00
Mitchell Wills
c91e57c1aa Remove AsyncChannelTest because it does not test anything
Change-Id: I7d3fe580a8c32ef3bd10895b51a7fc436f79919f
2016-02-18 23:37:14 -08:00
Lorenzo Colitti
acaf80910d Merge "Move tests for com.android.internal.util out of coretests" into mm-wireless-dev
am: 5947d11119

* commit '5947d11119d2ca1426d358a6850bd5a8d8490ab5':
  Move tests for com.android.internal.util out of coretests
2016-02-19 06:08:15 +00:00
Lorenzo Colitti
35402eb8ae Move tests for com.android.internal.util out of coretests
These are very simple tests with no dependencies, and moving them
out of FrameworksCoreTests makes it possible to iterate much more
quickly.  "runtest frameworks-core" takes almost a minute just to
push to the device, before any tests even start running.

Bug: 25691379
Change-Id: I8d99316a5940e0171883b97c578f9a6882b699a0
2016-02-19 14:35:48 +09:00
Jeff Sharkey
2c1ba9a961 Make BackupManager encryption aware.
Backup requires both CE and DE storage to be available, so delay
spinning up the backup system until the user is unlocked, since
that's when CE storage becomes available.  Note that devices without
FBE immediately transition USER_SYSTEM into the unlocked state,
since their CE is always available.

Offer to backup and restore files under both CE and DE.  Since DE
is effectively the same as CE, most logic is simply duplicated for
now, but it could be simplified in the future.  Since system apps
can force their default storage location to DE, we always build
explicit CE and DE paths.

Add getDataDir() to give clean access to the top-level private data
directory, but disclaim that apps shouldn't create files there.

Bug: 26279618
Change-Id: Ic34a4b330223725db93b1d0f5c9dffc88002c61f
2016-02-18 10:54:11 -07:00
Yohann Roussel
2a24891ca7 Suppress warnings of MultiDexLegacyAndException
To clean build logs without disturbing the test.

Cherry-pick of https://android-review.googlesource.com/#/c/202657/

Bug: 27155813
Change-Id: I4f2fa94729258573223aaa70a88744d2687f542e
2016-02-17 13:43:59 -08:00
Seigo Nonaka
ff3bfd5a79 Improve backspace for emoji and variation sequences.
This CL makes backspace handling aware of variation selector, combining
enclosing keycaps, zero width joiner, regional indicator symbols and
emoji modifiers.

BUG: 25737208

Change-Id: I740578bfee955cc623e2831778e5b7ec4b8cb627
2016-02-17 15:29:52 +09:00
Yohei Yukawa
ce3f338040 Merge changes I0f79243e,Ia27e19f9,Iec6b89f0,I276c7eb0 into nyc-dev
* changes:
  Have unified setter/getter for Secure Settings.
  Remove redundant arguments.
  Use Context#getSystemService(Class<T>) in IMMS.
  Use Java7 diamond operator in InputMethodUtils.
2016-02-16 16:11:50 +00:00
Neil Fuller
3269825f0b Add flags needed to switch Jack to 1.8 for CTS targets
When linking against .jack files that contain 1.8 language
features Jack (currently) requires -D jack.java.source.version=1.8.

"core-tests" includes 1.8 language features.

Bug: 27113322
Bug: 26953739
Change-Id: If40239d4af59a3d3f71b22e8ef2a07e553c8d5c2
2016-02-12 17:07:51 +00:00
Yohei Yukawa
622b44d00f Use Java7 diamond operator in InputMethodUtils.
This CL changes nothing except for deleting redundant type parameters by
using diamond operator.

No behavior change is intended.

Bug: 26279466
Change-Id: I276c7eb0136d373464ba6e997685d440beaca674
2016-02-11 08:26:13 -08:00
Andreas Gampe
f72cc9437b Frameworks/base: Fix LineBreakBufferedWriter
In case of writing single character, check against the buffer length,
not the maximum buffer size.

Bug: 27099774
Change-Id: I83d49ea74cc3d25342ec540b654d3dc68e4e802e
2016-02-10 15:18:24 -08:00
Jeremy Joslin
3b37274a37 Merge "Update test to stub the correct method." into nyc-dev 2016-02-10 15:38:19 +00:00
Jeremy Joslin
fe505af048 Update test to stub the correct method.
NetworkScorerAppManager was recently updated to use
queryBroadcastReceiversAsUser() in place of
queryBroadcastReceivers() but its unit test wasn't changed accordingly.

Change-Id: Ib41195fe8b9cf8c8da9a9090a4f26e1cde3db4f0
2016-02-10 07:34:46 -08:00
Yohei Yukawa
5d64399c51 Use Context#createConfigurationContext().
Nothing is changed in the test expectations.
Major changes in this CL are:

  1. To obtain a custom context with the given locale,
     Context#createConfigurationContext() is the way to go.
     Modifying any internal state of the resource that is owned by the
     context is not supported at all.
  2. As a preparation to test cases where multiple locales are specified
     in the system settings, unit tests need to switch to
     Confituration#setLocales(LocaleList).

Bug: 27076327
Change-Id: I6caa76627677c7625a1c42d76a275f67ae65a9b2
2016-02-08 23:21:37 -08:00
Siyamed Sinir
217c0f71df Clamp EditText cursor in the drawable boundaries.
EditText tried to draw outside of the padding boundaries because of a
cursor positioning issue in RTL. This CL removes that fix and instead
clamps the cursor position if cursor is outside of the clipped view
boundary.

Bug: 23397961
Change-Id: Id5f1fbe2a0f571100c89b21758fbb81b14d5da57
2016-02-08 22:41:26 +00:00
George Mount
5affef0773 Fix Fade transition interrupt.
Bug 26963113

When a Fade transition is interrupted and reversed, the
View started the animation from the beginning. This change
captures the previous transitionAlpha and starts the animation
from the previous alpha state.

Change-Id: I801fe9ade6af4cf8446838e231bdc71841668a18
(cherry picked from commit 3cf9fa3db0231d035142c27992818d8f7827ac3e)
2016-02-08 20:33:49 +00:00
Roozbeh Pournader
fee4484637 Various LocaleList cleanups
- Remove the LocaleList#getPrimary() API. It had become confusing
  after locale negotiation was completely implemented. For example,
  it could create the confusion that calling getPrimary() on the
  default locale list would provide the default locale, etc.
- Use the adjusted locale list from LocaleList.getAdjustedDefault()
  in Paints created with no locale list provided.
- Change LocaleList#get() to treat out of bound indexes from both
  negative indexes and too large indexes the same way.

Bug: 26984092
Bug: 26193251
Bug: 26834387
Change-Id: I75f77aea6b75e38793ed8477e5e5a4420d5e6d85
2016-02-04 15:44:03 -08:00
Roozbeh Pournader
486117bf5b Merge "Move locale negotiation to ResourcesManager" 2016-01-27 01:48:39 +00:00
Philip P. Moltmann
e33b954165 Merge "Check parameters for callers of IPrintManager" 2016-01-26 22:52:58 +00:00
Roozbeh Pournader
834641b390 Move locale negotiation to ResourcesManager
Previously, locale resolution happened at Resources level, which
could result in different Resources in the same app using different
locales.

This change moves the locale negotiation to ResourcesManager, which
remembers the locales supported by each Resources as they are
created, and negotiates the locale based on their union.

It also makes sure that the old model of apps getting the default
locale by accessing it through the Configuration's locale attribute
continues to work, since the negotiated locale will be moved to the
top of the list before Resources are created and when they are
updated with a Configuration change.

Bug: 25800576
Bug: 26404653
Change-Id: I0dd81df288327fd8d1229188c9544ee2209c161a
2016-01-25 19:23:38 -08:00
Keisuke Kuroyanagi
a2756f6018 Merge "TextView tests: drag and drop." 2016-01-26 01:26:06 +00:00
Keisuke Kuroyanagi
e27e0850fe Add TextView cursor positioning tests for grapheme clusters.
Bug: 25375561
Bug: 25730231
Change-Id: I7e77e6de027a81ec0f203a1ff9c24a768ffedae3
2016-01-22 06:02:42 +00:00
Philip P. Moltmann
76d7e3ee70 Check parameters for callers of IPrintManager
- Propagate nullness and non-null-ness up and down from the interfaces.
- Add non-CTS print tests for IPrintManager binder.

Change-Id: I0c310d9cea8aefba5ce386931521ffaf19712bbb
2016-01-21 13:27:30 -08:00
Siyamed Sinir
92b9747f1c Merge "Sort the result of SpannableStringBuilder.getSpans" 2016-01-21 19:12:28 +00:00