Commit Graph

7975 Commits

Author SHA1 Message Date
Seigo Nonaka
ab11e00449 Merge "Recompute PcT with existing PcT for different direction" 2018-12-12 11:34:13 +00: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
qqd
153257115a Make TextView.isSingleLine public
Bug: 117521096
Test: Added new CTS tests under cts.TextViewTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: Ib19277767c69fb2bf92d2387738dbb228f31f502
2018-11-30 01:31:22 +00:00
Vishnu Nair
9a42260be4 Merge "WM: Removes setSize from buffer-less surfaces" 2018-11-29 16:14:19 +00:00
TreeHugger Robot
8ce7d1d992 Merge "Add onActionClicked in NotificationAssistantService" 2018-11-29 15:43:29 +00:00
Tony Mak
7d4b3a5f19 Add onActionClicked in NotificationAssistantService
This is added to report clicks on actions buttons to NAS.

BUG: 119010281
Test: atest SystemUITests
Test: atest RemoteViewsTest
Test: atest NotificationManagerServiceTest
Test: Manual. Tapped on the action (both normal and contextual) and
      observed the log.

Change-Id: I381994737d8c3185d3fabf9b6c481fd01a89a634
2018-11-29 11:43:53 +00:00
Vishnu Nair
e86bd98a8b WM: Removes setSize from buffer-less surfaces
- Make a better distinction between surface bounds and buffer size by renaming setSize to
  setBufferSize and removing setSize for all buffer-less surfaces.
- Adds an error check in SurfaceControl to ensure buffer size is only set for buffer-less surfaces.
- Updates color fade surface to use passed in transaction object.

Bug:114413815
Test: go/wm-smoke
Test: atest FrameworksServicesTests:DimmerTests
Test: atest FrameworksServicesTests:SurfaceAnimatorTest
Change-Id: I88bd1452d6b3b3009e73e26986027d6a5a9efebc
2018-11-28 14:24:03 -08:00
Siyamed Sinir
a1e851c873 Make TextView.getTextDirectionHeuristic public
Test: Added new CTS tests under cts.TextViewTest
Test: atest CtsWidgetTestCases:android.widget.cts.TextViewTest

Bug: 117521460
Change-Id: I27391f69f2387cc761a7fc859423bd921601bea9
2018-11-27 17:59:18 -08:00
Abodunrinwa Toki
f14f2b63dc Merge "Do not linkify text with RLO/LRO characters." 2018-11-27 20:19:35 +00:00
TreeHugger Robot
2bad68cd1a Merge "Fixed when IntelligenceManager.notifyAppeared()/disappeared() is called." 2018-11-27 19:30:48 +00:00
TreeHugger Robot
02fc5ccc54 Merge "Made ImageView.animateTransform(Matrix) public" 2018-11-27 19:09:24 +00:00
Andrey Kulikov
3ac312acf0 Made ImageView.animateTransform(Matrix) public
ImageView.animateTransform(Matrix) is now public so we can use it in AndroidX Transitions without a reflection.
Also I fixed a bug that we forgot to clear mDrawMatrix when we provide null matrix into a method. Before it doesn't work as expected if ImageView already calculated some draw matix and we wan't to override it.

Bug: 117521477
Test: Added new cts tests for both usages with null and not null matrix
Change-Id: I9e25e1f673fabdfeb227fabc0b3635056de0a6fd
2018-11-27 15:52:17 +00:00
Abodunrinwa Toki
adc194032b 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.TextClassifierTest \
            android.text.util.cts.LinkifyTest \
	    android.text.util.LinkifyTest \
	    android.widget.TextViewActivityTest

Change-Id: Id271cab8aef6b9b13ef17f1a8654c7616f75cf13
2018-11-27 15:11:41 +00:00
TreeHugger Robot
b5297b78ad Merge "Restrict access to ImageView#mMaxWidth/Height" 2018-11-27 12:52:15 +00:00
Clara Bayarri
9e6588db04 Restrict access to ImageView#mMaxWidth/Height
These two have getters (since api 16) and setters (since api 1),
so no reason to be reflecting anymore.

Bug: 117519954
Bug: 117519983
Test: make
Change-Id: Ib8f740071c7c05b1869117ab919297d26eae7650
2018-11-27 11:39:58 +00:00
Felipe Leme
bd5f58d845 Fixed when IntelligenceManager.notifyAppeared()/disappeared() is called.
We were not calling it on all places it should. And even worse, it was called
when the view was not laid out yet, which caused a side-effect on TextViews
(as it was calling assumeLayout()).

Bug: 111276913
Fixes: 119786503

Test: manual verification on Hangouts
Test: atest android.view.cts.ViewTest \
  android.widget.cts.TextViewTest \
  android.widget.cts.EditTextTest \
  CtsAutoFillServiceTestCases

Change-Id: I685460d9b1e0428ec0e5377826a549a678f6434e
2018-11-26 15:13:57 -08:00
TreeHugger Robot
6d45ba0491 Merge "Simplified View.onProvideContentCaptureStructure()" 2018-11-26 19:17:02 +00:00
Clara Bayarri
6036858696 Restrict unsupported usage of Linear/RelativeLayout APIs
These internal accesses can be done by existing public API

Bug: 117521217, 117521667
Test: make
Change-Id: I31116551f6e5a4f8c84a811f62419302fee91c2c
2018-11-22 15:17:54 +00:00
Mihai Popa
c6950296fe [Magnifier-65] Separate builder defaults
Bug: 72211470
Test: manual testing
Change-Id: I235a0cd15dd2156a8510023ba983ef06822ca7da
2018-11-21 09:14:17 +00:00
Mihai Popa
a5c84f2980 Merge "[Magnifier-57] Add API to set overlay" 2018-11-20 11:14:28 +00:00
Mihai Popa
1ddabb2c80 [Magnifier-57] Add API to set overlay
The CL adds an API to customize what overlay will be drawn on the top of
the magnifier content. Our default is to draw a 5% white overlay to make
magnifiers distinguishable in dark contexts.

Bug: 72211470
Test: manual testing
Change-Id: I1a356813960a60f49e068c6135ded9d41429d57c
2018-11-19 19:01:46 +00:00
Sungsoo Lim
371d34ae9b Merge "Remove unused media2 widgets" 2018-11-19 01:20:07 +00:00
TreeHugger Robot
f16a3537b6 Merge "[Magnifier-55] Add API for content clamping" 2018-11-16 21:45:40 +00:00
Felipe Leme
92ab3857b0 Simplified View.onProvideContentCaptureStructure()
That method was returning a boolean to indicate whether the IntelligenceManager
should be notify, so views with virtual hierarchy could return false.

But now it returns void and always notify, which makes the API easier to
understand and use.

Bug: 117944706

Test: m -j update-api doc-comment-check-docs
Test: atest CtsAutoFillServiceTestCases

Change-Id: I216cacb6edb144239b6eabe56ab177fc2582e1aa
2018-11-16 09:19:37 -08:00
Mihai Popa
3e1aed1272 [Magnifier-55] Add API for content clamping
The CL adds API to customize the bounds relative to a view where the
magnifier content is allowed to be copied from.

Bug: 72211470
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I3016a34929acf029f5251d03812f17e4da4cb948
2018-11-16 16:29:44 +00:00
Philip P. Moltmann
33a19c7e86 Remove most of AppSecurityPermissions
This is a dead code that cannot even be used correctly as the
permission<->group mapping is not authorative in the platform

Hence remove the code beside the small sections still used by settings.

Test: Built
Change-Id: I09cfcb5cc6811222f77377fa20123ef954b7a309
2018-11-15 09:50:16 -08:00
Sungsoo Lim
b23d6a5c5a Remove unused media2 widgets
Bug: 119591238
Test: build
Change-Id: I8ec964f304ae1ea6d868b65f2fbeb9d5e5f39f3d
2018-11-15 15:03:02 +09:00
Felipe Leme
ebebce29f9 Merge "Minor Content Capture-related changes." 2018-11-14 23:10:03 +00:00
Felipe Leme
92736c1af1 Minor Content Capture-related changes.
- Refactored onProvideStructureForAssistOrAutofillOrViewCapture() into a common,
  hidden onProvideStructure(viewFor) method on View that (hopefully :-) makes
  it easier to understand / extend.
- Renamed / documentted some methods on TextView.

Bug: 111276913
Test: atest CtsAutoFillServiceTestCases CtsAssistTestCases \
            AssistFrameworksCoreTests:AssistStructureTest

Change-Id: I328ce3f26a42e7408015cc0014a3f707801ebeb9
2018-11-14 17:27:26 +00:00
Mihai Popa
1903cab178 [Magnifier-53] Add API around outofbounds behavior
The CL adds a public API to enable customizing magnifier's behavior when
the coordinates passed to #show would position the magnifier outside the
main application window.

Bug: 72211470
Test: manual testing
Test: atest CtsWidgetTestCases:android.widget.cts.MagnifierTest
Change-Id: I9de26e446354d0ad987a4509089fbec4ee5ef7d3
2018-11-14 14:23:03 +00:00
TreeHugger Robot
1eec951795 Merge "Added moar ContentCapture APIs (and their initial implementation)." 2018-11-13 19:40:40 +00:00
TreeHugger Robot
912963cc72 Merge "Removing mApplyTheme parameter in RemoteViews as it changes the internal state of RemoteView without parcelling the new state" 2018-11-13 18:51:56 +00:00
Felipe Leme
88eae3bc69 Added moar ContentCapture APIs (and their initial implementation).
There are 4 new APIs on View:
  - boolean setImportantForContentCapture()
  - boolean getImportantForContentCapture()
  - boolean isImportantForContentCapture()
  - boolean onProvideContentCaptureStructure()

And 4 on IntelligenceManager:
  - void notifyViewAppeared()
  - void notifyViewDisappeared()
  - void notifyViewTextChanged()
  - ViewStructure newVirtualViewStructure()

These methods are similar to the equivalent methods that are used for Autofill
and/or Assist, except for the following differences:

- The view hierarchy nodes are reported as they are rendered, rather than at
  once in a tree, recursively. Hence, the ViewStructure implementation does
  not implement the methods that add children to it, and views that provide
  virtual hierarchies must manually call IntelligenceManager to create the
  ViewStructure to their children and notify when their children are added and
  removed.
- It does not support methods added for Autofill to handle HTML pages (such
  as setHtmlInfo() and setWewbDomain()), as they're not important in the
  Content Capture context.
- Similarly, it also does not support setDataIsSensitive(), because the
  Intelligence service does not have the same restrictions as the Autofill
  service.

The CL also provides the initial implementation of these APIs, although still
full of TODOs (for example, we're not holding the events to send as a batch
yet).

Test: m -j update-api doc-comment-check-docs
Bug: 117944706

Change-Id: I43f06ce82bfe3b14d8d13fb3b2ebee223db83284
2018-11-12 22:29:26 -08:00
Sunny Goyal
40f589c685 Removing mApplyTheme parameter in RemoteViews as it changes the internal state
of RemoteView without parcelling the new state

Bug: 119437911
Test: atest CtsAutofillTest
Change-Id: I561ce28ca754d3d27f3eb9fedc1e0f702b557159
2018-11-13 00:57:37 +00:00
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