diff options
author | Dianne Hackborn <hackbod@google.com> | 2015-02-03 18:13:40 -0800 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2015-02-06 10:42:44 -0800 |
commit | a7bb6fbeab933326d58aa806d8194b7b13239d34 (patch) | |
tree | f56d4455b6eec18420a982573b800fb0b6220ce1 /core/java/android/widget | |
parent | b989c5561ea10e623d73e7bb89b37ac38ccdd908 (diff) | |
download | frameworks_base-a7bb6fbeab933326d58aa806d8194b7b13239d34.zip frameworks_base-a7bb6fbeab933326d58aa806d8194b7b13239d34.tar.gz frameworks_base-a7bb6fbeab933326d58aa806d8194b7b13239d34.tar.bz2 |
First quick implementation of auto assist data.
Introduce new AssistData class that contains all data
the framework automatically generates for assist. Currently
populated with a very simple tree structure representing
the app's view hierarchy.
Reworked how we populate the class name for accessibility
info, so this is provided through a new method call on View
that subclasses can override. This method is also used
to populate the class name in AssistData.
Change-Id: Ibd0acdc8354727d4291473283b5e4b70894905dc
Diffstat (limited to 'core/java/android/widget')
59 files changed, 169 insertions, 559 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 897749f..e87a117 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1492,18 +1492,15 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te super.sendAccessibilityEventInternal(eventType); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AbsListView.class.getName()); + public CharSequence getAccessibilityClassName() { + return AbsListView.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AbsListView.class.getName()); if (isEnabled()) { if (canScrollUp()) { info.addAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD); diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 1f7be63..4f6ea23 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -715,18 +715,15 @@ public abstract class AbsSeekBar extends ProgressBar { return super.onKeyDown(keyCode, event); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AbsSeekBar.class.getName()); + public CharSequence getAccessibilityClassName() { + return AbsSeekBar.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AbsSeekBar.class.getName()); if (isEnabled()) { final int progress = getProgress(); diff --git a/core/java/android/widget/AbsSpinner.java b/core/java/android/widget/AbsSpinner.java index 5d8d48f..e432747 100644 --- a/core/java/android/widget/AbsSpinner.java +++ b/core/java/android/widget/AbsSpinner.java @@ -470,17 +470,8 @@ public abstract class AbsSpinner extends AdapterView<SpinnerAdapter> { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AbsSpinner.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AbsSpinner.class.getName()); + public CharSequence getAccessibilityClassName() { + return AbsSpinner.class.getName(); } } diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index 428b6ce..9b977fa 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -955,11 +955,15 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { return false; } + @Override + public CharSequence getAccessibilityClassName() { + return AdapterView.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AdapterView.class.getName()); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { @@ -971,7 +975,6 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AdapterView.class.getName()); event.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { diff --git a/core/java/android/widget/AdapterViewAnimator.java b/core/java/android/widget/AdapterViewAnimator.java index 96eb0e2..a242175 100644 --- a/core/java/android/widget/AdapterViewAnimator.java +++ b/core/java/android/widget/AdapterViewAnimator.java @@ -1084,17 +1084,8 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> public void fyiWillBeAdvancedByHostKThx() { } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AdapterViewAnimator.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AdapterViewAnimator.class.getName()); + public CharSequence getAccessibilityClassName() { + return AdapterViewAnimator.class.getName(); } } diff --git a/core/java/android/widget/AdapterViewFlipper.java b/core/java/android/widget/AdapterViewFlipper.java index a7ba617..01b6530 100644 --- a/core/java/android/widget/AdapterViewFlipper.java +++ b/core/java/android/widget/AdapterViewFlipper.java @@ -304,17 +304,8 @@ public class AdapterViewFlipper extends AdapterViewAnimator { updateRunning(false); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(AdapterViewFlipper.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(AdapterViewFlipper.class.getName()); + public CharSequence getAccessibilityClassName() { + return AdapterViewFlipper.class.getName(); } } diff --git a/core/java/android/widget/Button.java b/core/java/android/widget/Button.java index 90d77f9..9b0d0dd 100644 --- a/core/java/android/widget/Button.java +++ b/core/java/android/widget/Button.java @@ -111,17 +111,8 @@ public class Button extends TextView { super(context, attrs, defStyleAttr, defStyleRes); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(Button.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(Button.class.getName()); + public CharSequence getAccessibilityClassName() { + return Button.class.getName(); } } diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index d58da8f..5e43916 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -501,16 +501,9 @@ public class CalendarView extends FrameLayout { mDelegate.onConfigurationChanged(newConfig); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - event.setClassName(CalendarView.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - info.setClassName(CalendarView.class.getName()); + public CharSequence getAccessibilityClassName() { + return CalendarView.class.getName(); } /** diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java index b1fb338..5a7d585 100644 --- a/core/java/android/widget/CheckBox.java +++ b/core/java/android/widget/CheckBox.java @@ -72,17 +72,8 @@ public class CheckBox extends CompoundButton { super(context, attrs, defStyleAttr, defStyleRes); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(CheckBox.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(CheckBox.class.getName()); + public CharSequence getAccessibilityClassName() { + return CheckBox.class.getName(); } } diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 477862b..344d00a 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -435,11 +435,15 @@ public class CheckedTextView extends TextView implements Checkable { } } + @Override + public CharSequence getAccessibilityClassName() { + return CheckedTextView.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(CheckedTextView.class.getName()); event.setChecked(mChecked); } @@ -447,7 +451,6 @@ public class CheckedTextView extends TextView implements Checkable { @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(CheckedTextView.class.getName()); info.setCheckable(true); info.setChecked(mChecked); } diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index 05fc6a1..019d475 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -281,17 +281,8 @@ public class Chronometer extends TextView { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(Chronometer.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(Chronometer.class.getName()); + public CharSequence getAccessibilityClassName() { + return Chronometer.class.getName(); } } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index 41a3915..fede493 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -324,11 +324,15 @@ public abstract class CompoundButton extends Button implements Checkable { } } + @Override + public CharSequence getAccessibilityClassName() { + return CompoundButton.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(CompoundButton.class.getName()); event.setChecked(mChecked); } @@ -336,7 +340,6 @@ public abstract class CompoundButton extends Button implements Checkable { @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(CompoundButton.class.getName()); info.setCheckable(true); info.setChecked(mChecked); } diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java index 0f0cd2e..7c6055a 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -296,18 +296,9 @@ public class DatePicker extends FrameLayout { mDelegate.onPopulateAccessibilityEvent(event); } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - mDelegate.onInitializeAccessibilityEvent(event); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - mDelegate.onInitializeAccessibilityNodeInfo(info); + public CharSequence getAccessibilityClassName() { + return DatePicker.class.getName(); } @Override @@ -476,8 +467,6 @@ public class DatePicker extends FrameLayout { boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event); void onPopulateAccessibilityEvent(AccessibilityEvent event); - void onInitializeAccessibilityEvent(AccessibilityEvent event); - void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info); } /** @@ -892,16 +881,6 @@ public class DatePicker extends FrameLayout { event.getText().add(selectedDateUtterance); } - @Override - public void onInitializeAccessibilityEvent(AccessibilityEvent event) { - event.setClassName(DatePicker.class.getName()); - } - - @Override - public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { - info.setClassName(DatePicker.class.getName()); - } - /** * Sets the current locale. * diff --git a/core/java/android/widget/DatePickerCalendarDelegate.java b/core/java/android/widget/DatePickerCalendarDelegate.java index a3b834e..85b4d30 100644 --- a/core/java/android/widget/DatePickerCalendarDelegate.java +++ b/core/java/android/widget/DatePickerCalendarDelegate.java @@ -584,14 +584,8 @@ class DatePickerCalendarDelegate extends DatePicker.AbstractDatePickerDelegate i event.getText().add(mCurrentDate.getTime().toString()); } - @Override - public void onInitializeAccessibilityEvent(AccessibilityEvent event) { - event.setClassName(DatePicker.class.getName()); - } - - @Override - public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { - info.setClassName(DatePicker.class.getName()); + public CharSequence getAccessibilityClassName() { + return DatePicker.class.getName(); } @Override diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java index 372bdb3..b936a5b 100644 --- a/core/java/android/widget/DigitalClock.java +++ b/core/java/android/widget/DigitalClock.java @@ -115,19 +115,9 @@ public class DigitalClock extends TextView { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); + public CharSequence getAccessibilityClassName() { //noinspection deprecation - event.setClassName(DigitalClock.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - //noinspection deprecation - info.setClassName(DigitalClock.class.getName()); + return DigitalClock.class.getName(); } } diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java index f54beb5..24cc2d8 100644 --- a/core/java/android/widget/EditText.java +++ b/core/java/android/widget/EditText.java @@ -122,18 +122,9 @@ public class EditText extends TextView { super.setEllipsize(ellipsis); } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(EditText.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(EditText.class.getName()); + public CharSequence getAccessibilityClassName() { + return EditText.class.getName(); } /** @hide */ diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java index 675dc9b..323ddb6 100644 --- a/core/java/android/widget/ExpandableListView.java +++ b/core/java/android/widget/ExpandableListView.java @@ -1341,17 +1341,8 @@ public class ExpandableListView extends ListView { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ExpandableListView.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ExpandableListView.class.getName()); + public CharSequence getAccessibilityClassName() { + return ExpandableListView.class.getName(); } } diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index b5782fc..57bbc42 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -708,19 +708,9 @@ public class FrameLayout extends ViewGroup { return new LayoutParams(p); } - - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(FrameLayout.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(FrameLayout.class.getName()); + public CharSequence getAccessibilityClassName() { + return FrameLayout.class.getName(); } /** diff --git a/core/java/android/widget/Gallery.java b/core/java/android/widget/Gallery.java index 3c428b0..ac19e6d 100644 --- a/core/java/android/widget/Gallery.java +++ b/core/java/android/widget/Gallery.java @@ -1373,18 +1373,15 @@ public class Gallery extends AbsSpinner implements GestureDetector.OnGestureList } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(Gallery.class.getName()); + public CharSequence getAccessibilityClassName() { + return Gallery.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(Gallery.class.getName()); info.setScrollable(mItemCount > 1); if (isEnabled()) { if (mItemCount > 0 && mSelectedPosition < mItemCount - 1) { diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index cc925eb..41ddc98 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -1190,18 +1190,9 @@ public class GridLayout extends ViewGroup { } } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(GridLayout.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(GridLayout.class.getName()); + public CharSequence getAccessibilityClassName() { + return GridLayout.class.getName(); } // Inner classes diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index f7ce57b..8b2217c 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -2341,18 +2341,15 @@ public class GridView extends AbsListView { return result; } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(GridView.class.getName()); + public CharSequence getAccessibilityClassName() { + return GridView.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(GridView.class.getName()); final int columnsCount = getNumColumns(); final int rowsCount = getCount() / columnsCount; diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index f1fa1b6..b37495f 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -795,11 +795,15 @@ public class HorizontalScrollView extends FrameLayout { return false; } + @Override + public CharSequence getAccessibilityClassName() { + return HorizontalScrollView.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(HorizontalScrollView.class.getName()); final int scrollRange = getScrollRange(); if (scrollRange > 0) { info.setScrollable(true); @@ -816,7 +820,6 @@ public class HorizontalScrollView extends FrameLayout { @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(HorizontalScrollView.class.getName()); event.setScrollable(getScrollRange() > 0); event.setScrollX(mScrollX); event.setScrollY(mScrollY); diff --git a/core/java/android/widget/ImageButton.java b/core/java/android/widget/ImageButton.java index 3b6825d..22f9c10 100644 --- a/core/java/android/widget/ImageButton.java +++ b/core/java/android/widget/ImageButton.java @@ -92,17 +92,8 @@ public class ImageButton extends ImageView { return false; } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ImageButton.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ImageButton.class.getName()); + public CharSequence getAccessibilityClassName() { + return ImageButton.class.getName(); } } diff --git a/core/java/android/widget/ImageSwitcher.java b/core/java/android/widget/ImageSwitcher.java index 0910eb0..80e908a 100644 --- a/core/java/android/widget/ImageSwitcher.java +++ b/core/java/android/widget/ImageSwitcher.java @@ -56,17 +56,8 @@ public class ImageSwitcher extends ViewSwitcher showNext(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ImageSwitcher.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ImageSwitcher.class.getName()); + public CharSequence getAccessibilityClassName() { + return ImageSwitcher.class.getName(); } } diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index fbad314..757038c 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -1419,17 +1419,8 @@ public class ImageView extends View { } } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ImageView.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ImageView.class.getName()); + public CharSequence getAccessibilityClassName() { + return ImageView.class.getName(); } } diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index 28e50c4..c0f63d2 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -1806,18 +1806,9 @@ public class LinearLayout extends ViewGroup { return p instanceof LinearLayout.LayoutParams; } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(LinearLayout.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(LinearLayout.class.getName()); + public CharSequence getAccessibilityClassName() { + return LinearLayout.class.getName(); } /** diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index df0d1fd..0aaef6d 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -3878,18 +3878,15 @@ public class ListView extends AbsListView { return false; } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ListView.class.getName()); + public CharSequence getAccessibilityClassName() { + return ListView.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ListView.class.getName()); final int rowsCount = getCount(); final int selectionMode = getSelectionModeForAccessibility(); diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java index 4cafe72..380b328 100644 --- a/core/java/android/widget/MediaController.java +++ b/core/java/android/widget/MediaController.java @@ -625,18 +625,9 @@ public class MediaController extends FrameLayout { super.setEnabled(enabled); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(MediaController.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(MediaController.class.getName()); + public CharSequence getAccessibilityClassName() { + return MediaController.class.getName(); } private View.OnClickListener mRewListener = new View.OnClickListener() { diff --git a/core/java/android/widget/MultiAutoCompleteTextView.java b/core/java/android/widget/MultiAutoCompleteTextView.java index 6954eea..c10e581 100644 --- a/core/java/android/widget/MultiAutoCompleteTextView.java +++ b/core/java/android/widget/MultiAutoCompleteTextView.java @@ -202,18 +202,9 @@ public class MultiAutoCompleteTextView extends AutoCompleteTextView { editable.replace(start, end, mTokenizer.terminateToken(text)); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(MultiAutoCompleteTextView.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(MultiAutoCompleteTextView.class.getName()); + public CharSequence getAccessibilityClassName() { + return MultiAutoCompleteTextView.class.getName(); } public static interface Tokenizer { diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index d32cb10..9c3296b 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -1825,22 +1825,19 @@ public class ProgressBar extends View { mAttached = false; } + @Override + public CharSequence getAccessibilityClassName() { + return ProgressBar.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ProgressBar.class.getName()); event.setItemCount(mMax); event.setCurrentItemIndex(mProgress); } - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ProgressBar.class.getName()); - } - /** * Schedule a command for sending an accessibility event. * </br> diff --git a/core/java/android/widget/QuickContactBadge.java b/core/java/android/widget/QuickContactBadge.java index d0e8081..3068de9 100644 --- a/core/java/android/widget/QuickContactBadge.java +++ b/core/java/android/widget/QuickContactBadge.java @@ -304,18 +304,9 @@ public class QuickContactBadge extends ImageView implements OnClickListener { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(QuickContactBadge.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(QuickContactBadge.class.getName()); + public CharSequence getAccessibilityClassName() { + return QuickContactBadge.class.getName(); } /** diff --git a/core/java/android/widget/RadioButton.java b/core/java/android/widget/RadioButton.java index 82280b4..aebc1b6 100644 --- a/core/java/android/widget/RadioButton.java +++ b/core/java/android/widget/RadioButton.java @@ -79,17 +79,8 @@ public class RadioButton extends CompoundButton { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(RadioButton.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(RadioButton.class.getName()); + public CharSequence getAccessibilityClassName() { + return RadioButton.class.getName(); } } diff --git a/core/java/android/widget/RadioGroup.java b/core/java/android/widget/RadioGroup.java index c0f60eb..f04bb3d 100644 --- a/core/java/android/widget/RadioGroup.java +++ b/core/java/android/widget/RadioGroup.java @@ -240,18 +240,9 @@ public class RadioGroup extends LinearLayout { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(RadioGroup.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(RadioGroup.class.getName()); + public CharSequence getAccessibilityClassName() { + return RadioGroup.class.getName(); } /** diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java index 2d0649d..4268961 100644 --- a/core/java/android/widget/RatingBar.java +++ b/core/java/android/widget/RatingBar.java @@ -330,18 +330,9 @@ public class RatingBar extends AbsSeekBar { super.setMax(max); } - - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(RatingBar.class.getName()); - } - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(RatingBar.class.getName()); + public CharSequence getAccessibilityClassName() { + return RatingBar.class.getName(); } } diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index 71f4da0..89b1d54 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -1103,18 +1103,9 @@ public class RelativeLayout extends ViewGroup { return false; } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(RelativeLayout.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(RelativeLayout.class.getName()); + public CharSequence getAccessibilityClassName() { + return RelativeLayout.class.getName(); } /** diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 1098419..b95c27d 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -839,11 +839,15 @@ public class ScrollView extends FrameLayout { return false; } + @Override + public CharSequence getAccessibilityClassName() { + return ScrollView.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ScrollView.class.getName()); if (isEnabled()) { final int scrollRange = getScrollRange(); if (scrollRange > 0) { @@ -862,7 +866,6 @@ public class ScrollView extends FrameLayout { @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ScrollView.class.getName()); final boolean scrollable = getScrollRange() > 0; event.setScrollable(scrollable); event.setScrollX(mScrollX); diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java index a1f361a..8846421 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -1325,18 +1325,9 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { setIconified(false); } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(SearchView.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(SearchView.class.getName()); + public CharSequence getAccessibilityClassName() { + return SearchView.class.getName(); } private void adjustDropDownSizeAndPosition() { diff --git a/core/java/android/widget/SeekBar.java b/core/java/android/widget/SeekBar.java index aa5c055..e97bdf2 100644 --- a/core/java/android/widget/SeekBar.java +++ b/core/java/android/widget/SeekBar.java @@ -124,17 +124,8 @@ public class SeekBar extends AbsSeekBar { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(SeekBar.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(SeekBar.class.getName()); + public CharSequence getAccessibilityClassName() { + return SeekBar.class.getName(); } } diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java index e3f4a10..272f4b0 100644 --- a/core/java/android/widget/SlidingDrawer.java +++ b/core/java/android/widget/SlidingDrawer.java @@ -837,18 +837,9 @@ public class SlidingDrawer extends ViewGroup { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(SlidingDrawer.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(SlidingDrawer.class.getName()); + public CharSequence getAccessibilityClassName() { + return SlidingDrawer.class.getName(); } private void closeDrawer() { diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index a6e0e6d..6ee2b4c 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -765,18 +765,15 @@ public class Spinner extends AbsSpinner implements OnClickListener { dialog.dismiss(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(Spinner.class.getName()); + public CharSequence getAccessibilityClassName() { + return Spinner.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(Spinner.class.getName()); if (mAdapter != null) { info.setCanOpenPopup(true); diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 2aa1c09..803ba4b 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -1224,18 +1224,15 @@ public class StackView extends AdapterViewAnimator { measureChildren(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(StackView.class.getName()); + public CharSequence getAccessibilityClassName() { + return StackView.class.getName(); } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(StackView.class.getName()); info.setScrollable(getChildCount() > 1); if (isEnabled()) { if (getDisplayedChild() < getChildCount() - 1) { diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index a282cf5..b959ddc 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -30,6 +30,7 @@ import android.graphics.Rect; import android.graphics.Typeface; import android.graphics.Region.Op; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.text.Layout; import android.text.StaticLayout; import android.text.TextPaint; @@ -43,6 +44,7 @@ import android.view.Gravity; import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.VelocityTracker; +import android.view.ViewAssistData; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; @@ -1353,18 +1355,31 @@ public class Switch extends CompoundButton { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(Switch.class.getName()); + public CharSequence getAccessibilityClassName() { + return Switch.class.getName(); + } + + @Override + public void onProvideAssistData(ViewAssistData data, Bundle extras) { + super.onProvideAssistData(data, extras); + CharSequence switchText = isChecked() ? mTextOn : mTextOff; + if (!TextUtils.isEmpty(switchText)) { + CharSequence oldText = data.getText(); + if (TextUtils.isEmpty(oldText)) { + data.setText(switchText); + } else { + StringBuilder newText = new StringBuilder(); + newText.append(oldText).append(' ').append(switchText); + data.setText(newText); + } + } } /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(Switch.class.getName()); CharSequence switchText = isChecked() ? mTextOn : mTextOff; if (!TextUtils.isEmpty(switchText)) { CharSequence oldText = info.getText(); diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 3c3389a..bf35cf9 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -384,18 +384,9 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); } } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TabHost.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TabHost.class.getName()); + public CharSequence getAccessibilityClassName() { + return TabHost.class.getName(); } public void setCurrentTab(int index) { diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index bddee91..88ecb13 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -415,11 +415,15 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { return false; } + @Override + public CharSequence getAccessibilityClassName() { + return TabWidget.class.getName(); + } + /** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TabWidget.class.getName()); event.setItemCount(getTabCount()); event.setCurrentItemIndex(mSelectedTab); } @@ -436,13 +440,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { super.sendAccessibilityEventUncheckedInternal(event); } - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TabWidget.class.getName()); - } - /** * Sets the current tab and focuses the UI on it. * This method makes sure that the focused tab matches the selected diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java index a6b78a4..c825d17 100644 --- a/core/java/android/widget/TableLayout.java +++ b/core/java/android/widget/TableLayout.java @@ -666,18 +666,9 @@ public class TableLayout extends LinearLayout { return new LayoutParams(p); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TableLayout.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TableLayout.class.getName()); + public CharSequence getAccessibilityClassName() { + return TableLayout.class.getName(); } /** diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java index c29296a..72fce3f 100644 --- a/core/java/android/widget/TableRow.java +++ b/core/java/android/widget/TableRow.java @@ -379,18 +379,9 @@ public class TableRow extends LinearLayout { return new LayoutParams(p); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TableRow.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TableRow.class.getName()); + public CharSequence getAccessibilityClassName() { + return TableRow.class.getName(); } /** diff --git a/core/java/android/widget/TextSwitcher.java b/core/java/android/widget/TextSwitcher.java index 7c883ba..22822b1 100644 --- a/core/java/android/widget/TextSwitcher.java +++ b/core/java/android/widget/TextSwitcher.java @@ -91,17 +91,8 @@ public class TextSwitcher extends ViewSwitcher { ((TextView)getCurrentView()).setText(text); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TextSwitcher.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TextSwitcher.class.getName()); + public CharSequence getAccessibilityClassName() { + return TextSwitcher.class.getName(); } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 94fc9e9..848c1c0 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -109,6 +109,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; +import android.view.ViewAssistData; import android.view.ViewConfiguration; import android.view.ViewDebug; import android.view.ViewGroup.LayoutParams; @@ -8531,12 +8532,26 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener UserHandle.USER_CURRENT_OR_SELF) == 1); } + @Override + public CharSequence getAccessibilityClassName() { + return TextView.class.getName(); + } + + @Override + public void onProvideAssistData(ViewAssistData data, Bundle extras) { + super.onProvideAssistData(data, extras); + final boolean isPassword = hasPasswordTransformationMethod(); + if (!isPassword) { + data.setText(getText(), getSelectionStart(), getSelectionEnd()); + } + data.setHint(getHint()); + } + /** @hide */ @Override public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TextView.class.getName()); final boolean isPassword = hasPasswordTransformationMethod(); event.setPassword(isPassword); @@ -8552,7 +8567,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TextView.class.getName()); final boolean isPassword = hasPasswordTransformationMethod(); info.setPassword(isPassword); diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java index bbf5f53..9df8a21 100644 --- a/core/java/android/widget/TimePicker.java +++ b/core/java/android/widget/TimePicker.java @@ -195,31 +195,15 @@ public class TimePicker extends FrameLayout { mDelegate.onRestoreInstanceState(ss); } - /** @hide */ - @Override - public boolean dispatchPopulateAccessibilityEventInternal(AccessibilityEvent event) { - return mDelegate.dispatchPopulateAccessibilityEvent(event); - } - - /** @hide */ @Override - public void onPopulateAccessibilityEventInternal(AccessibilityEvent event) { - super.onPopulateAccessibilityEventInternal(event); - mDelegate.onPopulateAccessibilityEvent(event); + public CharSequence getAccessibilityClassName() { + return TimePicker.class.getName(); } /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - mDelegate.onInitializeAccessibilityEvent(event); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - mDelegate.onInitializeAccessibilityNodeInfo(info); + public boolean dispatchPopulateAccessibilityEventInternal(AccessibilityEvent event) { + return mDelegate.dispatchPopulateAccessibilityEvent(event); } /** @@ -252,8 +236,6 @@ public class TimePicker extends FrameLayout { boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event); void onPopulateAccessibilityEvent(AccessibilityEvent event); - void onInitializeAccessibilityEvent(AccessibilityEvent event); - void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info); } /** diff --git a/core/java/android/widget/TimePickerClockDelegate.java b/core/java/android/widget/TimePickerClockDelegate.java index 1534429..05c7a5f 100644 --- a/core/java/android/widget/TimePickerClockDelegate.java +++ b/core/java/android/widget/TimePickerClockDelegate.java @@ -466,16 +466,6 @@ class TimePickerClockDelegate extends TimePicker.AbstractTimePickerDelegate impl event.getText().add(selectedDate); } - @Override - public void onInitializeAccessibilityEvent(AccessibilityEvent event) { - event.setClassName(TimePicker.class.getName()); - } - - @Override - public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { - info.setClassName(TimePicker.class.getName()); - } - /** * Set whether in keyboard mode or not. * diff --git a/core/java/android/widget/TimePickerSpinnerDelegate.java b/core/java/android/widget/TimePickerSpinnerDelegate.java index e162f4a..af69110 100644 --- a/core/java/android/widget/TimePickerSpinnerDelegate.java +++ b/core/java/android/widget/TimePickerSpinnerDelegate.java @@ -427,16 +427,6 @@ class TimePickerSpinnerDelegate extends TimePicker.AbstractTimePickerDelegate { event.getText().add(selectedDateUtterance); } - @Override - public void onInitializeAccessibilityEvent(AccessibilityEvent event) { - event.setClassName(TimePicker.class.getName()); - } - - @Override - public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { - info.setClassName(TimePicker.class.getName()); - } - private void updateInputState() { // Make sure that if the user changes the value and the IME is active // for one of the inputs if this widget, the IME is closed. If the user diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java index 1b23778..4f8342b 100644 --- a/core/java/android/widget/ToggleButton.java +++ b/core/java/android/widget/ToggleButton.java @@ -153,17 +153,8 @@ public class ToggleButton extends CompoundButton { } } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ToggleButton.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ToggleButton.class.getName()); + public CharSequence getAccessibilityClassName() { + return ToggleButton.class.getName(); } } diff --git a/core/java/android/widget/TwoLineListItem.java b/core/java/android/widget/TwoLineListItem.java index 9035dbe..0cd7eb9 100644 --- a/core/java/android/widget/TwoLineListItem.java +++ b/core/java/android/widget/TwoLineListItem.java @@ -93,17 +93,8 @@ public class TwoLineListItem extends RelativeLayout { return mText2; } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(TwoLineListItem.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(TwoLineListItem.class.getName()); + public CharSequence getAccessibilityClassName() { + return TwoLineListItem.class.getName(); } } diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index a240dc2..48283d4 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -201,18 +201,9 @@ public class VideoView extends SurfaceView setMeasuredDimension(width, height); } - /** @hide */ - @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(VideoView.class.getName()); - } - - /** @hide */ @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(VideoView.class.getName()); + public CharSequence getAccessibilityClassName() { + return VideoView.class.getName(); } public int resolveAdjustedSize(int desiredSize, int measureSpec) { diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java index d31754b..5ef5222 100644 --- a/core/java/android/widget/ViewAnimator.java +++ b/core/java/android/widget/ViewAnimator.java @@ -357,17 +357,8 @@ public class ViewAnimator extends FrameLayout { return (getCurrentView() != null) ? getCurrentView().getBaseline() : super.getBaseline(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ViewAnimator.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ViewAnimator.class.getName()); + public CharSequence getAccessibilityClassName() { + return ViewAnimator.class.getName(); } } diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java index 587f469..a43a185 100644 --- a/core/java/android/widget/ViewFlipper.java +++ b/core/java/android/widget/ViewFlipper.java @@ -149,18 +149,9 @@ public class ViewFlipper extends ViewAnimator { updateRunning(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ViewFlipper.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ViewFlipper.class.getName()); + public CharSequence getAccessibilityClassName() { + return ViewFlipper.class.getName(); } /** diff --git a/core/java/android/widget/ViewSwitcher.java b/core/java/android/widget/ViewSwitcher.java index c97770f..2f544cc 100644 --- a/core/java/android/widget/ViewSwitcher.java +++ b/core/java/android/widget/ViewSwitcher.java @@ -68,18 +68,9 @@ public class ViewSwitcher extends ViewAnimator { super.addView(child, index, params); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ViewSwitcher.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ViewSwitcher.class.getName()); + public CharSequence getAccessibilityClassName() { + return ViewSwitcher.class.getName(); } /** diff --git a/core/java/android/widget/ZoomButton.java b/core/java/android/widget/ZoomButton.java index e0be0ab..6b3faed 100644 --- a/core/java/android/widget/ZoomButton.java +++ b/core/java/android/widget/ZoomButton.java @@ -103,17 +103,8 @@ public class ZoomButton extends ImageButton implements OnLongClickListener { return super.dispatchUnhandledMove(focused, direction); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ZoomButton.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ZoomButton.class.getName()); + public CharSequence getAccessibilityClassName() { + return ZoomButton.class.getName(); } } diff --git a/core/java/android/widget/ZoomControls.java b/core/java/android/widget/ZoomControls.java index a0aacea..bef1ace 100644 --- a/core/java/android/widget/ZoomControls.java +++ b/core/java/android/widget/ZoomControls.java @@ -109,17 +109,8 @@ public class ZoomControls extends LinearLayout { return mZoomIn.hasFocus() || mZoomOut.hasFocus(); } - /** @hide */ @Override - public void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { - super.onInitializeAccessibilityEventInternal(event); - event.setClassName(ZoomControls.class.getName()); - } - - /** @hide */ - @Override - public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { - super.onInitializeAccessibilityNodeInfoInternal(info); - info.setClassName(ZoomControls.class.getName()); + public CharSequence getAccessibilityClassName() { + return ZoomControls.class.getName(); } } |