Commit Graph

7059 Commits

Author SHA1 Message Date
Aaron Whyte
f830652e97 Split scroll factor into a 2d float.
Test: Existing unit tests, manual sanity check.
BUG=35764483

Change-Id: If6ac121452698747e1f8bc9d4ec0111bb881d4d4
(cherry picked from commit e9956c5c65)
2017-03-29 23:34:56 +00:00
Phil Weaver
ec66fb8f99 Fix problem with ListView accessibility focus
A scrap view was retaining accessibility focus, leading to
a confusing experience for screen reader users.

Part of the problem is that views can change even when the
adapter has stable ids. This change tightens the condition
for restoring a11y focus to the same view.

AbsListView also allowed scrap views to maintain a11y focus.
While this may make sense if the views will be reused, it is
wrong if the views are not reused.

Bug: 29403113
Test: Verified that a11y focus stays put when toggling the
preference: Settings -> System -> Language & input ->
Virtual keyboards -> Advanced -> Symbol for physical keyboard

Change-Id: Ie4a15027088f158d9ed4bb3f3eeff5a288c25832
(cherry picked from commit ab4717aa2a)
2017-03-29 15:34:30 +00:00
Shunta Sato
ec2952bc4a Don't allow the negative height of ListPopupWindow
Symptom:
If an application set a negative height to the popup list,
surfaceflinger is crashed with SIGABRT.

Root cause:
WindowManagerService dose not expect negative
height of ListPopupWindow. If it's negative,
WindowManagerService set the negative value to GraphicBufferAlloc,
but GraphicBufferAlloc handle the value as unsigned int,
then surfaceflinger is crashed with SIGABRT.

Solution:
Setting a negative height is a developer error.
We should throw an IAE from setHeigh(int).

Bug: 33441454

Author: Kazuki Nakayama <kazuki.x.nakayama@sonymobile.com>
Change-Id: I5887674d302e567abfe66147de4819cfdf0ef97b
2017-03-28 13:36:36 -07:00
TreeHugger Robot
212310ee71 Merge "Fixed yet another missing check for null anchor..." 2017-03-28 00:50:11 +00:00
Felipe Leme
6f79717014 Fixed yet another missing check for null anchor...
Test: CtsAutoFillServiceTestCases pass
Bug: 36643768

Change-Id: I6f97f3aec88c59a94c593958aca8b4a992d4806e
2017-03-27 15:45:47 -07:00
Alan Viverette
b758b3542a Merge "Avoid NPE when PopupWindow is shown while dismissing" 2017-03-27 21:21:18 +00:00
TreeHugger Robot
b237e442b7 Merge "TextClassifier updates" 2017-03-27 19:21:04 +00:00
Abodunrinwa Toki
d2d1399a62 TextClassifier updates
- Increase the size of the text sent as context to the classifier
- Pass regex match hints to the classifer

Test: Build still works. Regex hints logged correctly. The hints won't
matter until we've actually passed in this values to native code. Native
library test will be written and I've got a tracker bug to write more robust Java tests.

Bug: 35416389
Bug: 36584397

Change-Id: I29e56189b388b36dc0cc7a8bb13ef237ff55be7b
2017-03-27 17:53:24 +01:00
Felipe Leme
dd23777dfb Fixed check for null Anchor.
It was checking if the weak reference pointee was null, but not for a null
weak reference per se.

Fixes: 36643768
Test: manual verification
Test: CtsAutoFillServiceTestCases pass

Change-Id: I106dfd4a91ff1d45f8cb3141a992b06cbe460367
2017-03-27 09:44:07 -07:00
Felipe Leme
63d9831020 Merge "Make auto-fill UI robust" 2017-03-25 00:36:48 +00:00
Felipe Leme
4753bb0c34 Make auto-fill UI robust
Now the autofill UI tracks the movement of the anchor view,
both real and virtual and while still preventing the filled
app from accessing the chooser UI. This was achieved by using
a popup window in the app process to determine the window
location and adding a window presenter interface to popup
window that controls the actual window addition, removal, and
update which is implemented by the system server.

Test: all autofill CTS tests pass

bug: 36392498
bug: 35708258
bug: 34943932
fixes: 36039182
fixes: 36493078

Change-Id: I0321913b2e2e759f4b17003bf85cb873e63a467c
2017-03-24 15:16:28 -07:00
Felipe Leme
119205629e Checks if an adapter item is null before addint it to options.
Change-Id: I60634d0990d1d5bc33703abd41997e560f59ec77
Fixes: 36589254
Test: CheckoutActivityTest.testAutoFillDynamicAdapterWithNullItems()
2017-03-24 10:41:45 -07:00
Clara Bayarri
7c9e897c7d Merge "Fix textStyle being ignored for Font resources in TextView" 2017-03-24 11:11:23 +00:00
TreeHugger Robot
55807c973b Merge "Anchor a cascading submenu to its parent menu item" 2017-03-23 23:25:41 +00:00
TreeHugger Robot
b74767958d Merge "Respect PopupWindow.setOverlapAnchor when above anchor" 2017-03-23 21:03:00 +00:00
Alan Viverette
7e1aeb791e Avoid NPE when PopupWindow is shown while dismissing
Bug: 36468675
Test: PopupWindowTest#testEnterExitInterruption
Change-Id: I03bd297c4e7f7653dfff801ec0adfd7ab869abb5
2017-03-23 15:29:26 -04:00
Seigo Nonaka
3e2936413d Update setJustify API reference.
Bug: 35766005
Bug: 35764323
Test: N/A
Change-Id: I2d4b398479cdb3ac87257de95eb6a02f03c639bf
2017-03-23 10:30:55 -07:00
Alan Viverette
503b5cccd7 Merge "Skip ListPopupWindow position update if detached" am: c45b10a9cb am: 3107a17ba7
am: 300bb66b2f

Change-Id: I5b7590805a1dfaf45eb1a8a9a22f6ab47a7dfdfa
2017-03-23 14:36:42 +00:00
Alan Viverette
3107a17ba7 Merge "Skip ListPopupWindow position update if detached"
am: c45b10a9cb

Change-Id: I85f5250d4b37b771ff4d39d80082e8355154ed57
2017-03-23 14:25:07 +00:00
Clara Bayarri
576ee7de7d Fix textStyle being ignored for Font resources in TextView
When a font resource is set via fontFamily, the textStyle
attribute was being ignored.

Bug: 36505747
Test: cts attached in topic
Change-Id: I6418297d9a289460a3b36c6883441ac48ea33b22
2017-03-23 13:48:22 +00:00
TreeHugger Robot
8515afe08b Merge "Revert "Move expensive TextClock operations to onAttach"" 2017-03-22 05:42:58 +00:00
Ian Pedowitz
cbba5f3090 Revert "Move expensive TextClock operations to onAttach"
This reverts commit dffe6fdfe1.

Bug: 36472151
Change-Id: I98ba047bd4225d82414425a40e9a2e50c4473bf9
2017-03-22 02:09:13 +00:00
Christine Franks
3910adfb62 Merge "Add color temperature preference for Night Display" 2017-03-20 18:03:49 +00:00
TreeHugger Robot
7d50ff11db Merge "Notify caller if none of settings are effective." 2017-03-20 17:37:15 +00:00
Christine Franks
6418d0b890 Add color temperature preference for Night Display
Bug: 32463283
Test: adb shell settings put secure night_display_color_temperature
XXXX, where XXXX is {0, 2900, 4000, 7000}, and the temperatures
outside the valid range are capped at the min/max, respectively.
Change-Id: I322c0a907b30742fc312a9938fd0c47f679e580b
2017-03-20 09:07:17 -07:00
Andrei Stingaceanu
40c3ab0f89 Merge "AutoSize TextView (part 12) - ellipsize & more fixes" 2017-03-20 10:53:46 +00:00
Yohei Yukawa
2565a526a8 Merge "Deprecate IMM#showSoftInputUnchecked() part 1" 2017-03-17 22:05:21 +00:00
Andrei Stingaceanu
4e9c10afa6 AutoSize TextView (part 12) - ellipsize & more fixes
* ellipsize is being taken into account when auto-
  sizing text; the ellipsis is applied once the
  minimum text size for auto-size has been chosen
  as the best fit
* isolated the preset sizes configuration and used
  it both in the setter and ctor => consistency
* stuffed all possible TextView attributes to the
  StaticLayout we use for measurements for a more
  precise result
* fixed a bug where the default granularity was
  not properly applied resulting in an error in
  ctor
* fixed all auto-size error messages

Bug: 33574040
Bug: 32221168
Test: attached in the same topic
Change-Id: I36fa7c242d588bf597110bb02a26c90ae1f1943a
2017-03-17 11:08:25 +00:00
Philip P. Moltmann
7b77116802 TRON log important auto-fill events
Example log from
android.autofillservice.cts.LoginActivityTest#testAutoFill#testAutoFillOneDatasetAndSave
(translated from numbers of human readable string):

AUTOFILL_SESSION_STARTED
   package=android.autofillservice.cts
AUTOFILL_REQUEST
   type=TYPE_SUCCESS
   package=android.autofillservice.cts
   FIELD_AUTOFILL_SERVICE=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_DATASETS=1
AUTOFILL_FILL_UI
   type=TYPE_ACTION
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_DATASETS=1
   FIELD_AUTOFILL_FILTERTEXT_LEN=0
AUTOFILL_DATASET_APPLIED
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_VALUES=2
   FIELD_AUTOFILL_NUM_VIEWS_FILLED=2
AUTOFILL_SAVE_UI
   package=android.autofillservice.cts
   FIELD_AUTOFILL_NUM_IDS=2
AUTOFILL_DATA_SAVE_REQUEST
   type=TYPE_SUCCESS
   package=android.autofillservice.cts
   FIELD_AUTOFILL_SERVICE=android.autofillservice.cts
AUTOFILL_SESSION_FINISHED
   package=android.autofillservice.cts

Test: Ran auto-fill tests and looked at event log.
Change-Id: I58aaa58e4435e7d04c8cd91878411943d3eb13de
2017-03-16 15:41:33 -07:00
TreeHugger Robot
5bf03b7640 Merge "Allow users to manually request Autofill." 2017-03-16 01:33:46 +00:00
TreeHugger Robot
65d1c294b1 Merge "Move expensive TextClock operations to onAttach" 2017-03-16 01:10:23 +00:00
Seigo Nonaka
0763650a13 Notify caller if none of settings are effective.
Now setFontVariationSettings returns false if the given settings is not
effective.

Bug:35764323
Test: ran TextViewTest and PaintTest in cts
Change-Id: Ic31d9e47ec006c8e7bb2c907ff0ea2936bd71d01
2017-03-15 14:05:37 -07:00
Felipe Leme
2ac463e3f5 Allow users to manually request Autofill.
- Added a requestAutofill(view,flags) method, that when passed with
  FLAG_MANUAL_AUTOFILL triggers a manual request.
- Added same method for virtual views
- Overloaded existing AutofillService request methods to take a flag.
- Added an AUTOFILL context menu option on TextViews.
- Added a canRequestAutofill() that is used to enable the context menu.

BUG: 35708229
Test: manual verification
Test: existing CtsAutoFillServiceTestCases pass
Test: android.autofillservice.cts.LoginActivityTest#testManualAutofill pass

Change-Id: I1a64d40da3373774451d178b1cabf20f11120e9d
2017-03-15 09:37:10 -07:00
Philip P. Moltmann
9b31b4eac8 Merge "Make it clear which type of AutoFillValue is set" 2017-03-14 21:59:39 +00:00
TreeHugger Robot
123a34f193 Merge "Renamed ViewStructure.setSanitized() to setDataIsSensitive()." 2017-03-14 19:27:20 +00:00
Felipe Leme
c9a19b1b27 Renamed ViewStructure.setSanitized() to setDataIsSensitive().
Bug: 36126001
Test: CtsAutoFillServiceTestCases pass
Test: m update-api

Change-Id: I182355b63d8743cd8cd8612f29a9269e258283c2
2017-03-14 17:51:47 +00:00
Vladislav Kaznacheev
b40e61b77c Anchor a cascading submenu to its parent menu item
The current implementation of cascading menus is anchoring
a submenu to the top-level anchor view using a carefully
computed offset. This offset is only correct for the case when
the submenu is being shown normally, but not when it is
flipped due to insufficient space below.

More over, when the window containing the anchor is scrolled,
the pre-computed might become completely irrelevant, as
parent menus might change their above/below state.

This CL allows a PopupWindow to be anchored to a view in
another popup window (previously it was only possible to
anchor to a view in the main app window).

Cascading submenu is now tracking its parent item position
correctly.

Bug: 35768002
Test: android.cts.widget.PopupWindowTest.testAnchorInPopup
Change-Id: Id163d739de05729a9fa7e5fedebc9ec0037ed80e
2017-03-14 10:00:21 -07:00
Philip P. Moltmann
9668903731 Make it clear which type of AutoFillValue is set
throw and handle errors if the wrong value is set for a view

Test: android.autofillservice.cts.AutofillValueTest
Change-Id: Ida80da7913a210bede6c47d6b7a6f215a012a84c
2017-03-14 09:11:47 -07:00
tianran.x.li
a31d4edb74 Skip ListPopupWindow position update if detached
Symptom:
A part of the option is displayed in the wrong location.

Root cause:
When the search item is clicked, the menu item will be
hidden. The PopupWindow will be detached from window and the
mAttachInfo property will be set to null. The anchor coordinates
will return x 0 and y 0.

Solution:
If the anchor view is detached from window, the ListPopupWindow will
not be update.

Bug: 36207919

Change-Id: I2b370c31542fae454592463e12313fdeaef25afe
2017-03-14 19:17:54 +09:00
Svet Ganov
2f8fb1f62f Fix a few auto fill ussues
1. Ensure clicking on a focused view brings up autofill if needed

2. Notify the autofill manager in a couple of cases we missed

3. Renamed the AutofillManager app facing APIs to better reflect what
    they do and added a API for the app to cancel the autofill interaction

4. Fix view structure dispatch where the ordering of children for autofill
    was mixed with ordering of direct view children - the autofill children
    may be indirect as views can be marked not important for autofill

5. Show scrollbars only if there are more fill options than want is shown

6. Show only three fill options and the rest can be accessed with a scroll

7. Remove the list divider to allow fill items to control all fill window content

8. Renamed the autofill manager internal service classes to xxAutofillxx

9. Fixed a comment that was not addressed in a previous CL

10. Showing max three fill options - rest needs a scroll

11. Make sure fill UI shown when filter with no matches is changed
      to filter with some matches

12. Make sure the fill window has a shadow

Test: Autofill CTS tests pass and manual

bug:36038929
bug:36040101
bug:36149166
bug:36034681
bug:36126001
bug:36035654

Change-Id: Ic8726146fc3c0a19d3e536becdd63fb65622136e
2017-03-13 21:57:10 -07:00
Ian Lake
dffe6fdfe1 Move expensive TextClock operations to onAttach
Registering and unregistering are expensive operations
that should not be done when the visibility of the
TextClock changes. However, we want to ensure that a
non-visible TextClock does not consume extra resources
or cause layout/redraw passes. By keeping the TextClock
registered but avoiding the side effects of onTimeChanged,
we can get the best of both worlds.

Test: manual testing

BUG: 33960344
Change-Id: I3e76246d820363766b78130231d665989fdb4265
2017-03-10 13:58:07 -08:00
Felipe Leme
640f30a776 Replaced auto-fill by autofill to keep it consistent with API style.
This change will affects 2 types of apps: autofill service implementations
and apps that use autofill APIs.

Since just the former is known to be used at the moment, we're not trying
to keep backward compatibility with the latter.

Bug: 35956626
Test: CtsAutoFillServiceTestCases pass
Test: android.provider.SettingsBackupTest pass

Change-Id: Ia720083508716deae9e887f9faa7ae7c5a82f471
2017-03-09 08:14:49 -08:00
Felipe Leme
d04a697ede Optimize ViewStructure for autofill by removing irrelevant nodes.
Test: CtsAutoFillServiceTestCases (with new tests) pass
Fixes: 35840787

Change-Id: Iaa2c1907c8383b4a820fd7204e67fa2d276ad2b8
2017-03-08 13:31:38 -08:00
TreeHugger Robot
7e547fbe88 Merge "Replace AutoFillType by view constants." 2017-03-08 21:08:56 +00:00
Felipe Leme
8931e30370 Replace AutoFillType by view constants.
Now that AutoFillType does have any logic (since the "subType" logic was moved
to AutoFillHint), it makes more sense to get rid of the type and use constants
directly.

This change creates the contants and "pseudo-deprecate" the old stuff: it's
still available because some clients are using it, but it will be removed once
they migrate.

Bug: 35956626
Test: CtsAutoFillServiceTestCases pass

Change-Id: I0efe7f0cc101c86164a18c85903bb871e1f13ba2
2017-03-07 10:43:17 -08:00
Abodunrinwa Toki
4cfda0beef TextClassifier: Introduce LocaleList in the API.
Test: API change. Ensured that tests (see topic) compiles
Bug: 35257733
Change-Id: I036af7948fcd691b8a7de586a9cc1b3165946f8a
2017-03-07 14:25:21 +00:00
Abodunrinwa Toki
0f502cb1b6 Merge "Prevent crashes when in insertion mode." 2017-03-07 12:54:52 +00:00
Yohei Yukawa
5cfc1b4c10 Deprecate IMM#showSoftInputUnchecked() part 1
One of non-intuitive behaviors of InputMethodManager#showSoftInput() is
that it always fails if you pass a view that does not window focus.  For
example, the following code does not show the software keyboard because
the target window is not yet focused during Activity#onCreate().

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        final EditText editText = new EditText(this);
        layout.addView(editText);

        final InputMethodManager imm =
                getSystemService(InputMethodManager.class);
        editText.requestFocus();

        // This will be ignored because the target window has not gained
        // focus yet.
        imm.showSoftInput(editText, 0);

        setContentView(layout);
    }

Some platform components, however, have worked around by this limitation
by relying on IMM#showSoftInputUnchecked(), which just bypasses internal
IME focus handling flows.

Bypassing standard event handlign flow is indeed problematic, and has
actually contributed to issues such as Bug 35903813 and Bug 31915865
directly or indirectly.  In order to make IME focus handling more
deterministic and reliable, IMM#showSoftInputUnchecked() really needs to
be deprecated.

As the initial step to deprecate IMM#showSoftInputUnchecked(), this CL
removes the dependency on it from SearchView.  Instead of immediatelly
issuing delayed tasks that call IMM#showSoftInputUnchecked(), this CL
uses View#onCreateInputConnection() as a signal that SearchAutoComplete
now owns IME focus.

Test: Open System Settings and tap the search icon to make sure that
      the software keyboard will be shown automatically.
Test: cts-tradefed run cts -m CtsWidgetTestCases --test android.widget.cts.SearchViewTest
Bug: r.android.com/223701
Bug: 36015425
Bug: 31756425
Fixes: 35903813
Change-Id: I20983e4ce1d625e098a8c2335ce75994cfa43235
2017-03-07 00:52:09 -08:00
Abodunrinwa Toki
792d820cc9 Prevent crashes when in insertion mode.
Test: Manually tested. Automated core tests will be written in another
CL.

Change-Id: If07fa6a81e60de43d8be2cbcf37b355403779fb8
2017-03-06 23:51:11 +00:00
Vladislav Kaznacheev
07084924be Respect PopupWindow.setOverlapAnchor when above anchor
Currently if a popup menu is shown above the anchor, it
is anchored to the anchor's top edge regardless of the value of
mOverlapAnchor.

Fixing the vertical offset correction and the computation of the
vertical space available above the anchor.

Bug: 36000552
Test: android.widget.cts.PopupWindowTest#testOverlapAnchor
Change-Id: Ifb71ff1fc0aa0df58e4919fd229c2623a2bcbe3d
2017-03-06 14:21:10 -08:00