TextClassifier methods now take a @Nullable Options parameter which
is a container for optional parameters to its methods.
This way, if we need to pass an optional parameter to one of
TextClassifier's methods, we won't have to overload the method.
Instead, we'll introduce a new Options field.
This CL also adds a hidden optional field for suggestSelection.
This is used to make sure that "dark launched" models do not return
new selection indices to clients. Clients e.g. TextView that are
dark-launch aware may use the field to explicitly request for
dark-launch results.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Test: Also see I843eadff8a2b674388055364c1f25c8d4ccea771
Change-Id: I58e44451ac8a8e3a5bc3959198447f5549870902
Fixes several issues with the way PendingIntents are being whitelisted
from background check with Notifications. Most visibly, this causes the
whitelisting not to work on Notifications that use the DecoratedContentViewStyle,
but there are some conditions where the whitelisting breaks for regular
notifications too.
- After a Notification is rebuilt with Notification.Builder, the set
of PendingIntents in the notification was not rebuilt.
This broke the whitelisting whenever a PendingIntent is added after
the Notification was already sent once. Workaround for broken platform
releases: always use a fresh Notification object, or clone before
sending.
- Fixes PendingIntent.writePendingIntentOrNullToParcel to invoke the
OnMarshalListener.
This broke whitelisting for any PendingIntents attached to custom
RemoteViews. Workaround for broken platform releases: Also attach
the PendingIntent to the Notification's extras.
- Changes RemoteViews to keep the parcel cookies that were present
during unparceling, such that they can be reapplied when it gets
cloned.
This broke whitelisting for any PendingIntents attached to a
DecoratedContentViewStyle *even if added to extras*. Workaround
for broken platform releases: none.
- Fixes Notification.whitelistToken mistakenly being static.
There's an unlikely race condition where the field could be
overriden with null by an incoming notification right as another
notification is sent out. Workaround for broken platform releases:
none.
Test: runtest -x core/tests/coretests/src/android/app/NotificationTest.java && runtest -x core/tests/coretests/src/android/widget/RemoteViewsTest.java
Bug: 68218899
Change-Id: I02e44040604a1d24422340611ae9e0332a611800
Bug: 68049162
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I831e6933b584a2999f159dc2d80113ea9ba717f8
* 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
* 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
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
Fixes in framework include:
- ListPopupWindow requests focus for itself so it can receive
MENU key.
- PopupWindow uses setTransitionVisibility to avoid losing
focus upon enter transition.
- First-traversal will explicitly handle FOCUS_AFTER_DESCENDANTS
on the current focus if applicable -- details in code comment.
Fixes in tests usually just required focusing what they expected
to have initial focus; however, there were a couple tests that
had been broken for other reasons for a long time.
app.cts.ActionBarTest
app.cts.ToolbarActionBarTest
android.view.DisabledLongpressTest
android.widget.scroll.arrowscroll.ShortButtonsTest
android.view.VisibilityTest
android.widget.listview.ListScrollListenerTest
android.widget.listview.arrowscroll.ListOfThinItemsTest
andorid.widget.listview.arrowscroll.ListWithNoFadingEdgeTest
android.view.LongpressTest
android.widget.focus.ScrollingThroughListOfFocusablesTest
android.widget.gridview.GridScrollListenerTest
Bug: 67467972
Test: Failing tests should pass now.
Change-Id: I9e2fbfeb183eb777f35c67eca53e1f70809b7670
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
* 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
- 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
* 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
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
Merged-In: Iacc561c8ee004b0123de66ad1ee06b1f56b4e4b4
Change-Id: Iacc561c8ee004b0123de66ad1ee06b1f56b4e4b4
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
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
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
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
* 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
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.
Fixes: 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
Merged-In: Iabc8279fa57ef6a9a2db0c7e9c7e3ab8c131bf02
Change-Id: Iabc8279fa57ef6a9a2db0c7e9c7e3ab8c131bf02
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
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
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
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
> 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
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
Merged-In: Id8bdc062ecf21cc14810586580fef9052672cfd8
Change-Id: Id8bdc062ecf21cc14810586580fef9052672cfd8
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