Commit Graph

7420 Commits

Author SHA1 Message Date
Abodunrinwa Toki
98d3f0a820 Improve starting offset calculation
The previous implementation did not take into account the various
expansions that happen for OVERSHOOT and LEFT and RIGHT rectangles, thus
causing the initial shape to be an oval instead of a circle.

Test: manual - triggered smart select and verified that the intial shape
is a circle under the touch point for both single line and multiline
scenarios

Change-Id: I75175bc3972db3f0608ef364109e0571268da4af
2017-10-06 17:31:16 +01:00
Andrei Stingaceanu
060b3d7b5c [Magnifier - 2] Turn magnifier ON
Flip the flag for turning ON the magnifier attached
to Editor's handles.

Bug: 66657373
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I644c2b834a0c630e5a84a0b948b8667ea988eea6
2017-10-04 11:27:08 +01:00
Andrei Stingaceanu
6c591dd3c3 Merge "[Magnifier - 1] Initial implementation and wiring" 2017-10-04 09:38:53 +00:00
Roozbeh Pournader
e06eebf480 Rename mCursorDrawble to mDrawableForCursor
To go around app bugs caused by assuming that mCursorDrawable is an
array. The apps try to manipulate mCursorDrawable by using
reflection, but crash since they access it incorrectly after it
changed from an array to a single Drawable in
I249befaf70630bef435c8db9039e8aacf233bf7c.

Bug: 66988832
Test: mmm -j frameworks/base
Change-Id: I04fc930d786dd4c74b560d7a25d17353f49ea25b
2017-10-03 12:13:46 -07:00
Andrei Stingaceanu
d2eadfa4b1 [Magnifier - 1] Initial implementation and wiring
* implementation of a magnifier which can be attached to any view
* important APIs:
** show(float centerXOnScreen, float centerYOnScreen, float scale)
** dismiss()
* smart offset => shows below if there is no space above
* controlled by boolean flag (easy to turn off)
* attached the magnifier to Editor's handles
* vertically snaps to the middle of the line containing the
  selection
* horizontally snaps to the offset of the character where
  the selection starts/ends

Bug: 66657373
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I1d4616b8bb1210d869ac47dca137ea9636355250
2017-10-03 16:45:54 +01:00
TreeHugger Robot
d96b97b855 Merge "Do not draw rectangles with the same left and right boundaries" 2017-09-29 21:05:46 +00:00
Petar Šegina
c1950a0052 Do not draw rectangles with the same left and right boundaries
These should not be drawn at all, but the expansion logic for OVERSHOOT
and LEFT and RIGHT rectangles will expand the rectangle into something
that gets drawn.

Test: manual - triggered smart selection and verified that rectangles on
non-primary lines do not get prematurely shown

Change-Id: I5235e4b214401e6ceee3f07bc5cc937907c261ba
2017-09-29 18:39:40 +01:00
TreeHugger Robot
7d208271e5 Merge "Invert the animation over RTL selections" 2017-09-29 15:04:53 +00:00
Abodunrinwa Toki
cbf064d3bc Merge "Increase the duration allowed for a TC result." 2017-09-29 14:21:32 +00:00
Petar Šegina
7c8196f1dc Invert the animation over RTL selections
When smart select is performed over right-to-left text (either
standalone or mixed with left-to-right text), the animation should flow
in from the opposite side than what it does over left-to-right text.

Test: manual - verify smart select still works
Test: manual - manually set the layout flags to RTL and verify the
animation behaves as expected
Test: bit FrameworksCoreTests:android.widget.SelectionActionModeHelperTest

Change-Id: I2e7766e7dfe74e0861e91fc50b061da74432aee0
2017-09-28 20:06:32 +01:00
TreeHugger Robot
0debe0b7f5 Merge "Replace stream operation with simple iteration" 2017-09-28 18:43:56 +00:00
Petar Šegina
59c41b2323 Merge "Fix clip expansion amount" 2017-09-28 16:17:30 +00:00
Petar Šegina
df2ff2bbf4 Merge "Do not specify the unchecked exception in the method signature" 2017-09-28 16:14:29 +00:00
Petar Šegina
18f3c3820f Do not specify the unchecked exception in the method signature
Test: manual - compile the framework to verify everything still works
Change-Id: Ifa69f824fcaa78c62f9be9bb9c281d2bf2716995
2017-09-27 20:27:24 +01:00
TreeHugger Robot
c014a7f1fb Merge "Simplifying writeToParcel for various actions" 2017-09-27 19:18:18 +00:00
Petar Šegina
cb2fdb8bb2 Replace stream operation with simple iteration
Although the stream approach is elegant, we already have a simple loop
iterating over the rectangles which we can reuse for finding the
starting rectangle and save the overhead of the stream / additional
iteration over the rectangles.

Test: manual - verify smart select still works
Change-Id: I4e4195ded4268a7c18ad1b0bc352a9c273396932
2017-09-27 20:18:03 +01:00
Abodunrinwa Toki
3521f3f430 Increase the duration allowed for a TC result.
Increase the duration allowed for a TextClassifier (TC) result when
it is being initialized for the first time.
Initialization typically takes more time that other calls to the TC.
A timeout during initialization means the user doesn't see the
effect of running the TC the first time. Subsequent calls typically
work fine as they're less likely to timeout.
We increase this value only slightly because we don't want the user
waiting too long for a slow TC's result. Finding the right balance
is an art and most likely depends on the TC being used.

Note that although a TextView's TC can change for each individual
call to the TC, such a situation does not benefit from the bump in
the timeout. Again, we really want to discourage larger timeouts.

Bug: 66217281
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Manual test:
  - Delayed TextClassifier response by about 150ms (allowing only 50ms for initialization)
  - Before cl: Sometimes the result is not shown to the user the
    first time the textclassifier runs
  - After cl: Results consistently show for even for first
    textclassifier call
Change-Id: Iabc8279fa57ef6a9a2db0c7e9c7e3ab8c131bf02
2017-09-27 17:16:51 +01:00
Sunny Goyal
5b15392c9a Simplifying writeToParcel for various actions
> Using helper methods when writing and reading typed objects
> Moving the tag write outside the action, as it is read outside
  the action as well
> Removing usused tags

Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 65574108
Change-Id: Iaf51cae6ef9f82b70dc1f19c2f019af40c4424a2
2017-09-27 08:52:30 -07:00
TreeHugger Robot
6e408b2ad1 Merge "Fix crash due to TextView.getText() returning null." 2017-09-27 11:54:12 +00:00
Abodunrinwa Toki
7c1e425838 Fix crash due to TextView.getText() returning null.
This CL ensures that a null text is not passed to
TextClassificationHelper.reset(...)

This CL does not handle the issue of TextView.getText() being null.

Bug: 65682674
Test: none
Change-Id: Id8bdc062ecf21cc14810586580fef9052672cfd8
2017-09-26 20:09:06 +01:00
Sunny Goyal
0ebf88133a Fixing wrong actions were written to parcel when copying
Bug: 66901470
Test: Manual and CTS
Change-Id: I292e0e7d890d4da522045f434982aeeae35eb0fe
2017-09-26 16:44:12 +00:00
Petar Šegina
47f148564d Fix clip expansion amount
The clipping rectangle needs to be expanded in order to cover the
content drawn by the stroke. Since half the stroke is drawn on one side
of the bounding rectangle and the other half on the other side, we need
to expand the clip by half of the stroke width.

The previous implementation expanded the clipping rectangle by the whole
stroke width, this allowed for a part of the rounded rectangle to draw
outside of the bounding box.

Test: manual - verify smart select still works and that the rounded
rectangle does not draw outside of the bounding box

Change-Id: I8ca80b7b224d1ac2aa7638405b3cf516bd04b39f
2017-09-26 11:19:30 +01:00
Svet Ganov
c2840f9f9f Merge "Hide autofill popup if anchor removed" into oc-mr1-dev am: 8e5e30c5eb
am: 89934be670

Change-Id: Idc925398f0b28ffe7220634cd9b74fba22de7278
2017-09-25 22:41:17 +00:00
TreeHugger Robot
8e5e30c5eb Merge "Hide autofill popup if anchor removed" into oc-mr1-dev 2017-09-25 22:24:25 +00:00
Jan Althaus
6b8cbb99a4 Merge "Fixing session abandon logging bug" into oc-mr1-dev am: 4fce88dd4d
am: c7812f0fa5

Change-Id: I57abb3d7f4bce7cdda696b57f65475c02ac3b498
2017-09-25 16:03:31 +00:00
Jan Althaus
b3513a130d Fixing session abandon logging bug
Previously, making two selections quickly one after the other could lead
to the first session missing the terminal event, and the second one getting
terminated prematurely - getting marked incorrectly as abandoned.

Bug: 64914512
Test: Manually tested that logs are correct.
Change-Id: Icd75dcabe707b591f30629b9b9b42c5459ed7dda
2017-09-25 10:37:24 +02:00
Svet Ganov
77150c5fbb Hide autofill popup if anchor removed
Test: Manual
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

bug:64601372

Change-Id: Ic55dabb99cd5015d318ab3be1231b6aa5c67294e
2017-09-23 10:13:06 -07:00
TreeHugger Robot
e3c34ce400 Merge "Switch version gate for fallback linespacing to P" 2017-09-21 22:08:02 +00:00
TreeHugger Robot
a762cae719 Merge "Preventing data overwirte in a Parcel" 2017-09-21 20:24:59 +00:00
Roozbeh Pournader
60f555cca8 Switch version gate for fallback linespacing to P
Previously, no version was defined for Android P. Now that
I0a90033239081c583b10021cbc06d032e206beb4 defines it, we can switch
the version gate on the new fallback-based linespacing behavior of
TextView and Switch to it.

Test: bit CtsWidgetTestCases:android.widget.cts.CheckedTextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: bit CtsWidgetTestCases:android.widget.cts.SwitchTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewTest
Change-Id: Id68ea4b26baa8a632d9f516083a73a0b8879513f
Fixes: 64648475
2017-09-21 12:54:55 -07:00
Sunny Goyal
5b7689f287 Preventing data overwirte in a Parcel
Test: am instrument -w -e class android.widget.RemoteViewsTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 65576228
Change-Id: Ia1f072c1451eba3c6c13833c5a813e754df901e2
2017-09-21 11:32:13 -07:00
Alan Viverette
dda510800a Merge "Handle null left and right tab strip drawables" into oc-mr1-dev am: 286c7db342
am: 7dbf5b032b

Change-Id: I5c3f616276f1f68a134c48f886cc43d282400415
2017-09-21 01:46:55 +00:00
TreeHugger Robot
286c7db342 Merge "Handle null left and right tab strip drawables" into oc-mr1-dev 2017-09-20 13:59:05 +00:00
TreeHugger Robot
d4f7c5bc19 Merge "ActivityOptions.set/getLaunchStackId() be gone!" 2017-09-20 00:09:09 +00:00
Wale Ogunwale
0568aed2af ActivityOptions.set/getLaunchStackId() be gone!
Removed ActivityOptions.set/getLaunchStackId() and replacement
ActivityOptions.set/getWindowingMode() and set/getActivityType()

Test: Existing tests pass.
Test: go/wm-smoke
Bug: 64146578
Change-Id: Ifc1c35f7b13c335cdf1a1694208e9fe0aea0c1fa
2017-09-19 10:36:52 -07:00
Clara Bayarri
a26be3c97c Fix crash in TextView#setHint
Bug: 65821360
Test: bit CtsWidgetTestCases:TimePickerTest
Change-Id: I1ee279691d73f173064d98f6e7d5d5fbd483f682
2017-09-18 15:05:02 +01:00
Alan Viverette
00e9401e00 Handle null left and right tab strip drawables
Change-Id: I7a44fadc33a05c884e81d9bbb12e868937ab95f3
Fixes: 65726084
Test: bit CtsWidgetTestCases:.TabWidgetTest\#testStripDrawables
2017-09-15 16:59:15 -04:00
Jan Althaus
019389a638 New metrics fields for selection logs
Changes that affect logging:
- Switched to new category/actions/fields that are used exclusively by
  selection logging.
- Action types are now logged in the tron type (the information that was
  previously in the field could be derived from other fields).
- Entity types are now logged in the tron sub type.
- Delta time from previous event is now zero for first event (was time
  since epoch).
- The smart select model version is now written for all events after
  smart select has run. (i.e. better support for analysis based on
  terminal events alone)
- Restoring the logging removed in ag/2901629.

Internal only changes:
- Made debug statement conditional on DEBUG_LOG_ENABLED.
- Reduced logging tag length to fit into 23char limit.

Bug: 64914512
Test: Manually tested that logs are correct. Will follow up with automated tests.
Merged-In: If12daa2f206fb42be53587decbe2c4abfd689f41
Change-Id: Iec0f6cf1f9f2efdc8518133cf8551cd96b095ad8
2017-09-15 18:17:57 +02:00
TreeHugger Robot
a2dfc3cc68 Merge "New metrics fields for selection logs" 2017-09-15 15:54:59 +00:00
Clara Bayarri
e128408553 Merge "Fix hint text updates in Extracted text mode" 2017-09-15 15:21:06 +00:00
Clara Bayarri
d8c5e7fc41 Fix hint text updates in Extracted text mode
Updates to the hint on a TextView were not notified to the
ExtractEditText, so there was no way it could know to update.
This change pipes through the hint value when the extracted
mode becomes visible and informs it of changes.

The Editor#reportExtractedText method has been refactored to
be more readable. Note that checks on whether the content
changed are done in the two places in the code that already
called this method, and we explicitely don't want to check
contents when there is a hint change.

Bug: 63980155
Bug: 65691495
Test: bit CtsWidgetTestCases:.TextViewTest
Change-Id: I357dd5c74b61d149cf8612d1f52c7118ec70c696
2017-09-15 12:19:29 +01:00
Alan Viverette
f91ebf5433 Merge "Use correct date pattern for displaying year in DatePicker" into oc-mr1-dev am: c668bc0d92
am: 5b8476637d

Change-Id: I5b1063b5b787f814ef78d55f6f5868dfb21c4f9d
2017-09-15 11:19:07 +00:00
Jan Althaus
786a39dfa5 New metrics fields for selection logs
Changes that affect logging:
- Switched to new category/actions/fields that are used exclusively by
  selection logging.
- Action types are now logged in the tron type (the information that was
  previously in the field could be derived from other fields).
- Entity types are now logged in the tron sub type.
- Delta time from previous event is now zero for first event (was time
  since epoch).
- The smart select model version is now written for all events after
  smart select has run. (i.e. better support for analysis based on
  terminal events alone)
- Restoring the logging removed in ag/2901629.

Internal only changes:
- Made debug statement conditional on DEBUG_LOG_ENABLED.
- Reduced logging tag length to fit into 23char limit.

Bug: 64914512
Test: Manually tested that logs are correct. Will follow up with automated tests.
Change-Id: If12daa2f206fb42be53587decbe2c4abfd689f41
2017-09-15 10:41:16 +02:00
Siyamed Sinir
390a4d6cd5 Merge "Fix maxLines/lines properties for BoringLayout" into oc-mr1-dev am: ae90cfccee
am: 273dcbf053

Change-Id: Ic03051c0a9d491337d9606e082ad83ecb61bd1c7
2017-09-15 05:32:10 +00:00
TreeHugger Robot
c668bc0d92 Merge "Use correct date pattern for displaying year in DatePicker" into oc-mr1-dev 2017-09-14 21:49:43 +00:00
Siyamed Sinir
dcb33f1618 Fix maxLines/lines properties for BoringLayout
Line height calculation with maxLines set to zero displayed a single
line when BoringLayout was used. This CL fixes it to show zero lines.

Test: Added related CTS tests to TextViewTest and EditTextText
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsWidgetTestCases:android.widget.cts.EditTextTest

Bug: 65435738
Change-Id: Ic21eb50b31666b2dcc2398278010fa072ea1ff67
2017-09-13 09:05:53 +00:00
Abodunrinwa Toki
89bda32771 Log the "change selected text" gesture.
This logs when the selected text is changed e.g. by typing on
the hard or soft keyboard.

Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Merged-In: I82b3b2157856c607d08a82c0a3d9fb938af4c06a
Change-Id: I82b3b2157856c607d08a82c0a3d9fb938af4c06a
2017-09-12 14:04:42 +01:00
Abodunrinwa Toki
78940eb859 Log the "change selected text" gesture.
This logs when the selected text is changed e.g. by typing on
the hard or soft keyboard.

Bug: 64914512
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I82b3b2157856c607d08a82c0a3d9fb938af4c06a
2017-09-12 13:53:04 +01:00
TreeHugger Robot
33e9e7d5e6 Merge "Fix smart selection logging bugs." 2017-09-12 11:00:04 +00:00
Petar Šegina
c975213ddb Merge "Enable smart select animation for multiline scenarios" 2017-09-12 10:24:35 +00:00