Commit Graph

7437 Commits

Author SHA1 Message Date
Andrei Stingaceanu
d27c36b870 [Magnifier - 6] Simplify API and configuration
* removed "scale" from the show(...) API
* made the zoom scale a dimension => the widget is
  fully self-configured
* fixed the magnifier not always scaling the content
  to the full pop-up window size

Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: Ibf5c571970c8f6bd3cdbc6d46fbe57d08291783c
2017-10-24 11:17:35 +01:00
TreeHugger Robot
1eb19a3b87 Merge "[Magnifier - 5] Auto invalidate and misc" 2017-10-23 14:09:01 +00:00
Andrei Stingaceanu
ca189fe0fa [Magnifier - 5] Auto invalidate and misc
* due to having to make the API public, drop the
  invalidate_by_client strategy in favor of self invalidation
  by polling
* in Magnifier#show(...) stop sending screen coordinates in favor
  of view coordinates
* UI/UX:
** width from 200dp to 164dp
** fixed the shadow depth (elevation)
** fixed the rounded corners (2dp)

Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I6451767b0a618c0c4ea396ba3ee3144523dadc57
2017-10-23 12:25:15 +01:00
Sunny Goyal
9372ca079f Merge "Binding to the RemoteViewsService directly from the host" 2017-10-21 02:19:53 +00:00
Sunny Goyal
e1273ebbb7 Binding to the RemoteViewsService directly from the host
The host passes an IServiceConnection to the AppWidgetManager which
is used to bind to the RemoteViewsService. This allows the host to
recieve the connection callbacks directly instead of proxying it via
the AppWidgetManager. The host is also responsible for unbinding to
the service.

Bug: 26481160
Test: adb shell \
  am instrument -w -e class android.widget.RemoteViewsAdapterTest \
  com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Change-Id: Iac400095a319c3a43714c82fda7516be1ccc68af
2017-10-20 16:43:23 -07:00
TreeHugger Robot
a18447dd4b Merge "FloatingToolbar updates" 2017-10-20 17:16:59 +00:00
Sunny Goyal
bbe20b0d49 Merge "Optimizing memory for RemoteViewsAdapter caches." 2017-10-20 16:36:58 +00:00
Sunny Goyal
dd60f4d28a Optimizing memory for RemoteViewsAdapter caches.
The cache holds large number of remoteViews each of which have a
separate copy of applicationInfo.
Also simplifying some cache objects

Test: Manually tested on device
Change-Id: I353239354d329d3b0219ade55d39fe3b89e3bb02
2017-10-19 14:42:05 -07:00
Andrei Stingaceanu
15af561efd [Magnifier - 3] Reduce number of calls to PixelCopy
* Magnifier#show() takes snapshots of the content and displays
  them in the Magnifier bitmap
* calling show(...) consecutive times with the same arguments is
  a no-op if already showing (to cater with the miriad of motion
  events produced by touch which end up calling show(...))
* introduced Magnifier#invalidate(...) which, if currently
  showing, forces updating the content using the last configuration
* clamped the start horizontal value of the Rect which delimits the
  content to show in order to avoid distorting the rendering of the
  magnifier content
* fixed invalidating the magnifier (invalidate() does not
  automatically call invalidate(RectF) !)

Bug: 63531115
Bug: 67296158
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: I8e53dfb6582d541922fe05b60311658fb07ca880
2017-10-17 12:33:34 +01:00
Abodunrinwa Toki
9c881f227b FloatingToolbar updates
- Replace SHOW_AS_OVERFLOW_ALWAYS with SHOW_AS_ACTION_NEVER
 - MenuItem ordering
 - Allow textAssist items in overflow to show text with images
 - MenuItem label text now standard case (not allcaps)

Bug: 62447250
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I07fa06f433a34adfad20b371417c95ce76422456
2017-10-16 21:27:54 +01:00
TreeHugger Robot
0b57d2f561 Merge "[Magnifier - 4] Batch of tweaks" 2017-10-16 16:10:19 +00:00
Andrei Stingaceanu
451f947ffa [Magnifier - 4] Batch of tweaks
* magnifier zoom from 1.5 to 1.25
* max scale from 10 to 4
* magnifier shows over the text if there is no more space above
  instead of showing underneath the cursor
* paused the blink while showing the magnifier and resumed when
  dismissing

Bug: 63531115
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: manual test that shows the magnifier working
Change-Id: Ief3e0b7dc9e287e7dd1a9102548b1861598b69c4
2017-10-16 11:53:52 +01:00
TreeHugger Robot
02a20b7025 Merge "Added new ViewNode properties for Autofill (minEms, maxEms, maxLength)." 2017-10-13 18:13:04 +00:00
TreeHugger Robot
f055302a73 Merge "Flags to enable/disable smart selection in EditText" 2017-10-13 00:33:44 +00:00
Abodunrinwa Toki
0e6b43ed58 Flags to enable/disable smart selection in EditText
1. smart_selection_enabled_for_edit_text
   Disables smart selection for editable text.
2. smart_selection_dark_launch
   Dark launch TextClassifierImpl.suggestSelection(...)
   In this mode we run the method, but never change the user's
   selection to measure the quality of the results based on what
   the user actually wanted.

Bug: 65959640
Test: Manually tested flags turn on/off feature with 'adb shell
settings put global' and GServices override.
Test: bit FrameworksCoreTests:android.provider.SettingsBackupTest
Change-Id: Iacc561c8ee004b0123de66ad1ee06b1f56b4e4b4
2017-10-12 23:50:53 +01:00
Sunny Goyal
d7d0c691bf Updating documentation for setOnClickPendingIntent
Bug: 65464277
Test: N/A
Change-Id: I7bdc397375e6c49d47d24868a5427dd3990057cf
2017-10-12 12:36:19 -07:00
Felipe Leme
aa7e2294be Added new ViewNode properties for Autofill (minEms, maxEms, maxLength).
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testNewTextAttributes
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases

Fixes: 38323227

Change-Id: I6d8606f2d0668644ae1bd33e982edef0ec1e8e63
2017-10-06 15:55:19 -07:00
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