Commit Graph

653 Commits

Author SHA1 Message Date
Chet Haase
a0364e2360 Merge "Fix infinite recursion in hashcode of Spannables" into klp-dev 2013-10-04 22:12:09 +00:00
Chet Haase
1d3c4b396a Fix infinite recursion in hashcode of Spannables
An app created a SpannableStringBuilder, one of which's spans was the
instance of the string builder itself (that is, the builder contained a span
that was the builder). This caused infinite recursion in the hashcode()
method because it computes a hash from its fields, including all of its spans.

The fix detects the case where a span equals the current instance and
noops the computation on that span. A similar adjustment was made to equals()
to avoid the same recursion problem.

Issue #11051658 StackOverflowError in android.text.SpannableStringBuilder.hashCode

Change-Id: I742687ab32d81ac51c4b9135f698cf5e96a1d295
2013-10-04 07:24:19 -07:00
Raph Levien
63b3eb6523 Fix Text appears on top of existing text when composing in gmail.
Fix for bug 6473708. This patch changes from "last update wins" to
merging together the change regions, in the logic of deciding which
blocks need to be updated for painting, so that when there are multiple
changes batched for a draw, they're all taken into account.

Change-Id: I183d453c436125e5efec7031b4d61b43989653f9
2013-10-03 14:28:54 -07:00
Raph Levien
7c1b10872f Merge "Fix for "Can't place cursor after combining accent"" into klp-dev 2013-09-20 23:27:57 +00:00
Raph Levien
373b7a8d4e Fix for "Can't place cursor after combining accent"
This patch fixes behavior where attempting to place the cursor at
the end of a string where the last character is a combining accent
actually placed it before that accent. This was especially annoying
for editing Thai text, because it made it difficult to delete a
trailing tone mark.

Fixes bug 8947569 "Can't place cursor after combining accent" and bug
10398332 "[Thailand] Thai Language(IME) -- Can't delete Thai tone mark
while writing message"

Change-Id: Ida1933c8f0ab6cdb0200db39891e9389e4bdba86
2013-09-20 15:21:47 -07:00
Chet Haase
9b985721da Add equals() and hashcode() to SpannableString
ActionBar uses a transition to animate text changes. This transition
depends on testing the equality of start/end text values in CharSequence
objects. Without equals(), SpannableString will return false for objects
whose references are different, but whose text is exactly the same.

This CL adds the equals() method, and the accompanying hashcode method,
to ensure that two Spanned implementations will always be equal
if their text and span data are equal.

Issue #10760075 Wrong unread count in actionbar

Change-Id: I5e77d40dd302eca035e8c56d40f3cd0aef8e6424
2013-09-19 17:18:55 -07:00
Raph Levien
14f10e5d5f Revert "Revert "Take the input device into account for meta state""
This reverts commit 3954fd9a05, which
is equivalent to re-applying 8a1597b396.

The change ("Take the input device into account for meta state") was
valid but caused CTS test failures because the test was wrong. The
test injected a key event with the meta state missing. This faulty
test was masked by the old toggle behavior.
2013-09-18 13:01:11 -07:00
Raph Levien
3954fd9a05 Revert "Take the input device into account for meta state"
This reverts commit 8a1597b396. That
commit broke some of the handling of meta state, which in turn caused
CTS test failures, notably bug 10210151 (CTS:
android.text.method.cts.BaseKeyListenerTest#testBackspace_withSendKeys
is failing on KLP).

So this revert fixes those test failures, but leaves bug 8303489
(Pressing shift on the hardware keyboard messes with unrelated
keypresses, including virtual ones) still present. We'll plan to
address that in a future release.

Change-Id: Iea42c643b6d08f33cbd2ed1747e8de3b5f8116a6
2013-09-18 11:03:02 -07:00
Raph Levien
68669a42fb Fix for AIOBE at android.text.AndroidBidi.directions
This fixes bug 9900288: Multiple apps crashing; AIOBE at
android.text.AndroidBidi.directions.

The AndroidBidi.directions() method was not correctly handling the case
of a run of length 0, causing ArrayIndexOutOfBoundsException. This
patch simply avoids accessing the levels array in that case.

Change-Id: I036a85b7792ea3364725a87033ca74b94f0e93a1
2013-09-12 16:21:39 -07:00
Elliott Hughes
f9818d33f9 Fix NPE in DateFormat.is24HourFormat.
In some cases, we end up being called by code that doesn't have a valid
Context. It got away with this historically because it wasn't formatting
times (just dates), so it never went down a path that tried to query the
user's 12/24-hour preference. This patch just ensures that we don't try
to get the preference unless we actually need it.

Bug: 10339015

(cherry picked from commit 8d8ef00c82)

Change-Id: If074a67fa52943c0ec7bb5c5bbe5a11f54fb1f97
2013-08-16 14:53:26 -07:00
Elliott Hughes
12285f3d9f DateUtils should use the user's 12/24-hour preference, not the locale's.
Bug: 10312832

(cherry picked from commit f0b79aeed3)

Change-Id: I0d78725d47009553f9003ccfba06f70f178a6ec1
2013-08-14 15:27:17 -07:00
Amith Yamasani
d8415f4bf0 Developer option to force RTL layout
Make sure screen layout changes are taken into account in Configuration diffs.
Initialize the SystemProperty from Global settings on startup of
ActivityManagerService.

TextUtils checks the override flag to decide if the default layout direction
should be forced to RTL.

Bug: 10244047
Change-Id: I23a2583d790a355060d0d898ba44e5f7dc896b46
2013-08-08 13:42:02 -07:00
Elliott Hughes
89a8250e24 am 710f3e2c: am 60ae2617: Merge "If frameworks wants ASCII casing, it should explicity ask for it."
* commit '710f3e2cc6bc2cdc2f2cddb2190823ea31efd52a':
  If frameworks wants ASCII casing, it should explicity ask for it.
2013-08-02 17:58:33 -07:00
Elliott Hughes
cb64d43062 If frameworks wants ASCII casing, it should explicity ask for it.
http://elliotth.blogspot.com/2012/01/beware-convenience-methods.html

Bug: https://code.google.com/p/android/issues/detail?id=58359
Change-Id: Iaab02e718a7be7bda22e626dca05d79bfd2a8fc4
2013-08-02 15:12:32 -07:00
Elliott Hughes
efaad3e2c6 resolved conflicts for merge of a35ec14f to master
Change-Id: Ib2eb18fe6df2e404d0bf739b300fc200ca81f539
2013-07-25 10:36:59 -07:00
Elliott Hughes
6139e64cd6 Switch DateUtils.formatDateRange over to an icu4c-based implementation.
Bug: 7289514
Change-Id: Ia382f49aa23737bde91b7891d95545da084ec57c
2013-07-24 14:46:31 -07:00
Fabrice Di Meglio
ff4ea79877 Merge "Fix bug #9073962 - Carret is still on the left with an empty EditText in Arabic Locale" 2013-06-19 22:12:50 +00:00
Fabrice Di Meglio
e631889e1a Fix bug #9073962 - Carret is still on the left with an empty EditText in Arabic Locale
- fix StaticLayout special case with empty string or new line

Change-Id: Icb51feedce49db661ed17b6907eb0db83d0b763c
2013-06-19 14:45:13 -07:00
Scott Main
2887271ff3 am 8303a203: am 94ba190e: am de04dfb6: Merge "some extra docs for TextDirectionHeuristic" into jb-mr2-dev
* commit '8303a2036efd93eecda6da1e481e1659a40ca12e':
  some extra docs for TextDirectionHeuristic
2013-06-17 22:14:28 -07:00
Scott Main
8303a2036e am 94ba190e: am de04dfb6: Merge "some extra docs for TextDirectionHeuristic" into jb-mr2-dev
* commit '94ba190ebbd4fe7f8933d531cce7b4be8e04f287':
  some extra docs for TextDirectionHeuristic
2013-06-17 22:13:17 -07:00
Scott Main
e442662330 some extra docs for TextDirectionHeuristic
Change-Id: I8ceac72a76a29bde0e25ed418110a6e4120654e3
2013-06-17 19:05:29 -07:00
Elliott Hughes
f0542ee466 am 704dfbfe: am 48fa06f3: am f6a67139: Merge "Correct Date format for el_GR, sv_SE and tr_TR locales"
* commit '704dfbfec40b4a51000e244a98e8723bb00ba321':
  Correct Date format for el_GR, sv_SE and tr_TR locales
2013-06-17 13:43:53 -07:00
Elliott Hughes
48fa06f34f am f6a67139: Merge "Correct Date format for el_GR, sv_SE and tr_TR locales"
* commit 'f6a671394ca3d269835d5f5b882b46f9539e9a96':
  Correct Date format for el_GR, sv_SE and tr_TR locales
2013-06-17 13:38:59 -07:00
howardb
5ad2451f9f Correct Date format for el_GR, sv_SE and tr_TR locales
Amend DateFormat.getDateFormat to CLDR data from icu4c
instead of locale specific resource entries which are incorrect
for several locales.

No CTS tests are added as they require changing the locale which
is not currently possible.

Bug: https://code.google.com/p/android/issues/detail?id=56385

Change-Id: Ibd11c7fd9b595e19a3e2bf508e1585aa50067e03
Signed-off-by: howardb <android@howardb.com>
2013-06-17 13:35:29 -07:00
Raph Levien
5d0db65e73 am 38272ad2: am 21403857: Merge "Fix for bug 8911390 RTL text alignment is changed ..." into jb-mr2-dev
* commit '38272ad2b1d3ab90c83fcd74139503fcd3148a19':
  Fix for bug 8911390 RTL text alignment is changed ...
2013-05-15 13:49:46 -07:00
Raph Levien
38272ad2b1 am 21403857: Merge "Fix for bug 8911390 RTL text alignment is changed ..." into jb-mr2-dev
* commit '214038571992a4ba65531297bf4a89af9a0b5fd4':
  Fix for bug 8911390 RTL text alignment is changed ...
2013-05-15 13:35:06 -07:00
Raph Levien
01524651cb Fix for bug 8911390 RTL text alignment is changed ...
The predicate for detecting whether text was right aligned was missing
some cases - it was correctly sensing RIGHT or OPPOSITE aligned text
in the LTR case, but was missing NORMAL for rtl. This patch just adds
that case.

Change-Id: I06691e7122e1ca91d66299cf0d7ef1f8a476a44b
2013-05-14 14:00:07 -07:00
Victoria Lease
176498b5ea Merge "enable selection of Linkify-annotated text" 2013-05-07 18:08:09 +00:00
Elliott Hughes
ba8d2e58f8 am c2639e58: am 0bb4c701: Merge "Use ICU for getDateFormatOrder."
* commit 'c2639e58fa5724c06a1d910ad76aebed647b4ba2':
  Use ICU for getDateFormatOrder.
2013-04-30 12:17:25 -07:00
Elliott Hughes
c2639e58fa am 0bb4c701: Merge "Use ICU for getDateFormatOrder."
* commit '0bb4c701bab0f69172417b7a511acb6bdfa052db':
  Use ICU for getDateFormatOrder.
2013-04-30 12:15:00 -07:00
Elliott Hughes
edd6f9e688 Use ICU for getDateFormatOrder.
Bug: 7207103
Change-Id: I680bb727cb74cd4b050f237f036d9e696201fc0b
2013-04-30 11:09:53 -07:00
Victoria Lease
cd0b01327b enable selection of Linkify-annotated text
Bug: 8515643
Change-Id: I74e8b9e45e2645ec6287abd1cd6e47d383c4f3e0
2013-04-29 14:42:01 -07:00
Fabrice Di Meglio
16cea16570 am b241f60f: am c3d0a81a: Merge "Fix bug #8656546 API REVIEW: android.text.bidi / android.text" into jb-mr2-dev
* commit 'b241f60fe76677d106d472d4118d1e6959563331':
  Fix bug #8656546 API REVIEW: android.text.bidi / android.text
2013-04-20 21:37:04 -07:00
Victoria Lease
a5d3459316 am 7e170b63: am bcf3ec96: Merge "do not attempt to parcel unknown ParcelableSpans" into jb-mr2-dev
* commit '7e170b632147da55f93864223419a9f7fa651410':
  do not attempt to parcel unknown ParcelableSpans
2013-04-20 21:36:55 -07:00
Fabrice Di Meglio
8c08fc9a86 Fix bug #8656546 API REVIEW: android.text.bidi / android.text
- clean BidiFormatter APIs

Change-Id: I8591ce3c3e8f2de4138698aa14ddb38b933de5e1
2013-04-19 17:34:01 -07:00
Victoria Lease
577ba5354b do not attempt to parcel unknown ParcelableSpans
Bug: 8639983
Change-Id: I27335f6e9d3a0671ecdd161fdbf765785ef8065d
2013-04-19 13:38:34 -07:00
Fabrice Di Meglio
98c8c890aa am 4febbf35: am bd286426: Merge "Fix bug #8599905 Add simple BidiFormatter getInstance() helper API" into jb-mr2-dev
* commit '4febbf35011ecb30796c78cf3e159ef781564f45':
  Fix bug #8599905 Add simple BidiFormatter getInstance() helper API
2013-04-11 17:50:26 -07:00
Fabrice Di Meglio
cd5af79bf9 Fix bug #8599905 Add simple BidiFormatter getInstance() helper API
Change-Id: I85ff074904025c724409ccc52bc82a1fd23803de
2013-04-11 16:25:21 -07:00
Victoria Lease
9bd9404383 am 1e2c967b: am 8712e4cc: Merge "use libphonenumber for Linkify.PHONE_NUMBER" into jb-mr2-dev
* commit '1e2c967b16afc0750d9d00fbaed8e2175937e1f4':
  use libphonenumber for Linkify.PHONE_NUMBER
2013-04-04 07:50:49 -07:00
Victoria Lease
8712e4cc4a Merge "use libphonenumber for Linkify.PHONE_NUMBER" into jb-mr2-dev 2013-04-04 14:40:52 +00:00
Victoria Lease
430fc97e7e use libphonenumber for Linkify.PHONE_NUMBER
This commit replaces a regex pattern match for Linkify.PHONE_NUMBER
with a call to libphonenumber's PhoneNumberUtil.findNumbers().

Bug: 5533245
Change-Id: I0e0563b241fb62e77d7f49e4a8484c6b0685dd8f
2013-04-04 07:38:24 -07:00
Elliott Hughes
435d11205a am 11139563: am dbca824d: Merge "Add DateFormat.getBestDateTimePattern." into jb-mr2-dev
* commit '1113956349e25bd081590842ec6f6b300765d786':
  Add DateFormat.getBestDateTimePattern.
2013-04-02 12:25:35 -07:00
Elliott Hughes
031b581af2 Add DateFormat.getBestDateTimePattern.
Bug: 8283323
Change-Id: Id8d94456b93555d799229b7dd88fcbcf5c6bf7ff
2013-04-02 12:00:47 -07:00
Raph Levien
85973db79d am 0a914107: am 8fed6bc8: Merge "Make zero width space a line breaker" into jb-mr2-dev
* commit '0a914107205981a8baa079736c959ea9abedbf50':
  Make zero width space a line breaker
2013-03-29 14:34:46 -07:00
Raph Levien
8fed6bc894 Merge "Make zero width space a line breaker" into jb-mr2-dev 2013-03-29 16:58:33 +00:00
Raph Levien
8d087c349f Make zero width space a line breaker
This patch makes ZWSP (U+200B, zero width space) a potential line break
in text layouts. This is a fix for bug 8501809.

Change-Id: I18c1f8464e6c821ff75f819141bacc714a878700
2013-03-29 09:25:48 -07:00
Elliott Hughes
4818dbab51 am 08dbf6a8: am 82718153: am 6f14ef70: am 083bfa5a: Merge "Remove dead DateUtils code that was never in an API level."
* commit '08dbf6a88a95771465a3b16c7a1925f36465ed1d':
  Remove dead DateUtils code that was never in an API level.
2013-03-26 16:58:08 -07:00
Elliott Hughes
827181538c am 6f14ef70: am 083bfa5a: Merge "Remove dead DateUtils code that was never in an API level."
* commit '6f14ef70664d13295ffca524fb0b08365351b1f7':
  Remove dead DateUtils code that was never in an API level.
2013-03-26 16:51:10 -07:00
Elliott Hughes
fbf37c79bd Remove dead DateUtils code that was never in an API level.
Also rewrite @deprecated comments to use an initial capital so they
look right in the generated documentation.

Also improve formatIpAddress documentation.

Change-Id: I317ebe411ef76e16a4535318ce73e00b63af38da
2013-03-26 15:11:28 -07:00
Fabrice Di Meglio
3807312e9b am 0bcec06b: am 19eceaad: Merge "Fix bug #8437358 Clean any ICU related code from TextLayout / Paint and their dependencies" into jb-mr2-dev
* commit '0bcec06b24e7bc67ab4922f6bb18e6bc7737ba69':
  Fix bug #8437358 Clean any ICU related code from TextLayout / Paint and their dependencies
2013-03-20 22:32:45 +00:00