Commit Graph

8049 Commits

Author SHA1 Message Date
Rob Carr
424e875630 Merge changes from topic "sc-destruction-cleanup"
* changes:
  SurfaceControl: Provide Transaction#remove() method.
  Replace SurfaceControl#destroy with #remove
  SurfaceControl: Fix release
2019-02-07 20:45:11 +00:00
Aurimas Liutikas
86ef44bcc7 Merge "Add helper methods for View attribute debugging" 2019-02-07 19:05:20 +00:00
Louis Pullen-Freilich
65650acdbc Merge "Adds FlingRunnable to dark-greylist" 2019-02-07 12:16:58 +00:00
Haoyu Zhang
5ddbae336b Merge "Add trackingBug number to UnsupportedAppUsage of mListeners" 2019-02-07 01:43:17 +00:00
Qasid Sadiq
a7a0578481 Merge "Use map to traverse accessibilityIds instead of the view tree" 2019-02-06 23:54:35 +00:00
Aurimas Liutikas
8f004c85a0 Add helper methods for View attribute debugging
Adding abilities to debug:
- Attribute resolution stack (which resources are looked
  at when resolving an attribute)
- Attribute value source (where did each attribute value
  get defined)
- Get explicit style id (if a view had it set via style="...")

This feature will be behind Settings.Global flag that Android
Studio will set to the debugged application package ID.

Bug: 111439551
Test: atest CtsViewTestCases:android.view.cts.ViewStyleTest
Change-Id: Ib6f9fc81000bb867b5b94a68953c99b0bc802d6c
2019-02-06 14:46:17 -08:00
TreeHugger Robot
437ed07bb1 Merge "UnsupportedAppUsage AbsListView#mOnScrollListener" 2019-02-06 21:53:01 +00:00
Haoyu Zhang
7db39b400a Add trackingBug number to UnsupportedAppUsage of mListeners
mListeners is used by developers to resolve a memory leak bug
and it was fixed before. But there are still a very high amount
usage of this Non-SDK API. So we can't put them into darklist.

Bug: 123769451
Test: atest TextViewTest
Change-Id: I7ba822e94d290fd99189970da0a4bf7bfa52d64b
2019-02-06 11:29:58 -08:00
Louis Pullen-Freilich
f0955ac71f Adds FlingRunnable to dark-greylist
To stop a scroll early, developers should instead use AbsListView#smoothScrollBy(0,0)
To start a specific fling, developers should instead use AbsListView#fling(int)
For any further customization, developers should migrate to using
and customizing RecyclerView

Bug: b/123769448
Bug: b/123769453
Bug: b/123769380
Test: n/a
Change-Id: I08a773c3fa70270ddc9f4e36dcbc64c64f7336de
2019-02-06 19:29:34 +00:00
TreeHugger Robot
3a8257bbc5 Merge "Restrict access to mRequestedNumColumns." 2019-02-06 19:07:44 +00:00
TreeHugger Robot
cc80396b9c Merge "Added a ScrollView#scrollToDescendant() API." 2019-02-06 18:50:59 +00:00
Siyamed Sinir
abb20bebd6 Merge "Blacklist TextView.mCurTextColor" 2019-02-06 18:02:14 +00:00
Filip Pavlis
669a752a7c Restrict access to mRequestedNumColumns.
There is little value in exposing this as public API as general users
of the GridView have this value as they had to set it via setNumColumns.
Also classes extending GridView can keep track of this value by
overriding setNumColumns.

At the same time I don't see much motivation in needing the value as it
is only used in private method determineColumns.

Also the amount of usage of this field is really low.

Bug: b/123769395
Test: N/A
Change-Id: I0996cd1df2d1c3394b17333762a19a057005137a
2019-02-06 16:59:18 +00:00
Mihai Popa
cbc059d713 Enable changing ProgressBar min/max width/height
The CL adds getters and setters for the min/max width/height attributes
of ProgressBar. This could be already specified in xml, but not post
inflation.

Bug: 123769470
Test: atest android.widget.cts.ProgressBarTest
Change-Id: I3bb4992da0c34cd88078588253ef6789fa8f1856
2019-02-06 15:13:01 +00:00
Yohei Yukawa
0115ac1272 Honor text-operation user in "Add to dictionary"
This is a follow up CL to my previous CL [1], which introduced a
concept of "text-operation user" into TextView then plumbed it to IME
APIs and spell checker APIs as a short term workaround for System UI's
hosting multiple users' text contents in user 0 process.

With this CL, "Add to dictionary" menu item for misspelled words also
takes this text-operation user into account.

 [1]: I6d11e4d6a84570bc2991a8552349e8b216b0d139
      401e3d4c84

Fix: 123955642
Test: Manually done as follows.
   1. Build aosp_taimen-userdebug and flash it.
   2. adb shell pm create-user test_user
   3. adb shell am switch-user 10
   4. make -j EditTextVariations
   5. adb install -r \
        $ANDROID_TARGET_OUT_TESTCASES/EditTextVariations/EditTextVariations.apk
   6. adb shell am start \
        -n com.android.inputmethod.tools.edittextvariations/.EditTextVariations
   7. Tap the menu icon on the EditTextVariations then click "Direct Reply"
   8. Open notification shade.
   9. Tap reply icon on "Message from UserHandle{10}".
  10. Type "gggg".
  11. Make sure a red underline is shown.
  12. Tap "gggg".
  13. Make sure a dropdown UI is shown below "gggg".
  14. Tap "ADD TO DICTIONARY"
  15. Dismiss the notification shade.
  16. Make sure "Add to dictionary" dialog is shown.
Change-Id: Iaf11cd7e54636ab552e2469006e120e39dca99a8
2019-02-05 22:27:20 -08:00
Qasid Ahmad Sadiq
834787afb6 Use map to traverse accessibilityIds instead of the view tree
This is the first step to a few things including allowing for virtual nodes to have view backed descendants and siblings.
The main change in findViewByAccessibilityId SPI (its changed name and location, but it still is effectively the same thing) is that if something has a nodeProvider it will now still return view children.
I sifted through each use of the SPI and determined if they were an issue, and cleaned up any code in the process (Autofill cleanup is coming in a different CL).

Test: added a few simple unit tests, used talkback on system in a few places including virtual views, atest accessibility*, cts accessibility* (There were some failures here but they don't seem to be caused by this change, those are captured in these bugs b/120628276 b/120890822), CtsAutoFillServiceTestCases
Bug: 37714287

Change-Id: Id5807114fbb4c932eaea275dc2d94d0dbe25a8ae
2019-02-06 01:06:08 +00:00
Nader Jawad
599a0e2ad2 UnsupportedAppUsage AbsListView#mOnScrollListener
Updated @UnsupportedAppUsage annotation with maxTargetSdk as well
as corresponding tracking bug

Change-Id: I49b527fcd5d7cc67c3163adcd70a596b3e398ff7
Fixes: 123769353
Test: N/A
2019-02-05 16:54:22 -08:00
TreeHugger Robot
bdbfcebca6 Merge "Restrict reflection for ProgressBar#mIndeterminate" 2019-02-05 23:47:55 +00:00
Siyamed Sinir
403693bc41 Blacklist TextView.mCurTextColor
setTextColor/getCurrentTextColor should be used instead.

Test: None
Bug: 123769356
Change-Id: Ic31897632fb7a32e7f653a7bc0ad3655379a70db
2019-02-05 13:38:52 -08:00
Adam Powell
841133661f Restrict reflection for ProgressBar#mIndeterminate
Change-Id: Ie60de396a7f57be57caa9abdec5e24f3f8a04b10
Fixes: 123769456
2019-02-05 13:32:47 -08:00
Robert Carr
5ea304db74 Replace SurfaceControl#destroy with #remove
Because there may be other references, #destroy does
not actually destroy a Surface. We try and make this more clear
in the naming.

Bug: 111297488
Test: Builds
Change-Id: I3a395abf4449de27fac298e37a96eb54c204c42f
2019-02-05 13:29:16 -08:00
Ashley Rose
2879c9c95f Merge "@InspectableProperty coverage for android.widget" 2019-02-05 21:03:00 +00:00
TreeHugger Robot
6a98b6d236 Merge "Add PopupMenu#setForceShowIcon" 2019-02-05 20:00:57 +00:00
TreeHugger Robot
d25105a54d Merge "Restrict usage of PopupWindow::mOverlayAnchor" 2019-02-05 19:47:29 +00:00
Louis Pullen-Freilich
87dd8aa97d Merge "Adds comment to dark-greylisted mShowCursor" 2019-02-05 19:46:22 +00:00
Rahul Ravikumar
6d21df2e2b Added a ScrollView#scrollToDescendant() API.
* Eliminates the need for a reflective call to Landroid/widget/ScrollView;->mChildToScrollTo:Landroid/view/View;

Test: Added CTS tests.
Fixes: b/123769715

Change-Id: If28891cdeda3c13c3dd5d9b4faf697543311590a
2019-02-05 11:14:18 -08:00
Mihai Popa
da59e1da16 Add PopupMenu#setForceShowIcon
The API enables developers to display icons for menu items. Before this,
the common workaround was to reflect in MenuPopupHelper (non-public
class), and call setForceShowIcon there.

Bug: 123769396
Test: atest android.widget.cts.PopupMenuTest
Change-Id: If4ef46bc7786a2e7e756a9b15c81147e0cce1090
2019-02-05 17:20:21 +00:00
TreeHugger Robot
cc2237d2f7 Merge "Restrict RemoteViews unsupported app usage" 2019-02-05 17:02:24 +00:00
Louis Pullen-Freilich
1c400a3ad9 Adds comment to dark-greylisted mShowCursor
Bug: b/123769485
Test: n/a
Change-Id: Ice7dbcc92456507def621ef50602519f81dd6c12
2019-02-05 16:46:38 +00:00
Matvei Malkov
40001ded9d Restrict usage of PopupWindow::mOverlayAnchor
The field mOverlayAnchor has getter and setter since API 23 and it's a
recommended way to access and set this field. All the usages from
opensource is mostly AppCompatPopupWindow forks (some with version
check, some are not), so they can easily migrate to getter and setters.

Bug: 123768692
Test: PopupWindow and PopupMenu tests passed
Change-Id: Ida3077b17a043b2acf2d89456e4501d7ed052e4e
2019-02-05 14:19:51 +00:00
Ashley Rose
55f9f92545 @InspectableProperty coverage for android.widget
A few getters for view properties have been added where they were
missing. CTS tests for the new APIs are pending in b/123894719.

Test: m framework
Bug: 120492712
Change-Id: I743ce693d384eaf749ced3db7f81bda7d19ed275
2019-02-04 19:11:56 -05:00
Adam Powell
f4d604feed Restrict RemoteViews unsupported app usage
Bug: 123769709
Bug: 123769713
Bug: 123769498
Bug: 123769458
Change-Id: I0338faaa26a7196457f8719480ee487820993d86
2019-02-04 15:28:42 -08:00
TreeHugger Robot
282e869f42 Merge "Restrict reflection access to INotificationManager from Toast" 2019-02-04 23:02:47 +00:00
Adam Powell
c7ac9f01f3 Restrict reflection access to INotificationManager from Toast
Bug: 123768917
Change-Id: Ice757d9f10f08f6d50dc34ca5c459e44d1ade10d
2019-02-04 13:33:23 -08:00
TreeHugger Robot
779cd543e2 Merge "Adds mShowCursor to dark-grey list above P" 2019-02-04 21:27:50 +00:00
Louis Pullen-Freilich
d6da1ffb50 Adds mShowCursor to dark-grey list above P
This was being used by developers to work out when to 'blink' their
custom cursors using custom drawables. Now that TextView has a
setTextCursorDrawable method, developers should use that instead to set
a custom cursor, and shouldn't need to reflect on this value. If they
still need more customization than setting a custom drawable, they
should handle the blinking themselves - no need to reflect on an
internal timestamp.

Bug: b/123769485
Test: n/a
Change-Id: I7817b2b83b19a3fdb8922c718720dd9ca5e8b291
2019-02-04 17:17:59 +00:00
Yohei Yukawa
ca9376cc4b Make Editor.SuggestionsPopupWindow private again
Editor.SuggestionsPopupWindow was originally introduced as a private
class [1], then we made it public [2] so that a test class can access
it, but that test was later updated [3] and now doesn't have any
direct dependency on Editor.SuggestionsPopupWindow.

In short, we can make Editor.SuggestionsPopupWindow a private class
again without losing anything.  This actually addresses the following
warning from doclava.

   Public class android.widget.Editor.SuggestionsPopupWindow
   extends private class android.widget.Editor.PinnedPopupWindow

There should be no behavior change.

 [1]: If863107681ce82a1639f21315878f830c2991fb7
      6934044fd7
 [2]: Idf166cbecb3e33be213e4104cf1afd827906f2ad
      a60160b30b
 [3]: I12e522436a83fa264cd22176d054877eec411708
      31eb74fb2b

Fix: 117519592
Test: No doclava warning regarding SuggestionsPopupWindow during full build
Change-Id: Ie722156d3819d05d3cd479527abb8b4750b332f7
2019-02-01 23:38:30 -08:00
Mihai Popa
88fbed49af [Magnifier-77] Show it on long press selection
Before this CL, the TextView magnifier was shown when selecting text,
but only when a selection handle was explicitly grabbed. This CL also enables
the magnifier when selection is performed by dragging after long press.

Bug: 119819194
Test: manual testing
Change-Id: I415a9c4a91da765db83a3755264b2b19679d0878
2019-02-01 18:13:01 +00:00
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