Minikin already supports multiple languages specified per font in
I7f13b51464c9b01982bb573251d77052b9ddbd70. This CL adds a couple of
such cases into fonts.xml and clarifies in the method and the
variable names and parameters that the frameworks is handling a
multi-language string when it is.
Fixes: 26687969
Test: make -j checkbuild
Test: bit FrameworksCoreTests:android.graphics.TypefaceSystemFallbackTest
Change-Id: Ifa540a95f87921983f9069330d1dd0892538a8df
In order to generate the Smart Select animation, we need a list of
rectangles which represent a given selection. The current
getSelectionPath code can only fill out a Path, which loses the
rectangle information in the process.
Instead of working directly with a Path, a RectangleConsumer is
introduced, which is an abstraction over an element that can accept
rectangles (for example, a Path or a List<Rect>).
getSelectionPath is now implemented with this new method using a simple
consumer which takes the rectangles and feeds them to the path.
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -d -t android.widget.cts.TextViewTest#testGetFocusedRect
Test: manual - verify text selection still works
Change-Id: I32a24f237a4b1b89df23c982fe06566f30fec464
This method is needed in settings to avoid code duplication.
Add a test to verify that is24HourLocale does not take the 12/24h clock
system setting into account.
Bug: 32761619
Test: bit CtsTextTestCases:android.text.format.cts.DateFormatTest
Test: adb shell am instrument -w -e class android.text.format.DateFormatTest \
com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I21a871c11149550c7cf91aea299724a8b4fbff78
Previously, Layout would modify the HyphenEdit of the Paint passed to it
for its internal operations, potentially leaving the Paint in a different status than when
it was created. Now we use an internal copy of the Paint to modify.
Fixes: 64452136
Test: bit CtsTextTestCases:android.text.cts.
Test: bit FrameworksCoreTests:android.text.
Change-Id: I0b95a10c05711350950d6c8d6501f6af9414d413
Bug: 64269689
Test: m checkbuild
Test: bit CtsGraphicsTestCases:*
Test: bit CtsViewTestCases:*
Test: bit CtsTextTestCases:*
Change-Id: Idc9f2b4612741be949204cd06efc41e1738d6587
This fixes the cases where the replacement of parts of text with
ellipsis may result in more-than-expected width of text due to
contextual width changes in the font, such as kerning or Arabic
shaping.
The calculations in TextUtils.ellipsize() and StaticLayout are fixed
to recalculate the new width and reduce it further until the text
actuall fits. BoringLayout and DynamicLayout get fixed too since
they use the other two implementations indirectly.
Also reverse a recently-introduced incorrect check for
multi-character ellipsis in Layout.java.
Fixes: 31537595
Fixes: 64156587
Test: Manual (Arabic edge cases ellipsize correctly)
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Iaddcc8b01c78d477e2c29b339d321c9631426f34
StaticLayout.mEllipsized and mMaxLineHeight was set for proper
calculation of static ellipsized text height. However, since
DynamicLayout uses a static instance of StaticLayout, and nobody reset
the mEllipsized, this caused configuration discrepancies for different
DynamicLayout instances.
Test: bit -t CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit -t CtsTextTestCases:android.text.cts.StaticLayoutTest
Fixes: 64372088
Bug: 64312574
Change-Id: I8ea6697d29da2ccbb433b64f17b4d1d6f254e8e1
Previously, measures all paragraph for deciding view width.
However, in case AT_MOST measurment, we can stop calculating measure if
the measured paragraph already exceeds the upper limit.
Bug: 64389125
Test: bit CtsWidgetTestCases:*
Test: CorePerfTest. Here is a result before and after this patch.
Before:
INSTRUMENTATION_STATUS: measure_AtMost_median=50332114
INSTRUMENTATION_STATUS: measure_Exactly_median=28276317
INSTRUMENTATION_STATUS: measure_Unspecified_median=50193036
After:
INSTRUMENTATION_STATUS: measure_AtMost_median=28475187
INSTRUMENTATION_STATUS: measure_Exactly_median=26944710
INSTRUMENTATION_STATUS: measure_Unspecified_median=50880088
Change-Id: I2a39eb39817a8f845c4fa2e174a905a2d057096e
Reverse a recently-introduced incorrect check for multi-character
ellipsis in Layout.java. The check was introduced in
Id1dfdc503f87fabed2447d55ab2107eee0eccd08.
Test: bit CtsTextTestCases:*
Test: bit FrameworksCoreTests:android.text.
Change-Id: I79198be0bd202a303f8db02a235c2af3b76abf32
In I021ff2a97a60396fb1b6e4940d91d3cd6ccb6196, new API for
InputFilter.AllCaps was added. It accepted null as input. This CL
changes that so null locales would be rejected.
Test: bit CtsTextTestCases:android.text.cts.InputFilter_AllCapsTest
Fixes: 64261334
Bug: 37222101
Change-Id: Ic87942c3f341f71bc3c1c833b52ea3e751461e47
This fixes the cases where the replacement of parts of text with
ellipsis may result in more-than-expected width of text due to
contextual width changes in the font, such as kerning or Arabic
shaping.
The calculations in TextUtils.ellipsize() and StaticLayout are fixed
to recalculate the new width and reduce it further until the text
actuall fits. BoringLayout and DynamicLayout get fixed too since
they use the other two implementations indirectly.
Also reverse a recently-introduced incorrect check for
multi-character ellipsis in Layout.java.
Fixes: 31537595
Fixes: 64156587
Test: Manual (Arabic edge cases ellipsize correctly)
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: bit FrameworksCoreTests:android.text.
Test: adb shell am instrument -w com.android.documentsui.tests/android.support.test.runner.AndroidJUnitRunner
Change-Id: I74fdaa9bf32dc2064eeb702f7f9b78b2bb856c26
StaticLayout did not work as expected when there is a line ending with
'\n'. For those cases it would calculate 2 lines, but would
discard line spacing for both of them. This CL fixed that issue. Also
DynamicLayout asks StaticLayout not to add line spacing for the last
line of the text.
Test: Manual/Visual test
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutTextMeasuringTest
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Test: bit -t FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit -t FrameworksCoreTests:android.text.DynamicLayoutBlocksTest
Test: bit -t FrameworksCoreTests:android.widget.TextViewTest
Test: bit -t FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit -t CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit -t CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit -t CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit -t CtsWidgetTestCases:android.widget.cts.EditTextTest
Bug: 25194907
Change-Id: I0d901ecf768b25faea156b73097541da4b93d6d0
Resources.getFont may load other package's font. Stop loading font
resources unless the developer allowed to do so.
Bug: 64115349
Bug: 35763094
Bug: 62813533
Test: bit CtsTextTestCases:android.text.style.cts.TextAppearanceSpanTest
Change-Id: Ifa1b57a70650ba086b38407c0ed5b4048983e7e5
This fixes the cases where the replacement of parts of text with
ellipsis may result in more-than-expected width of text due to
contextual width changes in the font, such as kerning or Arabic
shaping.
The calculations in TextUtils.ellipsize() and StaticLayout are fixed
to recalculate the new width and reduce it further until the text
actuall fits. BoringLayout and DynamicLayout get fixed too since
they use the other two implementations indirectly.
Also reverse a recently-introduced incorrect check for
multi-character ellipsis in Layout.java.
Fixes: 31537595
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: FrameworksCoreTests:android.text.
Change-Id: I3532820e12ac45a46e28fe2f8bb17dcd0a345916
DynamicLayout did not include the line spacing for the newly added
lines. This CL updates StaticLayout with a parameter to force addition
of line spacing to the last line, and updates DynamicLayout to use this
parameter. With this change the last line will have the line spacing
applied, and it will provide a consistent UX.
Test: Manual/Visual test
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutTextMeasuringTest
Test: bit -t FrameworksCoreTests:android.text.StaticLayoutLineBreakingTest
Test: bit -t FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit -t FrameworksCoreTests:android.text.DynamicLayoutBlocksTest
Test: bit -t CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit -t CtsTextTestCases:android.text.cts.DynamicLayoutTest
Bug: 25194907
Change-Id: I52497fbd108538729758e842072f3ce87c6bbfdd
This reverts commit 0d253e46aa.
The original CL changed Typeface internal methods and broke
TypefaceCompatApi26Impl in support library which uses reflections.
Ideally, TypefaceCompatApi26Impl must fall back to public API
implementation but due to lack of method availability check, it ended up
crashing the application.
The original patch didn't change any behaviors in MR1, so reverting
that change is the best solution for MR1.
Bug: 64033594
Change-Id: Ie86afeb1b809e57915d62c1db5a70c8d210d2354
Test: N/A
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Test: bit FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Bug: 30870806
Change-Id: I54f014b06af328c3e9a9c4ddb5a3348a26e290c2
mLineDirections variable needs to keep a Directions object for each line
of text. Therefore at any time array of line count is required. However
currently mLineDirections is initialized and grown in the size of mLines
array, which makes the size around mColumns*line count.
This CL removes that extra allocation.
Test: Manual test to check if device boots and displays
Test: bit -t CtsTextTestCases:*
Test: bit -t FrameworksCoreTests:android.text.
Test: bit -t FrameworksCoreTests:android.widget.TextViewTest
Test: bit -t FrameworksCoreTests:android.widget.EditorCursorTest
Test: bit -t CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit -t CtsWidgetTestCases:android.widget.cts.EditTextTest
Bug: 64038460
Bug: 62889232
Change-Id: If9bda040b98efcf16c3cdcba5bc27667775ce1fc
StaticLayout and Dynamic layout changes the values of line bottom and
descent according to linespacing modification attributes. This loses
information of the real line descent and bottom, which causes some
utilities not to be able to draw themselves in correct positions.
Examples are cursor drawing to the empty space, BulletSpan not being
able to vertically center itself in the line, and DynamicLayout not
being able to calculate the last line height properly.
This CL stores the extra added to bottom and descent values so that it
can be used later.
Test: bit CtsTextTestCases:android.text.cts.LayoutTest
Test: bit CtsTextTestCases:android.text.cts.StaticLayoutTest
Test: bit CtsTextTestCases:android.text.cts.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.LayoutTest
Test: bit FrameworksCoreTests:android.text.StaticLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutTest
Test: bit FrameworksCoreTests:android.text.DynamicLayoutBlocksTest
Bug: 30870806
Bug: 33138492
Bug: 25194907
Change-Id: I7a1039e71e4999c75b5f26122fe6239e3ee24868
Mostly changed to avoid repetition of code and remove the assumptions
about ellipsis being one code unit. The code for multi-code unit
ellipsis is not triggered yet, but is done in preparation for
potential future locale-dependent cases.
Test: bit CtsTextTestCases:*
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.AutoCompleteTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.MultiAutoCompleteTextViewTest
Test: adb shell am instrument -w -e package android.text com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Change-Id: Id1dfdc503f87fabed2447d55ab2107eee0eccd08
Added documentation to clarify what happens in the case of null or
empty arguments.
Change-Id: I694dc0f6a6d95ab6ca7ed95b51d81938618eb75f
Fixes: 36861796
Test: bit CtsTextTestCases:*
Test: bit CtsGraphicsTestCases:android.graphics.cts.FontVariationAxisTest
To be able to parcel/unparcel Typeface, keep it in static context.
Bug: 62850669
Test: Manually done
Test: bit CtsTextTestCases:android.text.style.cts.TextAppearanceSpanTest
Change-Id: I408cd33b98d8bb13776560231d1eeaac0a7c6bf8
(cherry picked from commit c49ee3bde9)