Commit Graph

8011 Commits

Author SHA1 Message Date
Mihai Popa
6d26d15168 [Magnifier-76] Show for translated/scaled textview
In Ibb81fdc9d2ec8ba14914166e408c92a3aad7e312 we disabled the magnifier
for cases when the magnified TextView (or a view above it in the view
hierarchy) was matrix transformed (translated, scaled or rotated).
This CL reenables the magnifier for translated and scaled TextViews. The
translation case was already working.

Bug: 123536409
Bug: 77283509
Test: manual testing
Change-Id: I1a22ff2223fe699c6ac660b5f59510ca1f544ee4
2019-01-31 16:25:42 +00:00
TreeHugger Robot
62c8b56d00 Merge "[Magnifier-74] Remove MAX_IN_VIEW sourcebound type" 2019-01-31 16:09:20 +00:00
Abodunrinwa Toki
520b2f8122 Log translate action's views and clicks.
This logs a "view" event for the translate action *once* for each
selection session that involves a foreign language. It logs a "click"
action when the translate action is clicked.

The logged action index will give an indication of whether the translate
action was the primary action (index 0) and thus immediately visible to the
user or whether it was one of the secondary actions (index > 0) and
possibly in the selection toolbar's overflow.

Bug: 123414932
Bug: 120837847
Test: atest core/tests/coretests/src/android/view/textclassifier
Test: atest cts/tests/tests/view/src/android/view/textclassifier
Test: atest android.widget.TextViewTest
Test: atest android.widget.cts.TextViewTest
Test: (MANUAL):
      1. Ensure device has an app that supports Intent.ACTION_TRANSLATE
      2. Run the following command on the shell: adb logcat -c "TCEventTronLogger"
      3. Select some foreign lanugage text in a TextView
      4. Click on "Translate" item on the toolbar
      5. Observe that the device logs a "view" and a "click" event
      6. Repeat 3
      7. Click on a different menu item, e.g. "Copy"
      8. Observe that the device logs only a "view" event

Change-Id: I36f32459c577cf8f8bcf1e65960c4e6d7ffa5e01
2019-01-31 01:22:17 +00:00
Felipe Leme
35ea763042 Removed unused flag from notifyTextChanged().
(and also fixed typo on hidden constant)

Test: m update-api
Test: atest CtsContentCaptureServiceTestCases
Fixes: 123598012

Change-Id: I63ccb60cf8eebe6b5ef6d7961dbb0ac8be088eda
2019-01-29 16:32:56 -08:00
Mihai Popa
520e447586 [Magnifier-74] Remove MAX_IN_VIEW sourcebound type
The CL removes the MAX_IN_VIEW type of source bounds, used to define
where the content of the magnifier can be copied from. MAX_IN_VIEW was
not used anywhere, and it is easily replaceable if developers need it:
setting the source bound to MAX_IN_SURFACE and use the View#getWidth()
and View#getHeight() methods to coerce the coordinates passed to the
show() methods.

Bug: 72211470
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I3acaad0ec0c68d3ecaba1e0f5f490889d9ebc949
2019-01-29 21:26:26 +00:00
Mihai Popa
27cf08f9c8 [Magnifier-72] Rename Builder#setZoom
The CL renames the setZoom method for Magnifier.Builder to
setInitialZoom, since the zoom can be changed after the instance is
created using the Magnifier.setZoom method.

Bug: 120609112
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ide2508ab49e3f3660aa089876029e351b4cef603
2019-01-28 10:03:50 +00:00
Haoyu Zhang
3c739fd195 Rename isHorizontallyScrolling to isHorizontallyScrollable
Bug: 123222813
Test: atest TextViewIsHorizontallyScrollableTest
Change-Id: I9ba562b0f5807fed05b0b4380901e238bf309bd2
2019-01-22 14:36:45 -08:00
Yohei Yukawa
17ace29a10 Deprecate SuggestionSpan#ACTION_SUGGESTION_PICKED
This CL deprecates SuggestionSpan#ACTION_SUGGESTION_PICKED and related
constants [1].

There are multiple security concerns, open questions about
compatibility, and maintainance challanges in this protocol.

IME developers can implement their own suggestion picker UI on top of
CursorAnchorInfo API to achieve safer, should give more flexible UI
options, better security, and better compatibility.

 [1]: Ia539de0acf66053e0349daec459d75e36805f6bf
      f9f0100862

Fix: 123160396
Test: make -j checkbuild
Change-Id: I6d39e838ae47488055162cd44b5f553f68869b17
2019-01-21 09:24:26 -08:00
Yohei Yukawa
401e3d4c84 Introduce @hide TextView#setTextOperationUser()
This CL introduces a unified way for framework developers to specify
whose components should be interacting with the given TextView.  An
important use case is the direct-reply UI notification hosted in
System UI, which always runs as user 0 no matter who is the current
user.

For instance, to let the given EditText interact with user 10's input
methods and spell checkers, you can call setTextOperationUser() as
follows.

  editText.setTextOperationUser(UserHandle.of(10));

In this way we can easily propergate the same user ID to other
components such as autofill and text classifer as necessary in the
future.

No one calls TextView#setTextOperationUser() yet hence there should be
no user-visible behavior change.

Bug: 120744418
Bug: 123043618
Test: spell checker still works
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Change-Id: I6d11e4d6a84570bc2991a8552349e8b216b0d139
2019-01-19 11:49:37 -08:00
Aurimas Liutikas
d8ebfefcee Remove old private constant from ResourceId.
Bug: 122967079
Test: make -j builds
Change-Id: I3e999044df02549e84208d38bb77d2ce1d1bd73b
2019-01-17 12:51:58 -08:00
Mihai Popa
0374b62bbe Fix TextView#setTextCursorDrawable for resid=0
The CL fixes TextView#setTextCursorDrawable, for the case when a zero
drawable resource id is passed. We want to set a null Drawable, but the
Context#getDrawable(0) call was throwing rather than returning null.

Bug: 122742983
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I45bf57002043d7dbe541d76e61fce3f729959fc8
2019-01-14 11:45:36 +00:00
TreeHugger Robot
00112e6f6f Merge "Move copy, cut and paste shortcut handler to onKeyDown()." 2019-01-10 23:26:06 +00:00
Mihai Popa
17e17e2fdb Merge "[Magnifier-71] Adapt surface buffer to elevation" 2019-01-10 16:12:35 +00:00
Mihai Popa
c6cb040ff3 Merge "Enable null cursor drawable" 2019-01-10 16:08:01 +00:00
Yuichiro Hanada
eed724d135 Move copy, cut and paste shortcut handler to onKeyDown().
The shortcut handler for Shift-Delete was added in onKeyShortcut(), but
it's called after onKeyDown() and the event are consumed by
BaseKeyListener before reaching to onKeyShortcut().

Fix: 122079351
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ifee0144bdd3c4f0552bc4c4f3e5b844502bc937e
2019-01-10 15:34:32 +09:00
Mihai Popa
f41a054fca Enable null cursor drawable
I3801ee8642d277c96c094b7d4155e28fc5bcea87 added public setters and
getter for a TextView's cursor drawable. The setter was expecting a
NonNull Drawable argument. However, this was inconsistent with the
textCursorDrawable attribute which had existed for a long time in
platform. This accepted null, case when a fallback vertical black line
is drawn as a cursor. This CL fixes this inconsistency, by allowing null
Drawables to be set for the cursor.

Also, the CL fixes the preconditions checking resource id arguments to
be strictly positive, while negative resource ids are valid as well.

Bug: 122550166
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ia10fafbdc0405968e57b35a615eedaeb9ee80c96
2019-01-09 20:14:19 +00:00
Mihai Popa
59a7bc0453 Merge "[Magnifier-69] Some cleanup in API names and docs" 2019-01-09 19:58:35 +00:00
Mihai Popa
bd391f9aa1 [Magnifier-71] Adapt surface buffer to elevation
The surface created for the magnifier is larger than the magnifier
content, in order to leave space for drawing the shadow. In
I066082fb17cfb8c483c49b7011abfa9dca9de77a we made the elevation a
customizable property of Magnifier using the Builder class. However, the
buffer allocated for drawing the shadow remained a fixed value,
insufficient for large elevations, when shadows were getting clipped.
This CL fixes this, by making the allocated surface large enough to
accomodate the shadow.

Bug: none
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I462c50510820614dc033a42b347e9672ce39a4c6
2019-01-09 17:22:06 +00:00
Mihai Popa
becda34f25 [Magnifier-69] Some cleanup in API names and docs
This CL:
- renames setForcePositionWithinWindowSystemInsetsBounds to
setClippingEnabled
- improves some of the docs

Bug: 120609112
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I14c774b432b4a0cff96066734758b9f937179d94
2019-01-09 17:22:03 +00:00
Tetsutoki Shiozawa
9879a6375b Merge "Remove unnecessary right padding from time picker" am: 71a1e5cfe1 am: 314a239612
am: 3c2cafb1cb

Change-Id: Iebb9f81a968093420c320afa2c6fab19e43833ad
2019-01-09 06:39:18 -08:00
Tetsutoki Shiozawa
3c2cafb1cb Merge "Remove unnecessary right padding from time picker" am: 71a1e5cfe1
am: 314a239612

Change-Id: Ie5896c17bb41efbd4a627b14876abca0f177771e
2019-01-09 05:41:49 -08:00
Tetsutoki Shiozawa
7cbd19435c Remove unnecessary right padding from time picker
Symptom:
When the device language was set to Spanish, "A.M." label was not fully
displayed on the time picker widget. "M." was lacked.

Root cause:
There are unnecessary right paddings on the layout definition of time
picker. It uselessly consumes the room for ampm_layout.

Bug: 64498105
Change-Id: Ie52fafc0fb7d6d6ea5b0ca2eaeb53755d4aebc19
2019-01-08 12:14:05 +09:00
Abodunrinwa Toki
adcd10f10f RESTRICT AUTOMERGE Do not linkify text with RLO/LRO characters.
am: a69950ce18

Change-Id: I0830e1c1a1cea2fd93f0b1ed8a1a792260201bb2
2019-01-07 17:10:30 -08:00
Robert Carr
5fea55b2d2 Remove usage of scoped connections.
Tracking SurfaceFlinger changes. Now to construct a child surface
we need the SurfaceControl as opposed to just the surface, and so
we parcel the SurfaceControl across relayout.

Test: Manual
Bug: 62536731
Bug: 111373437
Bug: 111297488
Change-Id: I0a034767e92becec63071d7b1e3e71b95d505b77
2019-01-04 10:08:56 -08:00
Abodunrinwa Toki
a69950ce18 RESTRICT AUTOMERGE Do not linkify text with RLO/LRO characters.
Also don't show smart actions for selections in text with unsupported
characters.

Bug: 116321860
Test: atest android.view.textclassifier.TextClassificationManagerTest \
            android.text.util.cts.LinkifyTest \
	    android.text.util.LinkifyTest \
	    android.widget.TextViewActivityTest

Change-Id: I01b5e936aa4dfc937a98f50e9fc8171666861a61
2019-01-03 14:20:30 +00:00
Mathew Inwood
8501ae1763 Merge "Limit access to suspected false positives." am: aeda49d185
am: 152d5a5dcd

Change-Id: I8e10322e69d2d479079df5cf8fec0287c7c117f1
2019-01-02 05:00:54 -08:00
Mathew Inwood
55418eada5 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: Ia937d8c41512e7f1b6e7f67b9104c1878b5cc3a0
Merged-In: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 14:26:35 +00:00
Mathew Inwood
31755f94e1 Limit access to suspected false positives.
Members modified herein are suspected to be false positives: i.e. things
that were added to the greylist in P, but subsequent data analysis
suggests that they are not, in fact, used after all.

Add a maxTargetSdk=P to these APIs. This is lower-risk that simply
removing these things from the greylist, as none of out data sources are
perfect nor complete.

For APIs that are not supported yet by annotations, move them to
hiddenapi-greylist-max-p.txt instead which has the same effect.

Exempted-From-Owner-Approval: Automatic changes to the codebase
affecting only @UnsupportedAppUsage annotations, themselves added
without requiring owners approval earlier.

Bug: 115609023
Test: m
Change-Id: I020a9c09672ebcae64c5357abc4993e07e744687
2018-12-28 11:50:04 +00:00
TreeHugger Robot
56208f49dc Merge "Another round of changes on Content Capture." 2018-12-17 17:59:40 +00:00
Yuichiro Hanada
c53b41f2ee Support Shift-Delete, Ctrl-Insert and Shift-Insert in TextView.
They triger cut, copy and paste actions respectively.

Bug: 112448847
Test: manual - try shortcuts on TextView
Change-Id: I33c3510ffcb8b172564e3bdc83e929646479f204
2018-12-17 10:14:37 +09:00
Felipe Leme
aa5088ede6 Another round of changes on Content Capture.
- Get rid of activity-level events.
- Renamed InteractionSessionId and InteractionContext to
  ContentCaptureSessionId and ContentCaptureContext (and made them public)
- Create the explicit concept of ContentCaptureSesssion (and moved notification
  APIs to it).
- Added APIs to let apps create new sessions (not implemented yet).
- Added APIs to remove user data based on some context properties (like URI).

The reasoning behind this change is to let app developers explicitly associate
the captured content with some app-level domain (and also let the app ask the
service to clear such data at user's request). For example, a browser app
(and WebView) can use these APIs to associate the content capture events with
the URL being rendered.

Bug: 117944706
Fixes: 121034139

Test: atest CtsContentCaptureServiceTestCases
Test: m update-api && m

Change-Id: I7841da303b6a39c825651b03a07e3081fbd0bdf5
2018-12-14 18:02:24 -08:00
Haoyu Zhang
ba75b55566 Add public API TextView.isHorizontallyScrolling
The original purpose is to remove @hide annotation on
TextView.getHorizontallyScrolling, but the function name conflicts
with our API naming convention. So, I created public API
isHorizontallyScrolling instead.

Bug: 117520716
Test: atest TextViewTest
Test: make offline-sdk-docs
Change-Id: I79666c8920cdfcb9dc68ae3701c6599f063df5fd
2018-12-13 15:58:49 -08:00
Seigo Nonaka
ab11e00449 Merge "Recompute PcT with existing PcT for different direction" 2018-12-12 11:34:13 +00:00
Xin Li
15b123ef45 DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master
Bug: 120502534
Change-Id: Idc8bfb6d97a869b76cfb87ca1a494201baf9e8bd
2018-12-11 14:13:44 -08:00
Seigo Nonaka
291ef0536d Recompute PcT with existing PcT for different direction
The text direction can not be fully determined in detached state.
To improve even in that case, compute PrecomputedText from existing
PrecomputedText with new direction.

Here is the performance difference. According to the perf test result,
up to 80% of computation can be recycled from existing PrecomputedText.

android.text.StaticLayoutPerfTest (u sec):
    PrecomputedText Greedy NoHyphenation             :    371 ->    371: (   +0,  +0.0%)
    PrecomputedText Greedy NoHyphenation DirDifferent:  6,923 ->  1,437: (-5486, -79.2%)
    RandomText Greedy NoHyphenation                  :  6,633 ->  6,627: (   -6,  -0.1%)

On the other hand, this CL increase the memory usage of the
PrecomputedText up to 10%. Here is an reference memory usage.

android.text.PrecomputedTextMemoryUsageTest (bytes):
  MemoryUsage
    Arabic Hyphenation                               : 17,135 -> 18,116: ( +981, +5.7%)
    Arabic NoHyphenation                             : 17,135 -> 18,116: ( +981, +5.7%)
    CJK Hyphenation                                  : 29,000 -> 31,584: (+2584, +8.9%)
    CJK NoHyphenation                                : 29,000 -> 31,584: (+2584, +8.9%)
    Latin Hyphenation                                : 16,526 -> 17,185: ( +659, +4.0%)
    Latin NoHyphenation                              : 14,200 -> 14,784: ( +584, +4.1%)

Bug: 119312268
Test: atest CtsWidgetTestCases
Test: atest CtsTextTestCases
Test: atest CtsGraphicsTestCases
Test: minikin_tests

Change-Id: Ia02c201afac5d7d1c086a45f15696f39a6b2a76c
2018-12-10 16:18:02 -08:00
Felipe Leme
507bf13d08 Don't generate VIEW_TEXT_CHANGED events when the TextView is not laid out.
Test: atest android.contentcaptureservice.cts.LoginActivityTest
Bug: 120665079

Change-Id: I148be99d20c1765271f49a8cc286235c09d031b5
2018-12-07 15:45:18 -08:00
Felipe Leme
749b889889 Yet another (major) refactoring on Content Capture and Augmented Autofill.
Bunch of changes:

- Split public SmartSuggestionsService info ContentCaptureService and
  AugmentedAutofillService
- Renamed 'intelligence' packages to either 'contentcapture' or
  'autofil.augmented'
- Renamed internal packages and classes.
- Changed permissions, resource names, etc...
- Moved Augmented Autofill logic from IntelligeceManagerService (R.I.P.) to
  Autofill.
- Optimized IPCs by passing a String instead of the InteractionSessionId
  (that also solves the view -> service dependency).

Test: atest CtsContentCaptureServiceTestCases \
            CtsAutoFillServiceTestCases \
            FrameworksCoreTests:SettingsBackupTest
Test: manual verification with Augmented Autofill Service

Bug: 119638877
Bug: 117944706

Change-Id: I787fc2a0dbd9ad53e4d5edb0d2a9242346e4652d
2018-12-06 16:56:39 -08:00
Sunny Goyal
e3306241d8 Prevent a broken widget from crashing the Launcher
A widget can provide a wrong service intent causing the Launcher
to go in a crash loop

Bug: 115533593
Test: Verified on device
Change-Id: I28666d8559fd23a60fbd3f1539f3b3126a0fa62d
2018-12-06 08:59:43 -08:00
Mihai Popa
6c7ad1d018 Make text cursor drawable public
The CL adds public getter and setters for the drawable used for the
cursor of a TextView.

Bug: 117521190
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I3801ee8642d277c96c094b7d4155e28fc5bcea87
2018-12-06 10:39:34 +00:00
Wu Ahan
2abe8b3b9e Merge "Apply cache and preload mechanism to inline image notifications." 2018-12-06 03:36:05 +00:00
Sunny Goyal
cf8be14d5e Merge "Adding API to specify a dark text specific layout in app-widgets" 2018-12-05 04:12:20 +00:00
Sunny Goyal
c12d31c3b5 Adding API to specify a dark text specific layout in app-widgets
Bug: 109954539
Test: atest CtsAppWidgetTestCases
Change-Id: I785931469888a09685c45949afcf2e3633233c60
2018-12-04 02:33:53 -08:00
Ahan Wu
de396fa85d Apply cache and preload mechanism to inline image notifications.
Inline image will consume 3x memory due to no cache implementation.
This patch apply cache mechanism to each ExpandableNotificationRow and
preloads images before inflation task.

Bug: 77956056
Test: runtest systemui, observe memory usage by AndroidProfiler
Change-Id: I2c488b1d98ddf2d4670904ed4b3e8028c0d0172e
2018-12-04 11:29:31 +08:00
Felipe Leme
ecb08be22e Split IntelligenceManager / IntelligenceService.
This name is too generic, so we split it in 2 parts:

- ContentCaptureManager: the public API used by views and apps to report their
  structure.
- SmartSuggestionsServiec: the system service use to consume these events and
  provide autofill suggestions.

This CL also:

- Optimizes ContentCaptureManager allocation so they are not created on contexts that are not
  capturing events (such as views from the system server).
- Uses a generic ContentCaptureEventsRequest (rather than a list of events) to make it easier
  to be extended.
- Fixed IntelligencePerUserService so it clears the sessions when the
  implementation changes.

Test: manual verification

Bug: 119776618
Bug: 117944706
Bug: 119638877

Change-Id: I069bcd23dda94afe18b2781fd3981b8b555afa56
2018-12-03 15:29:07 -08:00
TreeHugger Robot
595c980722 Merge "Mark GridView mColumnWidth as maxTargetSdk P" 2018-12-03 14:17:45 +00:00
TreeHugger Robot
ae84d11be0 Merge "Mark GridView mNumColumns as maxTargetSdk P" 2018-12-03 14:17:38 +00:00
TreeHugger Robot
5cf6abedcb Merge "Make TextView.isSingleLine public" 2018-11-30 22:42:28 +00:00
Ian Lake
3a46c9cc3e Mark GridView mColumnWidth as maxTargetSdk P
Developers should use the public
getColumnWidth().

Test: m -j
BUG: 117521079
Change-Id: I2e99a441f8ba75ac5f434732b7fd6ebe3e02a57b
2018-11-30 10:59:23 -08:00
Ian Lake
22510215a3 Mark GridView mNumColumns as maxTargetSdk P
Developers should use the public
getNumColumns().

Test: m -j
BUG: 117521080
Change-Id: Ib581f65988a561e30659fc043ee13f2d1e08d4ae
2018-11-30 10:44:44 -08:00
Clara Bayarri
370a1b508f Fix unsupported api usage in NumberPicker
There is unsupported access to the divider. Exposing the
drawable will be tricky as the widget counts on the drawable
being a certain shape and have certain attributes. However we can
easily expose the thickness as a new attribute and document that
you can customize the divider color via XML.

Bug: 117520784
Test: atest NumberPickerTest (with new test)
Change-Id: Ib7a65c055df3b1f68c8327943fa887c89f57e00c
2018-11-30 11:07:08 +00:00