Commit Graph

7926 Commits

Author SHA1 Message Date
Mihai Popa
db68c543ca Fix handle creation on startActionMode
The CL fixes a null pointer exception happening when the selection
controller in Editor is created on startActionMode. The NPE was
introduced by I261559b5c1abe21fd8508ab72f24a5696899a074, which removed
the handle drawable loading before using the drawables for creating the
handles. The current CL adds the handle drawable loading back.

Bug: 119214395
Bug: 119189742
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: atest android.widget.TextViewActivityTest
Test: atest android.widget.TextViewTest
Change-Id: Iba5f6b606b1aaf2124487da5642c6f3b132a061c
2018-11-08 15:53:45 +00:00
Jorim Jaggi
05ac00c630 Merge changes from topic "windowinsets-api"
* changes:
  WindowInsets: Annotate nullability
  WindowInsets: Add Builder
  WindowInsets: reimplement WindowInsets on top of Insets
  WindowInsets: make WindowInsets.inset() public
2018-11-07 16:35:06 +00:00
Mihai Popa
33e8c93551 Merge "Make text handle drawables public" 2018-11-03 13:51:15 +00:00
Mihai Popa
6315a322b2 Make text handle drawables public
The CL adds public setters and getters for the drawables used
for the insertion and selection handles of a TextView.

Bug: 117521469
Bug: 79404656
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I261559b5c1abe21fd8508ab72f24a5696899a074
2018-11-02 11:54:43 +00:00
Adrian Roos
60f59298c7 WindowInsets: reimplement WindowInsets on top of Insets
Bug: 111829774
Test: atest WindowInsetsTest
Change-Id: Ic01c6cd46981af2e457c740c35b17c8cc9c8d25a
2018-10-30 19:09:03 +01:00
Sunny Goyal
43c970436d Adding shared element transitions support in AppWidgets
Bug: 113071278
Test: atest frameworks/base/core/tests/coretests/src/android/widget/RemoteViewsTest.java
Change-Id: I0d7698faa8d9e61913b55d34de8b7cfbb32863b1
2018-10-29 17:04:33 -07:00
John Reck
c7ddcf390f Update some docs & tweak some method names
Test: builds
Change-Id: Id0e5cf6fdb3a391136a1d314498f75e0b954ceeb
2018-10-26 13:57:12 -07:00
John Reck
8884cfc13e Merge "Rename & package shuffle" 2018-10-23 20:02:00 +00:00
Seigo Nonaka
9958c4ab21 Introduce FontStyle for future extensibility
This is a ground work for b/114479228
FontStyle is an argument of the font itemization. Currently Android
system uses weight and italic info for itemizing but maybe we will
use width and oblique style in future.
To be extensible in future, introduce FontStyle.

This CL includes:
- new class FontStyle which holds width and italic at this moment. In
  future, we may add width and oblique. (or grdual italic slant)
- Font class still returns weight/slant since they need to be immutable.
- Moved font weight constants from Font to FontStyle

Bug: 114479228
Test: atest CtsGraphicsTestCases
Change-Id: I0ba717fbf9f90ee6f760c1a0f6eda17b4bef6f43
2018-10-19 14:51:59 -07:00
Haoyu Zhang
0a04650e51 Merge "Add textLocale attributes to TextView and TextAppearanceSpan" 2018-10-19 20:30:02 +00:00
Haoyu Zhang
1137512f7c Add textLocale attributes to TextView and TextAppearanceSpan
Bug: 112390716
Test: atest TextAppearanceSpanTest TextViewTest
Change-Id: I812f76cc3acec14b9839436cc7c5cc1ef827998e
2018-10-18 15:38:30 -07:00
TreeHugger Robot
b3a793d969 Merge "Add activity options flag to force launching an activity in a new task" 2018-10-18 20:31:30 +00:00
TreeHugger Robot
02f2a315d7 Merge "Add Context.getDisplayId() to avoid possible IPC" 2018-10-16 00:20:52 +00:00
Gus Prevas
9cc966012f Fixes touch ripples on media buttons.
This change makes touch ripples appear correctly on the action buttons
on media notifications.  This involves the following changes:

- NotificationViewWrapper.onReinflated() sets the notification content
root's background to transparent rather than null when transferring the
background color to the NotificationBackgroundView.  This gives the
ripples a surface to draw on.
- The RemoteViews for the media templates are changed to use a fixed
set of buttons instead of removing and re-adding them on every update.
This prevents the update caused by whatever action the tap invokes from
interrupting the ripples.
- A method is added to RemoteViews allowing the ripple color to be
specified.  This allows us to change the ripple color to match the
foreground color of the controls, which is necessary for the ripples to
show up against a dark background.

Test: manual
Change-Id: I907f9a1a75efb48da496133ad357fc5150de4410
Fixes: 35856702
2018-10-15 09:42:06 -04:00
Yohei Yukawa
5281b6b4c0 Add Context.getDisplayId() to avoid possible IPC
ContextImpl has an internal rule that when ContextImpl#mDisplay is
null the Context is associated with the default display.  The problem
is that, as discussed in Bug 117709581, when ContextImpl#mDisplay is
null ContextImpl#getDisplay() tries to get some non-null Display
object by making an IPC to the system server, which is redundant when
the display ID is the only thing that the caller wants to know.

By having an @hide method Context.getDisplayId(), we can ensure that
display ID can be obtained without any IPC.  This enables us to
re-submit my CL [1] that aimed to instantiate InputMethodManager (IMM)
for each display but then got reverted due to a performance regression
(Bug 117434607).

There should be no developer-observable behavior change.

 [1]: I7242e765426353672823fcc8277f20ac361930d7
      c53d78e992

Fix: 117712745
Test: atest FrameworksCoreTests:android.content.ContextTest
Test: prebuilts/checkstyle/checkstyle.py -f \
      frameworks/base/core/tests/coretests/src/android/content/ContextTest.java
Change-Id: I2534530a5ce90e2620c5039d793a6454a0a1e154
2018-10-15 07:38:25 +08:00
Haoyu Zhang
5dfae05460 Change TextView.TextAppearanceAttributes.mStyleIndex to mTextStyle
Currently mStyleIndex is used as a flag int, but its default value is -1.
Rename it to mTextStyle and change the default value to 0 in order to avoid confusion.
Also fix the bug that when fontWeight is specified while not textStyle is
specified in XML, the typeface unexpectedly becomes italic.

Bug: 78873447
Test: atest TextViewTest
Change-Id: I819b8f15e1dcaae7b16f7c97b489b4ed8db494c6
2018-10-10 18:32:44 +00:00
John Reck
32f140aa67 Rename & package shuffle
Rename DisplayListCanvas -> RecordingCanvas
Move RecordingCanvas to android.graphics
Move RenderNode to android.graphics

Bug: 112709971
Test: make & boot
Change-Id: Iddeb6a89f8923ea81a1f37bbee4e9b1db8ede238
2018-10-04 16:18:12 -07:00
Mihai Popa
3d71e1f388 Merge "[Magnifier-63] Hide it for rotated/scaled textview" 2018-10-03 10:19:50 +00:00
Felipe Leme
77f85861e1 Removed afm.notifyValueChanged() optimization.
On Android P, TextView was keeping track of the last mText that was sent to
AutofillManager to avoid calling it again if the value didn't change, as that
would incur on unnecessary IPC calls from AFM to AFMService in the UIThread.

Now on Android Q this optimization is causing the method to not be called when
it should when the mText is a reference to a SpannableStringBuilder, as it's
equals() method now returns true in this case (before it was returning false,
which was a bug: if the reference didn't change, it should return true).

We have 2 options to solve this problem:

1.Fix TextView to keep a String copy of mText.
2.Remove the optimization.

This CL fixes it using #2, for 2 reasons:

1.On Android Q, the AFM calls to AFMS are async, so it's not a jankiness issue
anymore.
2.Making a copy will actually be *worse* for performance, as it would be making
an unnecessary copy for the cases where autofill is disabled.

Test: atest android.autofillservice.cts.DatasetFilteringTest#testFilter_usingKeyboard
Test: atest CtsAutoFillServiceTestCases # to make sure it didn't break anything
Fixes: 117106046

Change-Id: Ia1c69e2d7a478288f65566e862f4a43e88eca463
2018-10-01 18:14:14 -07:00
Mihai Popa
ddf9fe01be [Magnifier-63] Hide it for rotated/scaled textview
The magnifier is currently behaving badly when the magnified view is
scaled and/or rotated - the content of the magnifier and its position
are wrong, as we do not take these into account when computing
coordinates for content copy and magnifier positioning. This CL is
making the magnifier remain hidden when such transformations are applied
to the magnified view or a view above it in the view hierarchy.

Bug: 112519631
Test: manual testing
Change-Id: Ibb81fdc9d2ec8ba14914166e408c92a3aad7e312
2018-10-01 14:25:53 +01:00
Andrey Kulikov
72be97465a Fix ChangeImageTransform for drawables without intrinsic size
Bug: 68489306

If we use a drawable like ColorDrawable for an ImageView it has intrinsicWidth and intrinsicHeight == -1.

1) Simplified matrix calculation in ChangeImageTransform.captureValues. It makes no sense to return null as a matrix because later in createAnimator it will be considered as the identity matrix. For cases when drawableSize == -1 instead we can just use view.getImageMatrix() which would be the identity matrix.
2) There is an additional check in createAnimator() to start an empty animation if the drawable width or height is 0. But actually it worth to use it also for cases when width or height is -1, as if it goes into else branch matrix transformations will try to incorrectly change the bounds of the drawable to (0, 0, -1, -1).
3) And also actually there is a bug in createNullAnimator() method, we can't provide nulls as values for ObjectAnimator.ofObject, as later it will crash on PropertyValuesHolder.setObjectValues(Object... values) because of "values[0].getClass()". So I changed it to provide some nonnull values like Matrix.IDENTITY_MATRIX. It is not important what to provide here as NULL_MATRIX_EVALUATOR will not use the values anyway.
4) Also I found a bug in ImageView.animateTransform(). If we provide null matrix if will try to update the drawable bounds to the view size but will not take into account paddings(in the same way like configureBounds()).

Test: Tested manually on the sample app from the bug and added new tests for both cases: with view bounds change and without it
Change-Id: I0750de56f4a011e06b340ed342884b59896d92dc
2018-09-28 19:40:22 +00:00
Winson Chung
d070775c94 Add activity options flag to force launching an activity in a new task
- This is to work around issues where the caller (ie. RemoteViews) is
  launching a provided pending intent that is immutable and still needs
  to ensure that it is launched in a separate task.

Bug: 112508020
Test: Launch an immutable pending intent from a widget and ensure it
      launches in a new task as expected

Change-Id: I70c318674da15a78418548ee719cb1257f899ac6
2018-09-28 11:22:29 -07:00
TreeHugger Robot
4bb9a2e54b Merge "Add missing TextView attributes to JavaDoc" 2018-09-27 00:36:30 +00:00
Siyamed Sinir
8d14105d8c Add missing TextView attributes to JavaDoc
Test: m offline-sdk-docs
Bug: 79477441
Change-Id: I0f994008fc58ac5ddf764c286f92d20a4c4a23a4
2018-09-26 15:32:04 -07:00
Mihai Popa
8b3002e769 Merge "[Magnifier-62] Deprecate constructor" 2018-09-25 16:05:17 +00:00
Mihai Popa
b6ca909ed7 [Magnifier-62] Deprecate constructor
The CL deprecates the old constructor for Magnifier instances in favor
of the usage of builder Magnifier#Builder.

Bug: 116116502
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I3daa9f066c77144e9d5c62bc666ecd37041f4bbb
2018-09-25 11:35:52 +01:00
David Castro
cab85f3b2a Merge "docs: Removes reference to the clock displaying seconds" into pi-dev am: 02bc7c2228
am: 8bb6b0a7fc

Change-Id: I8dd5b5aa1590cf2179b03024184b283663a07df1
2018-09-21 15:17:30 -07:00
David Castro
8bb6b0a7fc Merge "docs: Removes reference to the clock displaying seconds" into pi-dev
am: 02bc7c2228

Change-Id: If238e952c1a923f7ac5c251c7e5c2429bf890ddd
2018-09-21 12:53:01 -07:00
TreeHugger Robot
02bc7c2228 Merge "docs: Removes reference to the clock displaying seconds" into pi-dev 2018-09-21 19:40:38 +00:00
Seigo Nonaka
16cd61459c Merge "Unhide getTextRunCursor APIs" 2018-09-19 20:18:32 +00:00
TreeHugger Robot
173222142f Merge "Always use Context.getSystemService() to get IMM" 2018-09-18 22:25:52 +00:00
Seigo Nonaka
fa95b83df7 Unhide getTextRunCursor APIs
This API is necessary for identifying the cursor locations.

Bug: 112327179
Test: atest android.graphics.cts.PaintTest
Change-Id: Ief6770bd622a296ae356094fe3ce58e9c4371088
2018-09-18 15:06:19 -07:00
kopriva
64c4523ed4 Merge "docs: fixed five typos" into pi-dev am: 82b413428e
am: d366837e05

Change-Id: I0cf5630bc936c872ca936f2d3de9e8aaa509f083
2018-09-18 12:10:35 -07:00
kopriva
d366837e05 Merge "docs: fixed five typos" into pi-dev
am: 82b413428e

Change-Id: I4af571d6bcfa151235223b51cb8135fbacb62c82
2018-09-18 12:00:24 -07:00
Yohei Yukawa
484d4afc92 Always use Context.getSystemService() to get IMM
This is a preparation to deprecate the following two methods.

 * InputMethodManager#getInstance()
 * InputMethodManager#peekInstance()

Since we soon need to stop relying on the current per-process
InputMethodManager singleton model to fully support multi-display,
those two methods really need to be deprecated.

With this CL, framework code no longer depends on
InputMethodManager#peekInstance(), which is also marked as deprecated
in this CL.

InputMethodManager#getInstance() is a bit tricky because it also works
as a constructor of such a per-process singleton instance.  Remaining
two call-sites of this method will be migrated in a subsequent CL.

This is a mechanical refactoring, which in theory should have no
observable logical behavior difference.

There could be a small performance regression, but it is basically not
avoidable to correctly support multi-display scenarios.

Bug: 115891476
Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases
Test: atest CtsWidgetTestCases:android.widget.cts.EditTextTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: atest FrameworksCoreTests:com.android.internal.inputmethod
Test: atest FrameworksServicesTests:com.android.server.textservices
Change-Id: I5db31491f3d47d3ad4a621e956995135c72e007b
2018-09-17 16:47:08 -07:00
kopriva
7ecfe31427 docs: fixed five typos
Test: make ds-docs

Bug: 37095452
Bug: 37001217
Bug: 37004068
Bug: 37015340
Bug: 37044652

Change-Id: Ib305df88b63286810d7722e73321ddb238b45e8e
Exempt-From-Owner-Approval: Docs-only change
2018-09-17 15:17:50 -07:00
David Castro
3e10355b99 docs: Removes reference to the clock displaying seconds
Test: make ds-docs

Bug: 115691112

Change-Id: Ic87d6c2806b20ed682ad0ca7e8e52e8096c9ac07
Exempt-From-Owner-Approval: Docs-only change
2018-09-17 09:38:14 -04:00
Mathew Inwood
db0657a4f4 Merge "Move some members to the "Q blacklist"." 2018-09-14 13:54:28 +00:00
Mathew Inwood
8c854f86a4 Move some members to the "Q blacklist".
Based on some analysis, these fields/methods are likely false positives.
Set maxTargetSdk=P so that any apps using them are required to migrate off
them in future. See the bug for more details.

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: I719b5c94e5b1f4fa562dd5d655953422958ad37e
2018-09-14 13:18:34 +01:00
kopriva
eac0905c11 docs: fixed instances of typo in 'overridden' am: debd4ee72d
am: 9b641cbc71

Change-Id: I071643e73656a2a17a3c0ab89ffacda9c1bfec80
2018-09-13 15:11:27 -07:00
kopriva
9b641cbc71 docs: fixed instances of typo in 'overridden'
am: debd4ee72d

Change-Id: Idde6240486463dee51cdc27b8cd066a80fb869e0
2018-09-13 14:57:25 -07:00
kopriva
debd4ee72d docs: fixed instances of typo in 'overridden'
This affects several files beyond those mentioned in the bug.

I didn't fix some instances because the files had code
problems that blocked presubmit checks.

Test: make ds-docs

Bug: 37094741

Change-Id: I642f0384fef2b267ebc970bae1b4fb90bae667e7
Exempt-From-Owner-Approval: Docs-only change
2018-09-13 11:40:59 -07:00
Haoyu Zhang
0ed64376e4 Merge "Add Missing fontVariationSetting attr Javadoc" 2018-09-12 12:13:17 +00:00
Haoyu Zhang
aff7bd76ec Add Missing fontVariationSetting attr Javadoc
Bug: 79477441
Test: m offline-sdk-docs
Change-Id: I6d40f6f176674e0b08434e997c4c4a0b66fe6f78
2018-09-12 12:13:04 +00:00
Seigo Nonaka
a8fab8acdb Move maximum weight constant from Typeface to Font and make it public
Now we have Font class. It is good to move max weight constant from
Typeface to Font.

Bug: 112327179
Test: atest FontTest

Change-Id: I3946ac150a02bf0cafa0fc81e61e69c31b45ed1d
2018-09-10 10:34:23 -07:00
Haoyu Zhang
f0e6794cae Merge "Add fontVariationSettings to TextView and TextAppearance in XML" 2018-09-07 17:43:47 +00:00
Nader Jawad
071149a9e7 API Review: StateListDrawables#getDrawableForState
Renamed getStateDrawableIndex to findStateDrawableIndex
based on API review feedback.

Change-Id: If07fe279fb02bc8180a28c7f58ea84ca030773ad
Fixes: 113856171
Test: Re-ran CTS
2018-09-05 17:28:37 +00:00
TreeHugger Robot
a8aaa38d51 Merge "[Magnifier-60] Fix race condition after #dismiss" 2018-09-04 14:37:19 +00:00
Mihai Popa
ddcd54813b [Magnifier-60] Fix race condition after #dismiss
The CL fixes a race condition introduced by
I2799229bee7acfbd6236089487a5766f46605366, which caused apps to crash
when, for example, the following happened:
 1. #show(xc, yc, xm, ym) is called on the main thread, and the
    arguments are stored in mPrevShow[Source/Window]Coords
 2. #show(xc, yc, xm', ym') is called on the main thread (note that only
    the window position is different from the previous call), and we
    post a job to the pixel copy handler thread to only update the
    expected position of mWindow (without doing pixel copy)
 3. the job starts and checks that mWindow != currentWindowInstance is
    false
 4. #dismiss() is called on the main thread, mWindow is set to null
 5. the position update job at step 3 continues, grabs mLock but now mWindow is null
    and the crash happens

Bug: 113272299
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: Ibc815888f4eeaf077fa1a9ddfb1d4d401382623a
2018-09-03 17:56:27 +01:00
Haoyu Zhang
d62697075d Add fontVariationSettings to TextView and TextAppearance in XML
Bug: 73235218
Test: atest TextViewFontVariationTest
Change-Id: Ic284846919b1c58dc696a140b59b3244491c774e
2018-08-31 12:09:44 -07:00