Commit Graph

7802 Commits

Author SHA1 Message Date
Mihai Popa
a9d27ea869 Fix monkey crash in smart selection animation
In Id65443e93d277c106ea955c867d39e94192cc55d we fixed a monkey crash
happening when the smart selected text had changed while the smart
selection animation was running. However, the change introduced a new
crash, happening when the smart selection result was null. This CL fixes
it, and lets startSelectionActionMode run even when the result is null,
as there seems to be some logic there which should happen in this case.

Bug: 80244201
Test: none
Change-Id: I7f0304446dec85578bdcd5011d2e9ea2737d3c36
2018-05-25 11:57:17 +01:00
TreeHugger Robot
26595a7f8f Merge "Cheaper crash check post smart selection animation" 2018-05-22 14:33:28 +00:00
Abodunrinwa Toki
140ac5b2b5 Merge "End the TC session on terminal selection event actions" into pi-dev am: d0a4dddb9b
am: 6826a4ab53

Change-Id: Ifca422285ca1faa681e0b761efedc0a2bfb31561
2018-05-22 07:15:32 -07:00
TreeHugger Robot
d0a4dddb9b Merge "End the TC session on terminal selection event actions" into pi-dev 2018-05-22 13:56:22 +00:00
Mihai Popa
6df95fa087 Merge "Fix crash after smart selection animation" into pi-dev 2018-05-22 11:19:24 +00:00
Abodunrinwa Toki
f299fc0397 End the TC session on terminal selection event actions
This regressed when introducing TC sessions in
I3c9ceea0863099fc4f0a5ce5e823c648ee9c4521
When the user triggers a terminal selection event such as "Copy",
we should immediately end the session instead of waiting for the
"Abandon" event (i.e. selection dismissed) to be included in the
logs. Terminal selection events implicitly dismiss a selection and
we'd rather distiguish between an actual "selection dismiss" from
one that happened because of a "terminal" selection event.

This cl also removes the "*" marker used to distinguish the new
logging from the old ones. The code for the old logging has already
been deleted so no more need for a marker.

Bug: 78541105
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: Iac7d45dbc63e7076683742bd045766a1d927cfc9
2018-05-22 12:15:34 +01:00
Mihai Popa
6748ff37db Fix crash after smart selection animation
At the end of the smart selection animation, we run a callback that sets
the selection on the TextView (subsequently starting the action mode
toolbar and showing the handles). However, when the text changes before
the animation finishes, the selection might not be valid, and might get
out of the text bounds, which was producing a crash. This was observed
in a monkey crash. This CL fixes this bug by refusing to set the
selection when it goes outside the text bounds, corresponding to the
case when text has changed between the time the animation has started
and the time it ended.

Bug: 69919777
Test: manual testing before and after the fix
Change-Id: Iea043f320004d45ad16dd7e9e5b47e5256e6d9fa
(cherry picked from commit cce6e82d35)
Merged-in: Iea043f320004d45ad16dd7e9e5b47e5256e6d9fa
2018-05-22 10:42:16 +01:00
Mihai Popa
6849bd3296 Cheaper crash check post smart selection animation
At the end of the smart selection animation, we run a callback that sets
the selection on the TextView (subsequently starting the action mode
toolbar and showing the handles). However, when the text changes before
the animation finishes, the selection might not be valid, and might get
out of the text bounds, which was producing a crash.

This was initially fixed in Iea043f320004d45ad16dd7e9e5b47e5256e6d9fa,
by checking whether the text has not changed since the animation
started. The fix was implying one text copy and a potentially full text
comparison, being unnecessary costly. This CL instead only checks
whether the selection is still within the text bounds when animation
ends.

Bug: 69919777
Test: manual testing before and after the fix
Change-Id: Id65443e93d277c106ea955c867d39e94192cc55d
2018-05-21 18:58:03 +01:00
Abodunrinwa Toki
228460c709 Merge "Refresh TCM settings when they change" into pi-dev am: 3fa564030f
am: f08646f13e

Change-Id: I2a7fc61dac52817b053a680b82c18514f76ec6b8
2018-05-17 11:13:47 -07:00
Mihai Popa
5b3a42319c Fix TextView#setText misplaced documentation
In Ifaddb46d156c495a371789c6f32cfd67ffaaaef2, we improved the
documentation of TextView#setText to state an assumption that should
hold when subclasses override the method. However, the new phrase was
put in the wrong place. This CL fixes this.

Bug: none
Test: none
Change-Id: I918a6c533b9e4b34b3977a20e979a10db9741ebc
2018-05-17 16:42:22 +01:00
Abodunrinwa Toki
c2449b8361 Refresh TCM settings when they change
Approach here is to register a content observer that invalidates the
TC settings whenever updates to the settings happen.

This CL also ensures that the TC is invalidated when a settings
update happens. This is because the settings may change what
TC the system returns.

TextView's SelectionActionModeHelper has been updated to not cache
the settings and get them directly from TCM (which caches the settings).

NOTE that we expect TC settings to rarely change.

Bug: 77539576
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: manual - Made changes to TC settings and observed logs / app behaviour

Change-Id: I88bbb6f951708b17323fac1a72385fe808d270a5
2018-05-17 11:29:29 +01:00
Mihai Popa
a875271fcc Check against null text in TextView constructor
It is common for TextView subclasses to override the #setText method,
and there is nothing preventing the new implementations from leaving
mText and mTransformed unchanged. On the other hand, TextView assumes
mText and mTransformed will be non null at all times after the first
overridden implementations, these can remain null, causing null pointer
exceptions later.

Bug: 74411872
Test: atest FrameworksCoreTests:android.widget.TextViewTest
Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ifaddb46d156c495a371789c6f32cfd67ffaaaef2
2018-05-14 16:54:00 +01:00
android-build-team Robot
d364bcff96 Merge "Fix a typo in the API doc of TextView#setKeyListener()" into pi-dev am: 643d9256d9
am: 4a85bd7cfa

Change-Id: I50a49febfb87712d316dc96f1c9bc8c8c6fca727
2018-05-09 10:38:10 -07:00
Mihai Popa
cce6e82d35 Fix crash after smart selection animation
At the end of the smart selection animation, we run a callback that sets
the selection on the TextView (subsequently starting the action mode
toolbar and showing the handles). However, when the text changes before
the animation finishes, the selection might not be valid, and might get
out of the text bounds, which was producing a crash. This was observed
in a monkey crash. This CL fixes this bug by refusing to set the
selection when the text has changed between the time the animation has
started and the time it ends.

Bug: 69919777
Test: manual testing before and after the fix
Change-Id: Iea043f320004d45ad16dd7e9e5b47e5256e6d9fa
2018-05-09 10:33:02 +00:00
Yohei Yukawa
3128ebd880 Fix a typo in the API doc of TextView#setKeyListener()
Fix: 79436805
Test: make -j docs
      Then check out/target/common/docs/offline-sdk/reference/android/widget/TextView.html#setKeyListener(android.text.method.KeyListener)
Change-Id: I6c0d2a3af9434240c4e6e931185bc4f21b2e2b52
2018-05-08 17:11:33 -07:00
Selim Cinek
edf1f85ba4 Merge "Fix new notification showing timestamp "now" after turning off DND" into pi-dev am: 929ea36157
am: d48aca89b0

Change-Id: I93d5eb4291dcb13e417629f6abb008dc3217e3d0
2018-05-03 08:39:26 -07:00
Selim Cinek
929ea36157 Merge "Fix new notification showing timestamp "now" after turning off DND" into pi-dev 2018-05-03 15:15:42 +00:00
shawnlin
ea19d32a9b Fix new notification showing timestamp "now" after turning off DND
DateTimeView won't update timestamp until the view is attached to
window and received TIME_TICK intent.

Update timestamp on onAttachedToWindow().

Test: manual 1) turn on DND 2) send a notification and wait some time 3)
turn off DND and check the timestamp
Fixes: 77970557

Change-Id: Ia8420aacf5b91b0bb9cbec561629ddbfc8de4f67
2018-05-03 11:06:52 +08:00
Mihai Popa
f86a6e94da Merge "[Magnifier-43] Refactor to remove code duplication" into pi-dev am: 90f197efe5
am: c184c0a7c6

Change-Id: I6fa2652be36d503432723a6eb03ddf60aa0eec0e
2018-05-02 13:29:40 -07:00
Daniel Santiago Rivera
a1b06eba14 Add setter and getter for Toolbar's collapse icon.
Bug: 78187236
Test: make java
Change-Id: Id0faacaa95c8c4ee54b3dec66e3b16e589ebd370
2018-05-02 18:17:55 +00:00
Mihai Popa
90f197efe5 Merge "[Magnifier-43] Refactor to remove code duplication" into pi-dev 2018-05-02 14:50:41 +00:00
Mihai Popa
5ab52b5740 Merge changes I63f2b185,I0d749c1a into pi-dev am: 724990d5ff
am: 0838228dff

Change-Id: Ieccbc53a8e859c36ed589a34fabe35650324c5fb
2018-05-02 05:22:19 -07:00
Mihai Popa
724990d5ff Merge changes I63f2b185,I0d749c1a into pi-dev
* changes:
  [Magnifier-42] Fix bug in window positioning
  [Magnifier-41] Fix behavior in windows with insets
2018-05-02 12:02:18 +00:00
Mihai Popa
f298068a7f [Magnifier-43] Refactor to remove code duplication
Since Ic5b5f6ca687db8b5d842f0ab20eac70f1fd2f85e, the magnifier can be
the child of a diffent surface than the one its content is copied from.
This initially led to much code duplication accross different methods,
making the code quite difficult to understand. This CL performs a small
refactoring, removing some of the TODOs and making the code a bit
cleaner.

Bug: 78876353
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ifa26f94ba2e4983446f058f016af6010c1017ea7
2018-05-02 10:30:40 +00:00
Mihai Popa
227034b863 [Magnifier-42] Fix bug in window positioning
The position of the magnifier surface is always clamped inside its
parent surface. As of Ic5b5f6ca687db8b5d842f0ab20eac70f1fd2f85e, we are
always trying to make the magnifier surface a child of the main
application window, if possible (before, if the magnified view was a
SurfaceView, we were making the magnifier a child of the SurfaceView's
surface). However, the CL did not also update the clamping, continuing
to clamp to the SurfaceView space when the magnified view was a
SurfaceView (even if the magnifier was child of the main window). This
was making the magnifier window to be wrongly positioned on the screen
when the magnified view is a SurfaceView. The current CL fixes this.

Bug: 78876353
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I63f2b185f58e62e8ad6eadf788e641fb1de07b04
2018-05-02 10:30:29 +00:00
Mihai Popa
0450a16759 [Magnifier-41] Fix behavior in windows with insets
The CL fixes the magnifier's behavior when its parent window has
positive insets in its surface:
- we compute the content copy coordinates sent to the pixel copy request
relative to the surface the content is copied from. We were clamping
them inside the visible region of the magnified view as returned by
belonging to the view which is magnified. However, the method returns
coordinates relative to the window. Therefore, the CL offsets the
visible rectangle with the window insets, to account for them.
Otherwise, when the insets were non-zero, on a text line we were
allowing the magnifier to display content from the left outside of the
text line, while a certain region at the end of the text line could have
never been magnified
- when clamping against the visible view region, when the surface we
copy from is a SurfaceView, #getGlobalVisibleRect is still returning
coordinates relative to the main window, whereas the coordinates we are
trying to clamp are relative to the surface of the SurfaceView. In order
to make the visible rectangle relative to the surface of the SurfaceView
instead, this CL negatively offsets the visible rectangle with the
SurfaceView position in the parent surface
- the selection/insertion handles are hidden when they overlap the
magnifier. To check this, we intersect the magnifier rectangle with the
rectangle of each handle.  However, when we were performing this check,
the magnifier rectangle was relative to the surface, whereas the
handles' rectangle was relative to the main window. The CL negatively
offsets the magnifier position with the surface insets, to make both
rectangles relative to the window.

Bug: 78621162
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I0d749c1abb38520fe8fc477d22d6523f470e9abc
2018-05-02 10:29:19 +00:00
Phil Weaver
220fc4f3b1 Merge "Fix bug and docs assuming progressBar min is 0 instead of getMin()" into pi-dev 2018-05-01 17:12:40 +00:00
Abodunrinwa Toki
049932ac0d Merge "FloatingActionMode.setOutsideTouchable" into pi-dev am: 8e7f8ad3ce
am: 3ebb4719d8

Change-Id: I994b5fff9f4a560bd000687020a3e41a1c2e04f9
2018-04-27 13:32:32 -07:00
Abodunrinwa Toki
8e7f8ad3ce Merge "FloatingActionMode.setOutsideTouchable" into pi-dev 2018-04-27 19:46:10 +00:00
Dake Gu
cc24386a86 Merge "Autofill: new UX for TV and support themes" into pi-dev am: 9ea13ca0b6
am: 1c62e1ef27

Change-Id: Iefa843e82fdc4093b478b2a16ecf407d6a46a888
2018-04-26 10:10:58 -07:00
TreeHugger Robot
9ea13ca0b6 Merge "Autofill: new UX for TV and support themes" into pi-dev 2018-04-26 16:40:40 +00:00
Mihai Popa
ce357b9ad2 Merge "[Magnifier-40] Always child of main window" into pi-dev am: 977871a96c
am: 420bf9f8c9

Change-Id: I71d3484758849dab7b14632edadccfb14137d3aa
2018-04-26 04:11:09 -07:00
Mihai Popa
977871a96c Merge "[Magnifier-40] Always child of main window" into pi-dev 2018-04-26 10:48:23 +00:00
Mihai Popa
819e90d3f6 [Magnifier-40] Always child of main window
Previously, we were making the magnifier surface a child of the main
window unless the magnified view was a SurfaceView, in which case we
were setting the SurfaceView to be the parent of the magnifier. In
Chrome, where the magnified views are usually SurfaceViews, this caused
the magnifier to be displayed underneath the omnibox, which was a
terrible user experience when trying to magnify the first lines of text
on a page. This was because the omnibox had a higher Z than the
SurfaceView, and therefore a higher Z than all children of the
SurfaceView (including the magnifier).

This CL sets the parent of the magnifier surface to be the main window's
surface when the magnified view is a SurfaceView as well. Therefore, the
magnifier becomes a sibling of the Chrome omnibox and, by giving the
magnifier a higher Z, it ends up being rendered on top.

Bug: 77926365
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ic5b5f6ca687db8b5d842f0ab20eac70f1fd2f85e
2018-04-26 10:58:31 +01:00
Derek Sollenberger
c18bcee38f Merge "Temporarily allow StackView to use a canvas.clipRectUnion" into pi-dev am: 7a7b2369fe
am: 8f0335fdec

Change-Id: Id22c0ad948b9aecfc0844ab0ad9b0d9eb376febb
2018-04-25 11:34:51 -07:00
Dake Gu
36b86c28f8 Autofill: new UX for TV and support themes
1. Define default Themes for autofill window and save dialog.
   (http://go/theme_autofill). Phone uses light themes, TV uses
   dark themes.
2. Apply autofill theme to RemoteViews passed from autofill service.
   So this can make sure the textColor of RemoteViews matches
   the background of autofill theme uses.
   Updated public javadoc that autofill service should not
   hardcode color values.
3. A new TV ux that occupies half screen height (go/autofill-for-tv).
   TV autofill now passes unhandled physical keyevent to app window
   in the same way phone/tablet does.
4. Fixed ATV autofill window to be SYSTEM_DIALOG, so it wont be
   clipped by app activity window (DialogLauncherActivityTest).

Bug: 71720680
Bug: 74072921
Test: CtsAutofillTest

Change-Id: Ib570227b0958b1800e8f0600b8aec36478568d74
2018-04-25 10:49:14 -07:00
TreeHugger Robot
7a7b2369fe Merge "Temporarily allow StackView to use a canvas.clipRectUnion" into pi-dev 2018-04-25 17:36:47 +00:00
Chet Haase
bb5f10924c Fix bug and docs assuming progressBar min is 0 instead of getMin()
This code and docs predates the existence of get/setMin() on ProgressBar,
should have been updated when we introduced the new min property.

Test: Ran TalkBack
Bug: 74357845
Change-Id: I318f26bb8ecacc5ecdbf7d026d8568f871cf2369
(cherry picked from commit 25886a160b)
2018-04-24 17:23:58 +00:00
Abodunrinwa Toki
29cb76849c FloatingActionMode.setOutsideTouchable
Make floating toolbar outside-touchable for link action mode in
non-selectable TextView.
This allows the user to be able to dismiss the toolbar by tapping
outside of the toolbar.

Bug: 78099871
Bug: 73156794
Bug: 78298142
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit CtsViewTestCases:android.view.cts.ActionModeTest
Change-Id: I8e3b460d0b1baee48d4f9cb3f92e73926eeee231
2018-04-24 14:54:33 +01:00
Selim Cinek
fe5e954e9e Merge changes from topic "notification_reply_action" into pi-dev am: 53790c1c8f
am: 0744f1d4b1

Change-Id: Ic0fdf693f31edc0402c43451610c051b2d8571cf
2018-04-24 02:37:39 -07:00
Selim Cinek
d83203cde4 Disabled reply action when pending intents are cancelled
Previously the user could open inline reply even when the
action was already cancelled. This also enables listening
to pending intent cancellations.

Test: manual
Fixes: 77811784
Change-Id: I4ae164081c6abdeb60a8e78d61bf5e4f26cca1d3
2018-04-24 13:05:53 +08:00
Nader Jawad
e6a6321a92 Removed applyColorMod method in favor of individually setting
properties.

Created dedicated applyXfermode, applyColorFilter and applyAlpha methods
to ensure that properties are not being overwritten unnecessarily

Fixes: 30167384
Test: Re-ran atest CtsWidgeTestCases:ImageViewTest

Change-Id: Ie4a18172dbf222559ace1b740a6c6fdfe33f4dfe
2018-04-23 16:00:49 -07:00
Selim Cinek
384804b42d Split the reply icon permanently from the right icon
Previously these would overlap, but they are now completely
separate.

Test: ensure that all notification styles still work with the new affordance.
Change-Id: I16f5f863b4afac27494a4a7615631bca240ca532
Fixes: 72750728
2018-04-23 16:19:21 +08:00
Abodunrinwa Toki
2933d7b687 Merge "Fix non-unique PendingIntent issue with TCImpl." into pi-dev am: 993890fbf4
am: 10fa03ab38

Change-Id: I9bdd75a4116f2f7d468dc0e6adbfe406e6b10606
2018-04-19 15:45:16 -07:00
Abodunrinwa Toki
993890fbf4 Merge "Fix non-unique PendingIntent issue with TCImpl." into pi-dev 2018-04-19 22:05:17 +00:00
Abodunrinwa Toki
904a931cfc Fix non-unique PendingIntent issue with TCImpl.
As per the referenced bug, we're running into issues where apps are
being fired with stale intents. The reason is because we need intents we
fire to be unique by Intent.filterEquals. Some of the intents we
generate put unique data in the intent extra which is not considered by
filterEquals. The solution here is to create PendingIntents with unique
request codes (using classifiedText.hashCode()).
See more info about this in
https://developer.android.com/reference/android/app/PendingIntent.html

Bug: 77930684
Test: manually tested broken scenarios. See referenced bug
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
Test: bit CtsViewTestCases:android.view.textclassifier.cts.TextClassificationManagerTest
Test: bit FrameworksCoreTests:android.view.textclassifier.TextClassificationTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: Ib7275f94ca5ada51e4ba191742d4b614df12e1ea
2018-04-19 18:23:51 +00:00
Jeff Sharkey
275a9e16cc Merge "Visit Uris in RemoteViews for granting purposes." into pi-dev am: 1cd96854d4
am: 993106c06a

Change-Id: I67502e0c9acbf942bf2dbb799f60ba406df4f84b
2018-04-19 08:18:50 -07:00
Jeff Sharkey
23b3118f28 Visit Uris in RemoteViews for granting purposes.
RemoteViews end up passing around Uris, so we need to extend Uri
permission grants for them to ensure the recipient of a Notification
object is able to render its contents.

Bug: 9069730
Test: atest frameworks/base/services/tests/uiservicestests/src/com/android/server/notification
Change-Id: Id31b5adaf2ee66113a1b503e32126aeddbf97b28
2018-04-18 21:40:47 -06:00
Derek Sollenberger
2ad19e5146 Temporarily allow StackView to use a canvas.clipRectUnion
StackView currently expands the clip of the view which is a prohibited
operation in API Level 28.  This CL currently allows this specialized
use case to work in this situation until we can update StackView
to not clip to its bounds and then just intersect with this clip
provided by its parent.

Test: CtsWidgetTestCases
Bug: 77642155
Change-Id: Icc003ad3946bb226368ec2030d4707753f4f55e9
2018-04-18 16:19:59 -04:00
Selim Cinek
c5ae11b044 Merge "Changed the appearance of phone call notifications" into pi-dev am: e0a25acf08
am: aab697426c

Change-Id: I0ca3ceadf4480b3d1524802d7c1ad0c60e1df2ec
2018-04-12 17:14:20 -07:00