1655 Commits

Author SHA1 Message Date
Seigo Nonaka
62006a72a6 Merge "Remove duplicated test cases." into nyc-dev 2016-03-14 04:11:01 +00:00
Doris Liu
0304ac862e Merge "Testing initial value for 0-duration animations" into nyc-dev 2016-03-11 20:25:40 +00:00
Yohei Yukawa
fc1713dfad Merge "Use LocaleUtils#filterByLanguage for non-keyboard subtypes." into nyc-dev 2016-03-11 19:56:03 +00:00
Yohei Yukawa
238faad984 Use LocaleUtils#filterByLanguage for non-keyboard subtypes.
With this CL, we expand the target of Bug 27129703 and Bug 27348943 to
non-keyboard subtypes.

Suppose there is a handwriting IME (mode == "handwriting") that supports
the following 5 subtypes.
  - en-US
  - en-GB
  - fr
  - sr-Cyrl
  - sr-Latn

Also suppose the system languages are configured as follows.
  1. sr-Latn-RS
  2. ja-JP
  3. fr-FR
  4. en-GB
  5. en-US

In this case we want to enable [sr-Latn, fr, en-GB] by default when
"use system language" is checked in the subtype enabler.

See previous commits [1][2] about how we addressed those issues for
keyboard subtypes.

  [1]: Iaf179d60c12b9a98b4f097e2449471c4184e049b
       e985c240e3feb62ea38d5b4e386be083ca0f215b
  [2]: I8fc774154f5175abff2f16e8f12a4847bf5f5b7c
       072a95a3094af2ced4f009ad62c4553c28e3f830

Bug: 27560993
Change-Id: I416b5671602c550805ed6267dd210968aa1de83c
2016-03-11 10:39:51 -08:00
Keisuke Kuroyanagi
13d66d8456 Merge "Fix: Context menu can contain obsolete suggestions." into nyc-dev 2016-03-11 11:17:37 +00:00
Keisuke Kuroyanagi
182f5fec53 Fix: Context menu can contain obsolete suggestions.
When there are not enough number of suggestions, previously used
suggestions was continue to be used. This fixes it and simplifies code
by always allocating SuggestionInfo array.

Bug: 27602619
Change-Id: I9378315b8c810f126f65fade96ce9f6ff5271957
2016-03-11 10:08:11 +00:00
Yohei Yukawa
80861ff1c0 Make sure to compare subtype language with system language.
This CL addresses a regression introduced by a recent CL [1] that
non-keyboard subtypes are no longer implicitly enabled based on the
system language (a.k.a. "use system language" in the subtype enabler)
due to a type mismatch in comparison.

Here is the original logic:
 if (language.equals(systemLanguage) && systemLocale.startsWith(locale))

And here is the logic replaced by [1]:
 if (locale != null && locale.equals(systemLanguage)) {

The new logic is simply broken, because locale is a Locale object while
systemLanguage is a String object.  It never matches.

With this CL we will compare the system language with the locale
language again, with several test cases that should have been included
in [1], as a temporary solution until we start relying on
LocaleUtils#filterByLanguage() for non-keyboard subtypes.

  [1]: Iaf179d60c12b9a98b4f097e2449471c4184e049b
       e985c240e3feb62ea38d5b4e386be083ca0f215b

Bug: 27560993
Change-Id: If2d1710174853180465832e6ecbbb91235b76210
2016-03-11 01:08:52 -08:00
Adam Lesinski
58f1018c56 Merge "Cache per-Activity Resources objects" into nyc-dev 2016-03-10 20:50:40 +00:00
Adam Lesinski
082614c6a5 Cache per-Activity Resources objects
Each Activity has a Resources object whose underlying state changes
when a configuration change occurs, both global and for that activity only (multi-window).
Views and other clients of the Resources object can safely cache it knowing that
they always have a reference to the most up-to-date resources.

This applies to Resources.Theme objects as well.

Bug:26854894
Change-Id: Ifd3da5a1086e17f747dfc265a447fe92a3a5c692
2016-03-10 11:30:18 -08:00
Md Haque
0ef9fafb1b Change testtag to large as tests needs to have wifi connection
Change-Id: I345dbbba1c232d127eb4d0084767afbfc7bd55f9
2016-03-10 10:48:49 -08:00
Md Haque
cf4c7f58b0 Merge "Fix Download Manager Functional test and enable for APCT" into nyc-dev 2016-03-10 02:32:55 +00:00
Md Haque
c6272b9094 Fix Download Manager Functional test and enable for APCT
Download manager functional test exists but never run.
These tests are highly useful for catching regression
through running them in APCT framework

Change-Id: I9d3102cd64c8d3e6d5b90897fdf20ac1e0a9adf1
2016-03-09 14:07:22 -08:00
Seigo Nonaka
132039ae89 Remove duplicated test cases.
Removing duplicated test cases since normal cases are moved to cts.

Bug: 27553165
Change-Id: Ie8c127713dd05a2dc18fc54257ff3d9d1625a0e5
2016-03-09 11:01:37 -08:00
Brian Carlstrom
1f849da6f2 Merge "frameworks/base: Remove unnecessary core-tests dependency" into nyc-dev 2016-03-09 07:25:44 +00:00
Keisuke Kuroyanagi
fae4578311 Make drag&drop be atomic for undo/redo.
For undo/redo, drag&drop is recorded as a 2 operations, paste and
delete. This CL makes drag&drop be atomic operation to be properly
undoed/redoed.

Bug: 27268820
Change-Id: Ia38d663f046c2c65f348985934f5cfa054b0437e
2016-03-09 06:07:01 +00:00
Brian Carlstrom
5841fc7650 frameworks/base: Remove unnecessary core-tests dependency
Bug: 27555885
Change-Id: I84cb853c37efbf89d55105a863c40b4074ecf814
2016-03-08 22:00:55 -08:00
George Mount
d1631dcd2e Merge "Add test for Transition clone." into nyc-dev 2016-03-08 21:03:36 +00:00
George Mount
bf7c3b4fa6 Add test for Transition clone.
Change-Id: Ib95fa88a0951c680079bda5be19496be70ce75b1
2016-03-08 12:55:17 -08:00
Tony Mantler
ad43160b65 Merge "Add hidden slide fraction call to Slide" into nyc-dev 2016-03-08 16:53:58 +00:00
Tony Mantler
cfa15bd1d5 Add hidden slide fraction call to Slide
b/27460758

Change-Id: I936ce1c0ece24dd6a9e1c546f0bf261b37ba97c1
2016-03-07 14:48:16 -08:00
Seigo Nonaka
0ebc68a0e2 Merge "Introduce script matching for enabling default IME subtypes." into nyc-dev 2016-03-07 21:28:54 +00:00
Seigo Nonaka
072a95a309 Introduce script matching for enabling default IME subtypes.
This is 2nd attempt of I5bb1bd8cdb9096d516d60beb9936e55bf2b757ae

The motivation of this CL is enhance the default IME subtype enabling
algorithm.  The new approach is done by score based algorithm.  The
design of the matching score is determined as follows:
- The matching score for the each two locale is up to 3 and determined
  as follows:
  - Score of 3 : matches all language, script and country.
  - Score of 2 : matches the language and script.
  - Score of 1 : matches the language regardless of country.
  - Score of 0 : doesn't match the language regardless of script and
                 country.
- All locales are fully expanded before matching by addLikelySubtags in
  ICU.

Bug: 27129703
Bug: 27348943
Change-Id: I8fc774154f5175abff2f16e8f12a4847bf5f5b7c
2016-03-07 11:50:30 -08:00
Philip P. Moltmann
66c96591e2 Add "app printer activity" and always keep the print service state
updated. Also fiddle with the UI to use more standard values.

To be sure the print service state alwasy updated I changed
PrintManager.getPrintServices to return a loader which just wraps a
registerListener/getList/removeListener combo.

I also added a new function to enabled/disable a print service to be
keep all updating logic inside the PrintManagerService->UserState.

Then I changed all code to use this new interface.

Detailed comments:

PrintServiceInfo:
- I had to add the enabled state to the PrintServiceInfo as some users
  of PrintManager.getPrintServices want all services but then display
  different data depending on the enabled state. Of course I could have
  created two PrintManager.getPrintServices-loaders to load the two
  separate list of services. I think it is much easier to add this
  property though. It is updated every time new data is returned to the
  PrintManager.getPrintServices-loader.

AddPrinterActivity:
- This is shown as a dialog-style overlay to indicate that the user will
  return to the select-printers activity. It contains of three list that
  are updated via separate loaders.
- The recommended services will be added later to keep this path set
  small.

PrintActivity:
- There are two small places where we have to update the data when we
  get a new list of print services.
  - In very, very rare conditions it can happen that the print service
    of the current printer gains or looses the "advancedOptions"
    activity
  - If we have no enabled print services we want to show "Add printer"
    instead of "All printers...".
- Also the print registry is not the only loader anymore, hence we have
  to assign loader ids to it to not conflict with the other loaders in
  this activity.
- Small bug in onPrintersChanged: If a printer is selected and the print
  service of this printer gets disabled the holder goes into "removed"
  state which disables the printer. When the print service is then
  enabled again, we forgot to re-enable the holder.

PrinterRegistry:
- The registry assumed that the FusedPrinterProvider was the only loader
  in the activity. This is not true anymore, hence it has to assign the
  appropriate loader ids.
- The FusedPrinterProvider has an internal loader, hence we have to
  forward a loader Id into it.
- The PrintRegistry is only called backed for a single loader, hence no
  need to check the loader-id.

SelectPrinterActivity:
- The AddPrinterDialog was removed as we now have the
  AddPrinterActivity.
- Added a loader for the enabled services to update the empty state.
- Added dedicated loader Id for the PrinterRegistry again.
- If we have no enabled services, the SelectPrinterActivity chainloads
  the AddPrinterActivity as this is the only thing the user can do
  anyway. "Save a click". This should only happen when the activity is
  create the first time.
- Moved the "add printer" from the menu item to the list of printers as
  suggested by UX and Zach.

PrintManagerService, UserState and IPrintManagerParamtersTest:
- As the only place where the print service state is updated is now the
  userstate, we have no more sychronization problems. Whohoo.
- The users can now register for changes to the print services similar
  as they can register for changes to the print jobs.
- UserState.getPrintServices is the only function can exposes any
  knowledge of the print services to the outside world.

Change-Id: I9be2c7300431e06aaff9bdf7eb36120d869b56ac
2016-03-07 09:58:08 -08:00
Yohei Yukawa
77dd59fc2a Revert "Introduce script matching for enabling default IME subtypes."
This reverts commit 9e7a1c9824cffca32fd7d58bb13bd3416ab32091.

Seems that that CL causes ArrayIndexOutOfBoundsException when
initializing InputMethodManagerService, which results in an infinite
boot animation.

Bug: 27129703
Bug: 27348943
Change-Id: I474a87876670ac018c675ac7b4608e90fbb2434b
2016-03-05 21:46:20 -08:00
Seigo Nonaka
9e7a1c9824 Introduce script matching for enabling default IME subtypes.
The motivation of this CL is enhance the default IME subtype enabling
algorithm.  The new approach is done by score based algorithm.  The
design of the matching score is determined as follows:
- The matching score for the each two locale is up to 3 and determined
  as follows:
  - Score of 3 : matches all language, script and country.
  - Score of 2 : matches the language and script.
  - Score of 1 : matches the language regardless of country.
  - Score of 0 : doesn't match the language regardless of script and
                 country.
- All locales are fully expanded before matching by addLikelySubtags in
  ICU.

Bug: 27129703
Change-Id: I5bb1bd8cdb9096d516d60beb9936e55bf2b757ae
2016-03-05 18:52:59 -08:00
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
Doris Liu
40428c8dc2 Testing initial value for 0-duration animations
To ensure consistency with the pre-N animation behavior, we are testing
the following:

- For animations that have a duration of 0, we set the animator's value
  to the end value when start() is called.
- For animations with a duration > 0 but with the duration scale of 0
  applied, we set the animator's value to its start value when start()
  gets called.

Change-Id: I666105e0677c6cfdeddb11b483d71dab978adc11
2016-02-26 03:24:41 +00: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