Commit Graph

7225 Commits

Author SHA1 Message Date
Seigo Nonaka
80f6a985c3 Stop loading other package's font by default.
Since CONTEXT_RESTRICTED is not a default flag of createPackageContext,
we can't rely on it for preventing unexpected font injections.
To protect developers and existing apps from a risk of font injection,
stop loading font from other package's resouce unless the developer
explicitly set CONTEXT_IGNORE_SECURITY.

This CL contains Iac2a6fb3d82ef23d5ca6ee33f4aaa9ed28455271 by manual
merging to handle repository split.

Bug: 62813533
Bug: 62879353
Test: Manually done
Merged-In: I4442ddc48dadb5c968b444be86038b602074d301
Change-Id: I4442ddc48dadb5c968b444be86038b602074d301
2017-06-22 19:07:17 -07:00
Robert Carr
c1fdd2aa32 ListPopupWindow: Wrap new bounds checking in targetSdk check.
While a negative height is pretty silly, crashing apps on
the new version of android makes them sad.

Test: Existing CTS passes.
Bug: 62434804
Change-Id: I5fc3fc50fb6ccfa9e96f38ded4fb8e338f263f09
2017-06-22 11:54:45 -07:00
Siyamed Sinir
532f3c989e Fix crash during TextView.onCreateContextMenu
Test: bit CtsWidgetTestCases:TextViewTest

Bug:62450393
Change-Id: I162c28d253ca197eba9c4c148c76179c2880daa5
2017-06-16 19:32:41 +00:00
Daniel Sandler
0e6a5f8d7e Merge "Revert accidental API change to RemoteViews." into oc-dev 2017-06-14 20:12:38 +00:00
Daniel Sandler
23bb5bf262 Revert accidental API change to RemoteViews.
This reverts commit 7f09ce1a23 (but 
retains the bug fix)

Change-Id: Ib4700ada5aa0b5dab7e43f895b48eb7058308869
Fixes: 62543637
Bug: 62181033
2017-06-14 20:10:18 +00:00
Andrei Stingaceanu
e565e525fa DayPickerView - clamp date to min/max
Besides clamping @ setMinDate() and setMaxDate() also
clamp @ setDate().

Bug: 36636681
Bug: 62485314
Test: cts-tradefed run cts-dev -m CtsWidgetTestCases -t
      android.widget.cts.CalendarViewTest#testMinMaxRangeClampingMaterial

Change-Id: I455cd43e7228e10d58b5f886dcab8332bca72de7
2017-06-13 18:23:22 +01:00
Siyamed Sinir
bc626c6358 Merge "Force Autofill in FloatingToolbar overflow menu" into oc-dev 2017-06-09 20:58:36 +00:00
Selim Cinek
b9eb205bd7 Merge "Fixed a bug where systemui could crash while cloning" into oc-dev 2017-06-09 04:22:06 +00:00
Siyamed Sinir
484c2e2fbe Force Autofill in FloatingToolbar overflow menu
Test: bit CtsWidgetTestCases:android.widget.cts.TextViewTest
bit CtsWidgetTestCases:android.widget.cts.EditTextTest

Bug: 62271937
Change-Id: Ib3447281f3bd1abc811a25fc55ad55e34e155bbb
2017-06-08 17:16:26 -07:00
Selim Cinek
7f09ce1a23 Fixed a bug where systemui could crash while cloning
Because cloning wasn't synchronized, the notification
could become a non-root temporarily which in turn could
lead to a crash.
1. We're now properly synchronizing the cloning, such that
this can't happen anymore
2. We're now only cloning the old statusbar notification lightly
instead of heavily to avoid this altogether

Test: manual, update decoratedcustomview notifications really fast
Change-Id: Ia6525eec64ad9a26956ca2198e20198f55b2173c
Fixes: 62181033
2017-06-08 13:31:26 -07:00
TreeHugger Robot
cd603221e1 Merge "Fix unexpected DatePicker validation" into oc-dev 2017-06-08 14:36:13 +00:00
Andrei Stingaceanu
cf5a420ead Fix unexpected DatePicker validation
Remove throwing an error and instead clamp
the selected date to min/max when changing
ranges.

Bug: 36636681
Test: manually verified that the case in the
      bug does not happen again

Change-Id: If540f58d21375d2320df5215504d4569e5c2be2e
2017-06-06 17:34:42 +01:00
Felipe Leme
1c1626ec76 Don't show AUTOFILL menu when text is selected.
Fixes: 62271937
Test: manual verification
Test: existing CtsAutoFillServiceTestCases tests pass

Change-Id: I80902cb38633e41f50044f413b1b86904a60261e
2017-06-02 12:18:29 -07:00
Evan Rosky
3653aed87b Merge "Enabled (asymmetric) tab selection in GridView" into oc-dev 2017-06-02 00:45:17 +00:00
Andrei Stingaceanu
b6eaf5b8ef AutoSize TextView - major fixes
* splits the auto-size setup part from the execution
  function:
** in TextView CTOR we only setup and we leave the
   actual auto-sizing execution to happen in the
   view||text layout  phase
** encapsulated the conditions needed to start
   applying auto-size in the execution function

* introduces a private way to set the text size
  without requesting a new layout pass; auto-size
  always uses this practically setting the text
  size on the paint object and creating a new
  layout

* calls execution autoSizeText() from within
  TextView#checkForRelayout() if not requestLayout()
  is needed => this makes sure that auto-size will be
  performed even if a view layout is not requested,
  but only a text layout

* fixes the calculation of the sizes available for
  auto-size when configured via granularity

Bug: 62050646
Bug: 38409622
Bug: 38440435
Bug: 62109627
Test: run cts --test android.widget.cts.TextViewTest -m \
      CtsWidgetTestCases
Test: manually tested the new behaviors in demo apps
Test: new test attached in topic

Change-Id: I4ccaa0a0afa3b5aa47213442d0029da2c74e7eb4
2017-06-01 15:40:40 +01:00
Siyamed Sinir
42b2760525 Merge "Don’t try to autoSize if TextView is not measured" into oc-dev 2017-05-27 00:13:39 +00:00
TreeHugger Robot
759669988b Merge changes from topic 'highlight_fixed' into oc-dev
* changes:
  Check default focus highlight for ImageView.
  Check state_focus in foreground.
2017-05-27 00:11:10 +00:00
Sergey Vasilinets
bacaffa497 Merge "Don't show ripple effect on the element replacing "See All"" into oc-dev 2017-05-26 22:11:27 +00:00
Jiaquan He
1dd48d0b8f Check default focus highlight for ImageView.
This commit specially checks isDefaultFocusHighlightNeeded for
ImageView. We should also check with the content drawable of the
ImageView besides its foreground or background.

Bug: 62141891
Test: cts-tradefed run singleCommand cts --skip-device-info
--skip-preconditions --abi armeabi-v7a -m CtsViewTestCases -t
android.view.cts.View_DefaultFocusHighlightTest#testIsDefaultFocusHighlightNeeded

Change-Id: Iaf12a5863d7760d9361d0196a46de07a9ccda74e
2017-05-26 14:31:29 -07:00
Siyamed Sinir
cfc79a9e5f Don’t try to autoSize if TextView is not measured
This CL early returns from auto sizing text if the view is not measured
yet.

Test: run cts --test android.widget.cts.TextViewTest -m CtsWidgetTestCases
Test: Added cts.TextViewTest#testAutosizeWithMaxLines_shouldNotThrowException
Test: Manual test with sample app for the failing case.

Bug: 38440435
Change-Id: Ic03c991f33a2b7701623f00f44cba7fb6cdfce46
2017-05-26 12:00:51 -07:00
TreeHugger Robot
58f6f428fc Merge "SelectionActionModeHelper should use target view's thread" into oc-dev 2017-05-26 00:45:42 +00:00
sergeyv
e471a4e0f7 Don't show ripple effect on the element replacing "See All"
bug: 30247194
Test: manual
Change-Id: Icbe5baba62df7b2a107ecc00d52119cb557d3a6b
2017-05-25 15:49:40 -07:00
Makoto Onuki
1488a3a19d SelectionActionModeHelper should use target view's thread
Use the looper from the TextView's thread for the helper

Bug 62043115
Test: Manual, type on edit field and select text

Change-Id: I501430a500016a81963a9f9fa636474b708b9b36
2017-05-25 15:33:10 -07:00
TreeHugger Robot
7f517b2fe6 Merge "Disable state save/restore for inflated date/time picker views" into oc-dev 2017-05-24 19:50:57 +00:00
TreeHugger Robot
afea5e8ca4 Merge "TRON: Smart selection events that don't change the selection." into oc-dev 2017-05-24 15:44:40 +00:00
Abodunrinwa Toki
e78ac52d8b TRON: Smart selection events that don't change the selection.
See Ia9081d92ae9aea50d863455be770eecd0c73be1a for multi-selection
counts.

Test: Manually checked logging happens as per go/tron-howto and verified
nothing is broken in related classes by running:
bit FrameworksCoreTests:android.widget.TextViewActivityTest
bit CtsWidgetTestCases:android.widget.cts.TextViewTest

Bug: 32572232
Change-Id: I4ceab136ab73a20c6bc56732f7606ed103fe64d3
2017-05-24 14:45:24 +01:00
Andrei Stingaceanu
98891dbb70 Merge "AutoSize TextView - correct pixel transformations" into oc-dev 2017-05-24 09:16:52 +00:00
Adam Powell
43da25c670 Disable state save/restore for inflated date/time picker views
Fix a bug where the internal date/time picker views reused view IDs
causing state save/restore bugs when placed within AlertDialogs and
other places. Since the pickers already save/restore their state at a
higher level leaving this enabled was redundant.

Bug 32654446
Test: manual

Change-Id: I3df2fc932ac5296ab6eb0a5013dddef8d1117635
2017-05-23 15:58:47 -07:00
Phil Weaver
ed83139842 Merge "Revert "NumberPicker a11y (and a11y-inspired) fixes"" into oc-dev 2017-05-22 13:03:45 +00:00
Evan Rosky
a2ee78aeb9 Merge "Missed a break statement. very sorry" into oc-dev 2017-05-19 20:25:54 +00:00
TreeHugger Robot
99e620ef32 Merge "In onDragEvent(), don't assume text is Spannable" into oc-dev 2017-05-18 19:21:51 +00:00
Evan Rosky
0892401a86 Missed a break statement. very sorry
Change-Id: Ifbc6c60a3fa2cf296a34836c890a10d50c0f14c1
2017-05-18 11:18:18 -07:00
Phil Weaver
a998b5f869 Revert "NumberPicker a11y (and a11y-inspired) fixes"
This reverts commit 1d359a6d31.

Bug: 38301562
Change-Id: I7a04f3068a8ecb0de63efcb82205b41916138a89
2017-05-18 16:19:23 +00:00
Jeff Sharkey
f383c24749 Unbreak even more APK 26 apps running on "O" preview/beta builds.
Bug: 38391358
Test: builds
Change-Id: Ic48f9cb53da3ed8241e5d40d3096304ee4dfebd2
2017-05-17 17:53:38 -06:00
Roozbeh Pournader
74e7b26a10 In onDragEvent(), don't assume text is Spannable
Previously, onDragEvent() tried to set the anchor even if
the text was not Spannable. Now we check to make sure it is
Spannable before trying to set the selection.

Test: cts-tradefed run cts-dev --module CtsTextTestCases
Change-Id: I835bf3d6024bf3c85e1d248458829eef496ad93d
Fixes: 37261326
2017-05-17 15:04:45 -07:00
TreeHugger Robot
2df0155a97 Merge "Fixes crash (race cond) when using toast that is immediately cancelled" into oc-dev 2017-05-16 14:16:01 +00:00
Svet Ganov
0df3702f53 Fixes crash (race cond) when using toast that is immediately cancelled
Running cancel after toast is shown and adding some UI stress (or sleep
on UI thread) causes a crash from toast when trying to add the toast
window to the display. The toast must be triggered from app that is
above N MR1 (25).

The steps that crash the app are:
1. Show toast (Toast.makeText(...).show()), window token is created
2. Immediately cancel toast (Toast.cancel()), window token is removed
3. Stall UI thread (Thread.sleep, heavy task), both show and cancel
events are queued to UI thread from window manager
4. Crash trying to add toast but no window token exists

In Toast:handleShow(), the mNextView is required to add the toast to
display, if the mNextView is null before posting to window manager, then
when handleShow() runs later, it will ignore adding the toast to
display. The issue before is that mNextView is set to null after cancel
runs back from window manager in UI thread but the show post will always
happen first. Therefore set mNextView to null at the beginning of
cancel will ignore adding the toast to display and avoid the crash.

Bug: 37606432

Test: manual - write an app to Toast.show(), Toast.cancel(), then
Thread.sleep(), set app's sdk usage above 25 (N MR1) and show the
toast

Change-Id: I352e296c47b1b8776c78b6b0943b1dc809963026
2017-05-15 23:46:21 -07:00
TreeHugger Robot
1812e446e1 Merge "Update TimePicker mode switch icon." into oc-dev 2017-05-16 01:14:01 +00:00
Evan Rosky
8c8ac8125a Enabled (asymmetric) tab selection in GridView
We decided its better for tab to do something than to have no
tab navigation within GridView.

Also fixed a small bug that made backwards focus order not work
right.

Bug: 38264959
Test: Manually tested in test-app. Added basic CTS for tab keys
Change-Id: I8236deed26e6d8b8cae0130359b104af4d9a244d
2017-05-15 15:58:45 -07:00
Aurimas Liutikas
c0aa90d9ee Update TimePicker mode switch icon.
Previously the icon was an event icon, but a clock icon is
more appropriate so we are switching to that instead.

Bug: 37351390
Test: Open time picker
Change-Id: I47e6caf3c341c10264168004628288fd00e4601a
2017-05-15 15:39:28 -07:00
TreeHugger Robot
22c6f2d3a8 Merge "Revert "Respect PopupWindow.setOverlapAnchor when above anchor"" into oc-dev 2017-05-13 00:34:43 +00:00
Abodunrinwa Toki
05d41a7183 Merge "TextView: Invalidate selection action mode on "select all"." into oc-dev 2017-05-12 23:51:51 +00:00
Abodunrinwa Toki
4ce651e92d TextView: Invalidate selection action mode on "select all".
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
bit CtsWidgetTestCases:android.widget.cts.TextViewTest
Change-Id: I0b5ebb8d6f1af1a9938151f758a2feedb14fcb9f
Fixes: 38244876
2017-05-13 00:39:58 +01:00
Abodunrinwa Toki
f0d0e37564 Merge "Properly invalidate text classification cache." into oc-dev 2017-05-12 23:08:03 +00:00
Vladislav Kaznacheev
3b105d92a5 Revert "Respect PopupWindow.setOverlapAnchor when above anchor"
This reverts commit 07084924be.

Bug: 37951656
Test: android.widget.cts.PopupWindowTest
Change-Id: I6c950d19bbf5c778f799a652595550a2733aae08
2017-05-12 10:40:16 -07:00
Evan Rosky
23114d68be Added redundant focusable attribute read in TextView
Some apps were relying on TextView favoring focusable over
focusableInTouchMode when they were explicitly set to
opposite values in XML (usually because they start with an
EditText and only set focusable=false). This behavior is
undefined (and is, in-fact opposite to every other View).
In order to keep backwards-compatibility, this restores
the old behavior.

Bug: 36497135
Bug: 37916052
Test: Tested those apps and they behave like they used to.
      TextView CTS still passes.

Change-Id: I65bd1b343a6dfb087f41c9fc8af4b5c1e4c71493
2017-05-12 17:01:54 +00:00
Abodunrinwa Toki
08925e6501 Properly invalidate text classification cache.
Test: bit FrameworksCoreTests:android.widget.TextViewActivityTest
Change-Id: I02b77fc0edf53d13b1623631f4521487cd0bf081
Fixes: 38247676
2017-05-12 13:48:50 +01:00
TreeHugger Robot
6bf9b9a5f3 Merge "TRON: Count smart selection events." into oc-dev 2017-05-12 11:54:37 +00:00
Abodunrinwa Toki
1d77557517 TRON: Count smart selection events.
Logs:
 - Smart selection occured
 - TextView menu item activated on smart selection
 - Smart selection reset
 - Smart selection modified

Test: Manually checked logging happens as per go/tron-howto and verified
nothing is broken in related classes by running:
bit FrameworksCoreTests:android.view.textclassifier.TextClassificationManagerTest
bit FrameworksCoreTests:android.widget.TextViewActivityTest

Bug: 32572232
Change-Id: Ia9081d92ae9aea50d863455be770eecd0c73be1a
2017-05-11 23:04:29 +01:00
Andrei Stingaceanu
d4082bb9ad AutoSize TextView - correct pixel transformations
When configuring a TextView to auto-size via min/max/granularity
do the calculations in float pixels and only convert to int (via
rounding, see TypedArray#getDimensionPixelSize) to produce the
final text size values to be used by the auto-size algorithm.
This is because the previous version where the values were
initially directly converted to pixels and only after used in
calculations was losing precision and was not consistent with how
we deal with preset configuration (and the developer
expectations).

Practically

textView1.setAutoSizeTextTypeUniformWithConfiguration(10, 20, 2,
        TypedValue.COMPLEX_UNIT_SP)

and

textView2.setAutoSizeTextTypeUniformWithPresetSizes(
         new int[] {10, 12, 14, 16, 18, 20},
         TypedValue.COMPLEX_UNIT_SP);

produce exactly the same values in pixels to choose from when
auto-sizing (on any device) =>
(TextView#getAutoSizeTextAvailableSizes())

Bug: 38185233
Bug: 37265610
Test: attached in the same topic
Change-Id: I95cbbf4674e98f080d7752ae350df26b4adf31b4
2017-05-11 15:49:02 +01:00