Commit Graph

7021 Commits

Author SHA1 Message Date
Yohei Yukawa
2565a526a8 Merge "Deprecate IMM#showSoftInputUnchecked() part 1" 2017-03-17 22:05:21 +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
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
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
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
Clara Bayarri
e1be1dfbc3 Merge "Ignore non-font resource references in TextView constructor" 2017-03-06 10:40:24 +00:00
Felipe Leme
5591044864 Don't set auto-fill options when Spinner has no adapter.
Change-Id: Ib42fe5ba57d5ef31a00b39945ac3bcacbb217cc8
Fixes: 35965642
Bug: 33550221
Test: compilation only
2017-03-04 00:23:23 -08:00
Clara Bayarri
d134b89276 Ignore non-font resource references in TextView constructor
TextView was blowing up in its constructor when fontFamily was
set in xml to a reference that was not a font, e.g. @style/mystyle.

These values should be ignored as they are not valid, but we don't
want to crash the app for it either.

Bug: 35863153
Test: See topic
run cts -m CtsWidgetTestCases -t android.widget.cts.TextViewTest#testFontResources_setInXmlStyle

Change-Id: I5d9443e70a36122d312c3a9f2c0dcffb530dbca8
2017-03-03 18:13:28 +00:00
Philip P. Moltmann
ba6f462602 Add autoFillHint property to view
Bug: 35364993
Test: Ran amended ViewAttributesTest
Change-Id: Ib7d2c3dfd5b4a6b638b56c4583af4c9bdf37e346
2017-03-02 12:46:44 -08:00
TreeHugger Robot
1bef83f613 Merge "Added inputType to Assist API." 2017-03-02 03:01:50 +00:00
TreeHugger Robot
de06d67d16 Merge "Added auto-fill support for DatePicker and TimePicker." 2017-03-01 23:15:35 +00:00
Felipe Leme
305b72c925 Added auto-fill support for DatePicker and TimePicker.
Also fixed some getAutoFillType() implementations to return null
when the view is disabled.

Bug: 33550221
Bug: 35840787
Test: CtsAutoFillServiceTestCases (with new tests) pass
Test: m update-api

Change-Id: I46acc1fb106cf2153515cc1c9567b34cfabd1c62
2017-03-01 10:43:48 -08:00
Aurimas Liutikas
1ca63ec5fb Merge "Do not send onTimeChanged updates if nothing actually changed." 2017-02-28 22:35:58 +00:00
Aurimas Liutikas
2f16bc8a3a Do not send onTimeChanged updates if nothing actually changed.
Bug: 29314380
Test: android.widget.cts.TimePickerTest#testSetOnTimeChangedListener now passes.
Change-Id: I4df96cd306967027ea76e2c256b50ca687eae9ba
2017-02-28 12:19:30 -08:00
Abodunrinwa Toki
90ebaa8d2d Merge "Don't trigger textclassifier in a11y action." 2017-02-28 20:02:08 +00:00
Abodunrinwa Toki
117240cc0e Don't trigger textclassifier in a11y action.
Support for smart text share in a11y mode needs to be done differently.
See: b/34779222

Test: Manually tested
Bug: 35252502
Change-Id: Ia268065c21fc5ac716ca06a0ec9d3866fbd13aa4
2017-02-28 18:02:53 +00:00
Felipe Leme
16aafc36de Added inputType to Assist API.
It will be used mostly for auto-fill purposes..

Bug: 35364993
Test: CtsAutoFillServiceTestCase (with new tests) pass
Test: manual verification

Change-Id: Ia5b6ff94e66a7da385cfb6f42ad994fe5e1e976b
2017-02-27 14:09:44 -08:00
Andrei Stingaceanu
81926e39f0 Merge "AutoSize TextView (part 11) - fix final APIs" 2017-02-27 17:42:19 +00:00
Alan Viverette
8e1a729645 Implicitly cast views obtained via View.findView methods
Removes all explicit casts from android.widget classes. Also @removes
methods on ListView that were overriding @hidden methods and should
never have been exposed as public API.

Bug: 24137209
Test: make
Change-Id: I89f0e51258560987b3942251fd249210f825ac2a
2017-02-27 11:06:20 -05:00
Andrei Stingaceanu
ab18567419 AutoSize TextView (part 11) - fix final APIs
* public attr "autoSizeText" becomes "autoSizeTextType"
  (inlined with all other methods and naming)
* documentation for autoSizetextType "uniform" re-worked:
  "The TextView scales text size both horizontally and
  vertically to fit  within the container"
* converted comments into Javadoc for
  TextView#AUTO_SIZE_TEXT_TYPE_NONE and
  TextView#AUTO_SIZE_TEXT_TYPE_UNIFORM
* better documented attr "autoSizePresetSizes" to specify
  it is a resource array of dimensions
* various small fixes in comments

Bug: 35755149
Bug: 35763485
Bug: 35764658
Bug: 32221168
Test: run cts-dev -m CtsWidgetTestCases -t \
      android.widget.cts.TextViewTest

Change-Id: I36afd399e005521b6e85922aa9e1e4418bb960e1
2017-02-27 15:17:46 +00:00
TreeHugger Robot
d77ae2b0ac Merge "Implement reset to original selection." 2017-02-25 02:57:55 +00:00
Abodunrinwa Toki
89ba5fbde0 Implement reset to original selection.
The UX for smart selection specifies that the user is able to reset
the original selection by tapping once on the word after smart
selection. Tap once, and the selection resets to the word that was
initially selected (before smart selection happened), tap one more
time and the insertion cursor appears as usual. If the user taps
a different word other than the original selection, the insertion
cursor appears as before.

Test: I7456eb4773d40366a3f4aa7bf051a1c7ddda6e9d
Bug: 34777048
Change-Id: If73259ddb67379d5a5deaa01b840b5185cedf4c8
2017-02-24 19:36:30 +00:00
Siyamed Sinir
a2ba2a3923 Merge "Revert "Request re-layout after setText if layout width is 0"" 2017-02-24 07:45:54 +00:00
Siyamed Sinir
6f29b7aa9e Revert "Request re-layout after setText if layout width is 0"
This reverts commit b4b8740aed.
Reverts fix for bug 27995311.

Test: cts-tradefed run cts --test android.widget.cts.TextViewTest -m
CtsWidgetTestCases --skip-device-info --skip-preconditions
--skip-connectivity-check

Fixes: 34843459
Change-Id: I2cea04cd12953b110c59a5a84e9eea5060fc038d
2017-02-23 20:20:26 -08:00
TreeHugger Robot
f30b879c73 Merge "Added sanitization for CompoundButton and RadioGroup." 2017-02-23 15:24:07 +00:00
Felipe Leme
62fb65fd3c Merge "Added auto-fill support for Spinner." 2017-02-23 06:45:16 +00:00
Aurimas Liutikas
4f911e1c5a Merge "Fix toggling of AM/PM of TimePicker using hardware keyboard." 2017-02-23 04:52:07 +00:00
TreeHugger Robot
4bc511cb66 Merge "VideoView: option for audio focus, support for AudioAttributes" 2017-02-23 04:37:54 +00:00
Felipe Leme
c01a873c4f Added sanitization for CompoundButton and RadioGroup.
Bug: 33269702
Bug: 33550221
Test: CtsAutoFillServiceTestCases (with new tests) pass

Change-Id: Ie2c8d2784227371588aa02973b8ef3ac1a6950aa
2017-02-22 19:15:38 -08:00
Aurimas Liutikas
c51c5f29fb Fix toggling of AM/PM of TimePicker using hardware keyboard.
Set AM/PM mode before setting hour in TextInputTimePickerView. This is
needed so we know exactly which it is when we are using 12 hour clock.
Not setting it early was causing TextInputTimePickerView to update TimePicker
with the hour that was not offset correctly based on AM/PM state.

Test: existing tests caught this - TimePickerTest#testKeyboardInputModeClockAmPm
      verified locally that this test now passes.
Bug: 35262830

Change-Id: I7e912320cb5a72c5d9d4e80dc0b42deb651f2636
2017-02-22 17:00:30 -08:00
Felipe Leme
d09ccb8db6 Added auto-fill support for Spinner.
Spinner is a special kind of list-value field because its auto-fillable
values are not currently present in the assist structure: this change
adds a getAutoFillOptions() to fill that void, and implements the
auto-fill APIs on Spinner.

It also fixes RadioGroup.getAutoFillValue() - it should return the index
of the child, not its resource id.

Bug: 33550221
Test: CtsAutoFillServiceTestCases (with new tests) pass
Change-Id: I625e7dd705fade56fda490fcd3c4446c0c245ee1
2017-02-22 16:09:50 -08:00
Felipe Leme
7be469ad9d Merge "Fixed missing auto-fill save callbacks on TextView." 2017-02-22 23:56:47 +00:00
Jean-Michel Trivi
0f49f82e97 VideoView: option for audio focus, support for AudioAttributes
Add API for VideoView to select whether it uses audio focus during
  playback, and how.
Add support for AudioAttributes

Test: cts-tradefed run cts -m CtsWidgetTestCases -t android.widget.cts.VideoViewTest
Bug 30955183
Bug 30258418

Change-Id: I581d32c79c78b8197ded2319e0d5bfdc35b93c5e
2017-02-22 12:04:24 -08:00
Felipe Leme
0257c8a5d2 Fixed missing auto-fill save callbacks on TextView.
It was accidentally broken during a previous commit where the CTS test
failure was ignored by a known issue being fixed in another change -
this change fixes both problems.

Bug: 33550221
Bug: 3380254
Test: CtsAutoFillServiceTestCases pass (for real now :-)
Change-Id: I5b2aa6060995ca255e51d85aa6ec93a886fa522f
2017-02-22 11:57:53 -08:00
TreeHugger Robot
7843f0a799 Merge "Added auto-fill listeners for RadioGroup and CompoundButton." 2017-02-22 18:58:54 +00:00
Andrei Stingaceanu
f6e3654b61 Merge "CalendarView Material - fix exception if date is out of range" 2017-02-22 10:45:52 +00:00