diff options
59 files changed, 724 insertions, 34 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 64f862a..e8ca783 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -4107,7 +4107,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal */ void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { event.setSource(this); - event.setClassName(getClass().getName()); + event.setClassName(View.class.getName()); event.setPackageName(getContext().getPackageName()); event.setEnabled(isEnabled()); event.setContentDescription(mContentDescription); @@ -4212,7 +4212,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } info.setPackageName(mContext.getPackageName()); - info.setClassName(getClass().getName()); + info.setClassName(View.class.getName()); info.setContentDescription(getContentDescription()); info.setEnabled(isEnabled()); diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index 09901ff..5c63366 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -2229,6 +2229,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager @Override void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfoInternal(info); + info.setClassName(ViewGroup.class.getName()); for (int i = 0, count = mChildrenCount; i < count; i++) { View child = mChildren[i]; if ((child.mViewFlags & VISIBILITY_MASK) == VISIBLE @@ -2238,6 +2239,12 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } + @Override + void onInitializeAccessibilityEventInternal(AccessibilityEvent event) { + super.onInitializeAccessibilityEventInternal(event); + event.setClassName(ViewGroup.class.getName()); + } + /** * {@inheritDoc} */ diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index 38bb2e1..fc8dbf1 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -20,7 +20,6 @@ import com.android.internal.R; import android.content.Context; import android.content.Intent; -import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Rect; @@ -1297,6 +1296,18 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te super.sendAccessibilityEvent(eventType); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(AbsListView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AbsListView.class.getName()); + } + /** * Indicates whether the children's drawing cache is used during a scroll. * By default, the drawing cache is enabled but this will consume more memory. diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index bdaf89e..e36afa3 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -25,6 +25,8 @@ import android.util.AttributeSet; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.ViewConfiguration; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; public abstract class AbsSeekBar extends ProgressBar { private Drawable mThumb; @@ -464,4 +466,15 @@ public abstract class AbsSeekBar extends ProgressBar { return super.onKeyDown(keyCode, event); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(AbsSeekBar.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AbsSeekBar.class.getName()); + } } diff --git a/core/java/android/widget/AbsSpinner.java b/core/java/android/widget/AbsSpinner.java index 3d79205..efdfae3 100644 --- a/core/java/android/widget/AbsSpinner.java +++ b/core/java/android/widget/AbsSpinner.java @@ -28,6 +28,8 @@ import android.util.AttributeSet; import android.util.SparseArray; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * An abstract base class for spinner widgets. SDK users will probably not @@ -40,7 +42,6 @@ public abstract class AbsSpinner extends AdapterView<SpinnerAdapter> { int mHeightMeasureSpec; int mWidthMeasureSpec; - boolean mBlockLayoutRequests; int mSelectionLeftPadding = 0; int mSelectionTopPadding = 0; @@ -463,4 +464,16 @@ public abstract class AbsSpinner extends AdapterView<SpinnerAdapter> { scrapHeap.clear(); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(AbsSpinner.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AbsSpinner.class.getName()); + } } diff --git a/core/java/android/widget/AdapterView.java b/core/java/android/widget/AdapterView.java index 40df168..97a864c 100644 --- a/core/java/android/widget/AdapterView.java +++ b/core/java/android/widget/AdapterView.java @@ -913,6 +913,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AdapterView.class.getName()); info.setScrollable(isScrollableForAccessibility()); View selectedView = getSelectedView(); if (selectedView != null) { @@ -923,6 +924,7 @@ public abstract class AdapterView<T extends Adapter> extends ViewGroup { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(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 c83c780..bbd7ad4 100644 --- a/core/java/android/widget/AdapterViewAnimator.java +++ b/core/java/android/widget/AdapterViewAnimator.java @@ -29,6 +29,8 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import java.util.ArrayList; import java.util.HashMap; @@ -1045,4 +1047,16 @@ public abstract class AdapterViewAnimator extends AdapterView<Adapter> */ public void fyiWillBeAdvancedByHostKThx() { } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(AdapterViewAnimator.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AdapterViewAnimator.class.getName()); + } } diff --git a/core/java/android/widget/AdapterViewFlipper.java b/core/java/android/widget/AdapterViewFlipper.java index 4419886..5096227 100644 --- a/core/java/android/widget/AdapterViewFlipper.java +++ b/core/java/android/widget/AdapterViewFlipper.java @@ -16,7 +16,6 @@ package android.widget; -import android.animation.ObjectAnimator; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -27,7 +26,8 @@ import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.RemotableViewMethod; -import android.view.animation.AlphaAnimation; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; /** @@ -268,4 +268,16 @@ public class AdapterViewFlipper extends AdapterViewAnimator { mAdvancedByHost = true; updateRunning(false); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(AdapterViewFlipper.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(AdapterViewFlipper.class.getName()); + } } diff --git a/core/java/android/widget/Button.java b/core/java/android/widget/Button.java index 8d58a6d..99f4cae 100644 --- a/core/java/android/widget/Button.java +++ b/core/java/android/widget/Button.java @@ -18,9 +18,8 @@ package android.widget; import android.content.Context; import android.util.AttributeSet; -import android.util.Log; -import android.view.MotionEvent; -import android.view.KeyEvent; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; @@ -107,4 +106,16 @@ public class Button extends TextView { public Button(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(Button.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(Button.class.getName()); + } } diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java index e0403ff..85252af 100644 --- a/core/java/android/widget/CalendarView.java +++ b/core/java/android/widget/CalendarView.java @@ -39,6 +39,8 @@ import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.AbsListView.OnScrollListener; import com.android.internal.R; @@ -431,6 +433,18 @@ public class CalendarView extends FrameLayout { setCurrentLocale(newConfig.locale); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(CalendarView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(CalendarView.class.getName()); + } + /** * Gets the minimal date supported by this {@link CalendarView} in milliseconds * since January 1, 1970 00:00:00 in {@link TimeZone#getDefault()} time diff --git a/core/java/android/widget/CheckBox.java b/core/java/android/widget/CheckBox.java index 2788846..0685eea 100644 --- a/core/java/android/widget/CheckBox.java +++ b/core/java/android/widget/CheckBox.java @@ -19,6 +19,7 @@ package android.widget; import android.content.Context; import android.util.AttributeSet; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; @@ -78,4 +79,16 @@ public class CheckBox extends CompoundButton { event.getText().add(mContext.getString(R.string.checkbox_not_checked)); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(CheckBox.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(CheckBox.class.getName()); + } } diff --git a/core/java/android/widget/CheckedTextView.java b/core/java/android/widget/CheckedTextView.java index 0a54743..5c7e5a3 100644 --- a/core/java/android/widget/CheckedTextView.java +++ b/core/java/android/widget/CheckedTextView.java @@ -220,6 +220,7 @@ public class CheckedTextView extends TextView implements Checkable { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + event.setClassName(CheckedTextView.class.getName()); event.setChecked(mChecked); } @@ -236,6 +237,7 @@ public class CheckedTextView extends TextView implements Checkable { @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(CheckedTextView.class.getName()); info.setChecked(mChecked); } } diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java index 7e66722..0370049 100644 --- a/core/java/android/widget/Chronometer.java +++ b/core/java/android/widget/Chronometer.java @@ -25,6 +25,8 @@ import android.os.SystemClock; import android.text.format.DateUtils; import android.util.AttributeSet; import android.util.Log; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; import java.util.Formatter; @@ -276,4 +278,16 @@ public class Chronometer extends TextView { mOnChronometerTickListener.onChronometerTick(this); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(Chronometer.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(Chronometer.class.getName()); + } } diff --git a/core/java/android/widget/CompoundButton.java b/core/java/android/widget/CompoundButton.java index d3cdad8..02c4c4f 100644 --- a/core/java/android/widget/CompoundButton.java +++ b/core/java/android/widget/CompoundButton.java @@ -211,12 +211,14 @@ public abstract class CompoundButton extends Button implements Checkable { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + event.setClassName(CompoundButton.class.getName()); event.setChecked(mChecked); } @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(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 0f462ff..110c8f3 100644 --- a/core/java/android/widget/DatePicker.java +++ b/core/java/android/widget/DatePicker.java @@ -31,6 +31,7 @@ import android.util.SparseArray; import android.view.LayoutInflater; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.NumberPicker.OnValueChangeListener; @@ -391,6 +392,18 @@ public class DatePicker extends FrameLayout { } @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(DatePicker.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(DatePicker.class.getName()); + } + + @Override protected void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); setCurrentLocale(newConfig.locale); diff --git a/core/java/android/widget/DigitalClock.java b/core/java/android/widget/DigitalClock.java index 379883a..add9d9b 100644 --- a/core/java/android/widget/DigitalClock.java +++ b/core/java/android/widget/DigitalClock.java @@ -24,6 +24,8 @@ import android.os.SystemClock; import android.provider.Settings; import android.text.format.DateFormat; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import java.util.Calendar; @@ -126,4 +128,16 @@ public class DigitalClock extends TextView { setFormat(); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(DigitalClock.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(DigitalClock.class.getName()); + } } diff --git a/core/java/android/widget/EditText.java b/core/java/android/widget/EditText.java index 0da68a4..2fd8768 100644 --- a/core/java/android/widget/EditText.java +++ b/core/java/android/widget/EditText.java @@ -24,6 +24,8 @@ import android.text.TextUtils; import android.text.method.ArrowKeyMovementMethod; import android.text.method.MovementMethod; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /* @@ -114,4 +116,16 @@ public class EditText extends TextView { } super.setEllipsize(ellipsis); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(EditText.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(EditText.class.getName()); + } } diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java index ead9b4f..badfaa7 100644 --- a/core/java/android/widget/ExpandableListView.java +++ b/core/java/android/widget/ExpandableListView.java @@ -30,6 +30,8 @@ import android.view.ContextMenu; import android.view.SoundEffectConstants; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ExpandableListConnector.PositionMetadata; import java.util.ArrayList; @@ -1167,4 +1169,15 @@ public class ExpandableListView extends ListView { } } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ExpandableListView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ExpandableListView.class.getName()); + } } diff --git a/core/java/android/widget/FrameLayout.java b/core/java/android/widget/FrameLayout.java index 74a57b0..da98884 100644 --- a/core/java/android/widget/FrameLayout.java +++ b/core/java/android/widget/FrameLayout.java @@ -29,6 +29,8 @@ import android.view.Gravity; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; @@ -555,6 +557,19 @@ public class FrameLayout extends ViewGroup { return new LayoutParams(p); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(FrameLayout.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(FrameLayout.class.getName()); + } + /** * Per-child layout information for layouts that support margins. * See {@link android.R.styleable#FrameLayout_Layout FrameLayout Layout Attributes} diff --git a/core/java/android/widget/Gallery.java b/core/java/android/widget/Gallery.java index 5e37fa8..03fdc39 100644 --- a/core/java/android/widget/Gallery.java +++ b/core/java/android/widget/Gallery.java @@ -32,6 +32,8 @@ import android.view.SoundEffectConstants; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.Transformation; import com.android.internal.R; @@ -1355,6 +1357,18 @@ public class Gallery extends AbsSpinner implements GestureDetector.OnGestureList } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(Gallery.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(Gallery.class.getName()); + } + /** * Responsible for fling behavior. Use {@link #startUsingVelocity(int)} to * initiate a fling. Each frame of the fling is handled in {@link #run()}. diff --git a/core/java/android/widget/GridLayout.java b/core/java/android/widget/GridLayout.java index 7cf5168..7d58011 100644 --- a/core/java/android/widget/GridLayout.java +++ b/core/java/android/widget/GridLayout.java @@ -27,6 +27,9 @@ import android.util.Pair; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; + import com.android.internal.R; import java.lang.reflect.Array; @@ -1041,6 +1044,18 @@ public class GridLayout extends ViewGroup { } } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(GridLayout.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(GridLayout.class.getName()); + } + // Inner classes /* diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index 5d406de..177c0d9 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -27,6 +27,8 @@ import android.view.SoundEffectConstants; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.GridLayoutAnimationController; import android.widget.RemoteViews.RemoteView; @@ -2116,5 +2118,16 @@ public class GridView extends AbsListView { } return result; } -} + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(GridView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(GridView.class.getName()); + } +} diff --git a/core/java/android/widget/HorizontalScrollView.java b/core/java/android/widget/HorizontalScrollView.java index 1683d20..0b4ebf4 100644 --- a/core/java/android/widget/HorizontalScrollView.java +++ b/core/java/android/widget/HorizontalScrollView.java @@ -721,12 +721,14 @@ public class HorizontalScrollView extends FrameLayout { @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(HorizontalScrollView.class.getName()); info.setScrollable(getScrollRange() > 0); } @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(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 d680fad..59a8f28 100644 --- a/core/java/android/widget/ImageButton.java +++ b/core/java/android/widget/ImageButton.java @@ -21,6 +21,8 @@ import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.view.MotionEvent; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; import java.util.Map; @@ -90,4 +92,16 @@ public class ImageButton extends ImageView { protected boolean onSetAlpha(int alpha) { return false; } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ImageButton.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ImageButton.class.getName()); + } } diff --git a/core/java/android/widget/ImageSwitcher.java b/core/java/android/widget/ImageSwitcher.java index bcb750a..c048970 100644 --- a/core/java/android/widget/ImageSwitcher.java +++ b/core/java/android/widget/ImageSwitcher.java @@ -16,12 +16,12 @@ package android.widget; -import java.util.Map; - import android.content.Context; import android.graphics.drawable.Drawable; import android.net.Uri; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; public class ImageSwitcher extends ViewSwitcher @@ -55,5 +55,16 @@ public class ImageSwitcher extends ViewSwitcher image.setImageDrawable(drawable); showNext(); } -} + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ImageSwitcher.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ImageSwitcher.class.getName()); + } +} diff --git a/core/java/android/widget/ImageView.java b/core/java/android/widget/ImageView.java index 73e1273..07ae93b 100644 --- a/core/java/android/widget/ImageView.java +++ b/core/java/android/widget/ImageView.java @@ -37,6 +37,7 @@ import android.view.RemotableViewMethod; import android.view.View; import android.view.ViewDebug; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; /** @@ -1060,4 +1061,16 @@ public class ImageView extends View { mDrawable.setVisible(false, false); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ImageView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ImageView.class.getName()); + } } diff --git a/core/java/android/widget/LinearLayout.java b/core/java/android/widget/LinearLayout.java index 427fd3e..b5deec7 100644 --- a/core/java/android/widget/LinearLayout.java +++ b/core/java/android/widget/LinearLayout.java @@ -27,6 +27,8 @@ import android.view.Gravity; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; @@ -1729,7 +1731,19 @@ public class LinearLayout extends ViewGroup { protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { return p instanceof LinearLayout.LayoutParams; } - + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(LinearLayout.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(LinearLayout.class.getName()); + } + /** * Per-child layout information associated with ViewLinearLayout. * diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java index 7f7a3a7..fda8fc2 100644 --- a/core/java/android/widget/ListView.java +++ b/core/java/android/widget/ListView.java @@ -32,13 +32,13 @@ import android.util.AttributeSet; import android.util.SparseBooleanArray; import android.view.FocusFinder; import android.view.KeyEvent; -import android.view.MotionEvent; import android.view.SoundEffectConstants; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.ViewParent; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; import java.util.ArrayList; @@ -3609,4 +3609,16 @@ public class ListView extends AbsListView { } return new long[0]; } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ListView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ListView.class.getName()); + } } diff --git a/core/java/android/widget/MediaController.java b/core/java/android/widget/MediaController.java index f2ea3fc..fc35f05 100644 --- a/core/java/android/widget/MediaController.java +++ b/core/java/android/widget/MediaController.java @@ -31,6 +31,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.SeekBar.OnSeekBarChangeListener; import com.android.internal.policy.PolicyManager; @@ -592,6 +594,18 @@ public class MediaController extends FrameLayout { super.setEnabled(enabled); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(MediaController.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(MediaController.class.getName()); + } + private View.OnClickListener mRewListener = new View.OnClickListener() { public void onClick(View v) { int pos = mPlayer.getCurrentPosition(); diff --git a/core/java/android/widget/MultiAutoCompleteTextView.java b/core/java/android/widget/MultiAutoCompleteTextView.java index 134e4c4..0b30c84 100644 --- a/core/java/android/widget/MultiAutoCompleteTextView.java +++ b/core/java/android/widget/MultiAutoCompleteTextView.java @@ -23,7 +23,8 @@ import android.text.Spanned; import android.text.TextUtils; import android.text.method.QwertyKeyListener; import android.util.AttributeSet; -import android.widget.MultiAutoCompleteTextView.Tokenizer; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * An editable text view, extending {@link AutoCompleteTextView}, that @@ -196,6 +197,18 @@ public class MultiAutoCompleteTextView extends AutoCompleteTextView { editable.replace(start, end, mTokenizer.terminateToken(text)); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(MultiAutoCompleteTextView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(MultiAutoCompleteTextView.class.getName()); + } + public static interface Tokenizer { /** * Returns the start of the token that ends at offset diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java index 7d0f98e..a210f0b 100644 --- a/core/java/android/widget/NumberPicker.java +++ b/core/java/android/widget/NumberPicker.java @@ -47,6 +47,7 @@ import android.view.View; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.DecelerateInterpolator; import android.view.inputmethod.InputMethodManager; @@ -1382,6 +1383,18 @@ public class NumberPicker extends LinearLayout { // perceive this widget as several controls rather as a whole. } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(NumberPicker.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(NumberPicker.class.getName()); + } + /** * Makes a measure spec that tries greedily to use the max value. * diff --git a/core/java/android/widget/ProgressBar.java b/core/java/android/widget/ProgressBar.java index df88fec..ace3f60 100644 --- a/core/java/android/widget/ProgressBar.java +++ b/core/java/android/widget/ProgressBar.java @@ -45,6 +45,7 @@ import android.view.View; import android.view.ViewDebug; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -1124,10 +1125,17 @@ public class ProgressBar extends View { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + event.setClassName(ProgressBar.class.getName()); event.setItemCount(mMax); event.setCurrentItemIndex(mProgress); } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(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 adc0fb0..786afe2 100644 --- a/core/java/android/widget/QuickContactBadge.java +++ b/core/java/android/widget/QuickContactBadge.java @@ -36,6 +36,8 @@ import android.provider.ContactsContract.RawContacts; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * Widget used to show an image with the standard QuickContact badge @@ -228,6 +230,18 @@ public class QuickContactBadge extends ImageView implements OnClickListener { } } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(QuickContactBadge.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(QuickContactBadge.class.getName()); + } + /** * Set a list of specific MIME-types to exclude and not display. For * example, this can be used to hide the {@link Contacts#CONTENT_ITEM_TYPE} diff --git a/core/java/android/widget/RadioButton.java b/core/java/android/widget/RadioButton.java index 9fa649f..b6dac3e 100644 --- a/core/java/android/widget/RadioButton.java +++ b/core/java/android/widget/RadioButton.java @@ -19,6 +19,7 @@ package android.widget; import android.content.Context; import android.util.AttributeSet; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; @@ -85,4 +86,16 @@ public class RadioButton extends CompoundButton { event.getText().add(mContext.getString(R.string.radiobutton_not_selected)); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(RadioButton.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(RadioButton.class.getName()); + } } diff --git a/core/java/android/widget/RadioGroup.java b/core/java/android/widget/RadioGroup.java index 393346a..7f53ffd 100644 --- a/core/java/android/widget/RadioGroup.java +++ b/core/java/android/widget/RadioGroup.java @@ -23,6 +23,8 @@ import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** @@ -236,6 +238,18 @@ public class RadioGroup extends LinearLayout { return new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(RadioGroup.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(RadioGroup.class.getName()); + } + /** * <p>This set of layout parameters defaults the width and the height of * the children to {@link #WRAP_CONTENT} when they are not specified in the diff --git a/core/java/android/widget/RatingBar.java b/core/java/android/widget/RatingBar.java index 9e6ff4b..e69577b 100644 --- a/core/java/android/widget/RatingBar.java +++ b/core/java/android/widget/RatingBar.java @@ -21,6 +21,8 @@ import android.content.res.TypedArray; import android.graphics.drawable.shapes.RectShape; import android.graphics.drawable.shapes.Shape; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; @@ -324,4 +326,15 @@ public class RatingBar extends AbsSeekBar { super.setMax(max); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(RatingBar.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(RatingBar.class.getName()); + } } diff --git a/core/java/android/widget/RelativeLayout.java b/core/java/android/widget/RelativeLayout.java index a452fec..e4b8f34 100644 --- a/core/java/android/widget/RelativeLayout.java +++ b/core/java/android/widget/RelativeLayout.java @@ -40,6 +40,7 @@ import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; import static android.util.Log.d; @@ -985,6 +986,18 @@ public class RelativeLayout extends ViewGroup { return false; } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(RelativeLayout.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(RelativeLayout.class.getName()); + } + /** * Compares two views in left-to-right and top-to-bottom fashion. */ diff --git a/core/java/android/widget/ScrollView.java b/core/java/android/widget/ScrollView.java index 767eaee..3ffc0fe 100644 --- a/core/java/android/widget/ScrollView.java +++ b/core/java/android/widget/ScrollView.java @@ -721,12 +721,14 @@ public class ScrollView extends FrameLayout { @Override public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ScrollView.class.getName()); info.setScrollable(getScrollRange() > 0); } @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(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 9d2ff2e..99cd0b8 100644 --- a/core/java/android/widget/SearchView.java +++ b/core/java/android/widget/SearchView.java @@ -35,7 +35,6 @@ import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Bundle; -import android.os.Handler; import android.speech.RecognizerIntent; import android.text.Editable; import android.text.InputType; @@ -51,6 +50,8 @@ import android.view.CollapsibleActionView; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView.OnItemClickListener; @@ -1206,6 +1207,18 @@ public class SearchView extends LinearLayout implements CollapsibleActionView { setIconified(false); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(SearchView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(SearchView.class.getName()); + } + private void adjustDropDownSizeAndPosition() { if (mDropDownAnchor.getWidth() > 1) { Resources res = getContext().getResources(); diff --git a/core/java/android/widget/SeekBar.java b/core/java/android/widget/SeekBar.java index c76728f..2737f94 100644 --- a/core/java/android/widget/SeekBar.java +++ b/core/java/android/widget/SeekBar.java @@ -18,6 +18,8 @@ package android.widget; import android.content.Context; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; @@ -117,5 +119,16 @@ public class SeekBar extends AbsSeekBar { mOnSeekBarChangeListener.onStopTrackingTouch(this); } } - + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(SeekBar.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(SeekBar.class.getName()); + } } diff --git a/core/java/android/widget/SlidingDrawer.java b/core/java/android/widget/SlidingDrawer.java index bdeb5c2..14edd10 100644 --- a/core/java/android/widget/SlidingDrawer.java +++ b/core/java/android/widget/SlidingDrawer.java @@ -32,6 +32,7 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * SlidingDrawer hides content out of the screen and allows the user to drag a handle @@ -810,6 +811,18 @@ public class SlidingDrawer extends ViewGroup { } } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(SlidingDrawer.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(SlidingDrawer.class.getName()); + } + private void closeDrawer() { moveHandle(COLLAPSED_FULL_CLOSED); mContent.setVisibility(View.GONE); diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java index ec3790e..ecf19b3 100644 --- a/core/java/android/widget/Spinner.java +++ b/core/java/android/widget/Spinner.java @@ -29,6 +29,8 @@ import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** @@ -456,12 +458,24 @@ public class Spinner extends AbsSpinner implements OnClickListener { return handled; } - + public void onClick(DialogInterface dialog, int which) { setSelection(which); dialog.dismiss(); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(Spinner.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(Spinner.class.getName()); + } + /** * Sets the prompt to display when the dialog is shown. * @param prompt the prompt to set diff --git a/core/java/android/widget/StackView.java b/core/java/android/widget/StackView.java index 03e6e99..22df3bc 100644 --- a/core/java/android/widget/StackView.java +++ b/core/java/android/widget/StackView.java @@ -40,6 +40,8 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.LinearInterpolator; import android.widget.RemoteViews.RemoteView; @@ -1216,6 +1218,18 @@ public class StackView extends AdapterViewAnimator { measureChildren(); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(StackView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(StackView.class.getName()); + } + class LayoutParams extends ViewGroup.LayoutParams { int horizontalOffset; int verticalOffset; diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java index 02c9d03..334b9c4 100644 --- a/core/java/android/widget/Switch.java +++ b/core/java/android/widget/Switch.java @@ -35,6 +35,7 @@ import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; @@ -651,4 +652,16 @@ public class Switch extends CompoundButton { mThumbDrawable.jumpToCurrentState(); mTrackDrawable.jumpToCurrentState(); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(Switch.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(Switch.class.getName()); + } } diff --git a/core/java/android/widget/TabHost.java b/core/java/android/widget/TabHost.java index 88d7230..9b292be 100644 --- a/core/java/android/widget/TabHost.java +++ b/core/java/android/widget/TabHost.java @@ -33,6 +33,8 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.view.Window; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import java.util.ArrayList; import java.util.List; @@ -321,6 +323,18 @@ mTabHost.addTab(TAB_TAG_1, "Hello, world!", "Tab 1"); } } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TabHost.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TabHost.class.getName()); + } + public void setCurrentTab(int index) { if (index < 0 || index >= mTabSpecs.size()) { return; diff --git a/core/java/android/widget/TabWidget.java b/core/java/android/widget/TabWidget.java index 80bfe99..8901037 100644 --- a/core/java/android/widget/TabWidget.java +++ b/core/java/android/widget/TabWidget.java @@ -29,6 +29,7 @@ import android.view.View; import android.view.View.OnFocusChangeListener; import android.view.ViewGroup; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * @@ -416,10 +417,28 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { @Override public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + event.setClassName(TabWidget.class.getName()); event.setItemCount(getTabCount()); event.setCurrentItemIndex(mSelectedTab); } + + @Override + public void sendAccessibilityEventUnchecked(AccessibilityEvent event) { + // this class fires events only when tabs are focused or selected + if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED && isFocused()) { + event.recycle(); + return; + } + super.sendAccessibilityEventUnchecked(event); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(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 @@ -485,16 +504,6 @@ public class TabWidget extends LinearLayout implements OnFocusChangeListener { mSelectedTab = -1; } - @Override - public void sendAccessibilityEventUnchecked(AccessibilityEvent event) { - // this class fires events only when tabs are focused or selected - if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED && isFocused()) { - event.recycle(); - return; - } - super.sendAccessibilityEventUnchecked(event); - } - /** * Provides a way for {@link TabHost} to be notified that the user clicked on a tab indicator. */ diff --git a/core/java/android/widget/TableLayout.java b/core/java/android/widget/TableLayout.java index 842b087..f5d3746 100644 --- a/core/java/android/widget/TableLayout.java +++ b/core/java/android/widget/TableLayout.java @@ -24,6 +24,8 @@ import android.util.AttributeSet; import android.util.SparseBooleanArray; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import java.util.regex.Pattern; @@ -658,6 +660,18 @@ public class TableLayout extends LinearLayout { return new LayoutParams(p); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TableLayout.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TableLayout.class.getName()); + } + /** * <p>This set of layout parameters enforces the width of each child to be * {@link #MATCH_PARENT} and the height of each child to be diff --git a/core/java/android/widget/TableRow.java b/core/java/android/widget/TableRow.java index 3fd4631..01c4c2c 100644 --- a/core/java/android/widget/TableRow.java +++ b/core/java/android/widget/TableRow.java @@ -24,6 +24,8 @@ import android.view.Gravity; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** @@ -377,6 +379,18 @@ public class TableRow extends LinearLayout { return new LayoutParams(p); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TableRow.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TableRow.class.getName()); + } + /** * <p>Set of layout parameters used in table rows.</p> * diff --git a/core/java/android/widget/TextSwitcher.java b/core/java/android/widget/TextSwitcher.java index a8794a3..1aefd2b 100644 --- a/core/java/android/widget/TextSwitcher.java +++ b/core/java/android/widget/TextSwitcher.java @@ -21,6 +21,8 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * Specialized {@link android.widget.ViewSwitcher} that contains @@ -88,4 +90,16 @@ public class TextSwitcher extends ViewSwitcher { public void setCurrentText(CharSequence text) { ((TextView)getCurrentView()).setText(text); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TextSwitcher.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TextSwitcher.class.getName()); + } } diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 3dd7a9f..4e1c6ab 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -9006,6 +9006,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener public void onInitializeAccessibilityEvent(AccessibilityEvent event) { super.onInitializeAccessibilityEvent(event); + event.setClassName(TextView.class.getName()); final boolean isPassword = hasPasswordTransformationMethod(); event.setPassword(isPassword); @@ -9020,11 +9021,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TextView.class.getName()); final boolean isPassword = hasPasswordTransformationMethod(); + info.setPassword(isPassword); + if (!isPassword) { info.setText(getTextForAccessibility()); } - info.setPassword(isPassword); } @Override diff --git a/core/java/android/widget/TimePicker.java b/core/java/android/widget/TimePicker.java index afca2db..8f10fff 100644 --- a/core/java/android/widget/TimePicker.java +++ b/core/java/android/widget/TimePicker.java @@ -27,6 +27,7 @@ import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; import android.widget.NumberPicker.OnValueChangeListener; @@ -476,6 +477,18 @@ public class TimePicker extends FrameLayout { event.getText().add(selectedDateUtterance); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TimePicker.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TimePicker.class.getName()); + } + private void updateHourControl() { if (is24HourView()) { mHourSpinner.setMinValue(0); diff --git a/core/java/android/widget/ToggleButton.java b/core/java/android/widget/ToggleButton.java index a754268..a0edafe 100644 --- a/core/java/android/widget/ToggleButton.java +++ b/core/java/android/widget/ToggleButton.java @@ -23,6 +23,7 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import com.android.internal.R; @@ -161,4 +162,16 @@ public class ToggleButton extends CompoundButton { event.getText().add(mContext.getString(R.string.togglebutton_not_pressed)); } } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ToggleButton.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ToggleButton.class.getName()); + } } diff --git a/core/java/android/widget/TwoLineListItem.java b/core/java/android/widget/TwoLineListItem.java index eab6f2d..e707ea3 100644 --- a/core/java/android/widget/TwoLineListItem.java +++ b/core/java/android/widget/TwoLineListItem.java @@ -16,14 +16,12 @@ package android.widget; -import com.android.internal.R; - - import android.annotation.Widget; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; -import android.view.View; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RelativeLayout; /** @@ -86,4 +84,16 @@ public class TwoLineListItem extends RelativeLayout { public TextView getText2() { return mText2; } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(TwoLineListItem.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(TwoLineListItem.class.getName()); + } } diff --git a/core/java/android/widget/VideoView.java b/core/java/android/widget/VideoView.java index 64fdf34..0fba498 100644 --- a/core/java/android/widget/VideoView.java +++ b/core/java/android/widget/VideoView.java @@ -34,6 +34,8 @@ import android.view.MotionEvent; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.View; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.MediaController.MediaPlayerControl; import java.io.IOException; @@ -124,6 +126,18 @@ public class VideoView extends SurfaceView implements MediaPlayerControl { setMeasuredDimension(width, height); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(VideoView.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(VideoView.class.getName()); + } + public int resolveAdjustedSize(int desiredSize, int measureSpec) { int result = desiredSize; int specMode = MeasureSpec.getMode(measureSpec); diff --git a/core/java/android/widget/ViewAnimator.java b/core/java/android/widget/ViewAnimator.java index 71ff66b..6a68240 100644 --- a/core/java/android/widget/ViewAnimator.java +++ b/core/java/android/widget/ViewAnimator.java @@ -22,6 +22,8 @@ import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.Animation; import android.view.animation.AnimationUtils; @@ -341,4 +343,16 @@ public class ViewAnimator extends FrameLayout { public int getBaseline() { return (getCurrentView() != null) ? getCurrentView().getBaseline() : super.getBaseline(); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ViewAnimator.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ViewAnimator.class.getName()); + } } diff --git a/core/java/android/widget/ViewFlipper.java b/core/java/android/widget/ViewFlipper.java index c6f6e81..061bb00 100644 --- a/core/java/android/widget/ViewFlipper.java +++ b/core/java/android/widget/ViewFlipper.java @@ -25,6 +25,8 @@ import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.RemoteViews.RemoteView; /** @@ -139,6 +141,18 @@ public class ViewFlipper extends ViewAnimator { updateRunning(); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ViewFlipper.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ViewFlipper.class.getName()); + } + /** * Internal method to start or stop dispatching flip {@link Message} based * on {@link #mRunning} and {@link #mVisible} state. diff --git a/core/java/android/widget/ViewSwitcher.java b/core/java/android/widget/ViewSwitcher.java index 71ae624..0376918 100644 --- a/core/java/android/widget/ViewSwitcher.java +++ b/core/java/android/widget/ViewSwitcher.java @@ -20,6 +20,8 @@ import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; /** * {@link ViewAnimator} that switches between two views, and has a factory @@ -66,6 +68,18 @@ public class ViewSwitcher extends ViewAnimator { super.addView(child, index, params); } + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ViewSwitcher.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ViewSwitcher.class.getName()); + } + /** * Returns the next view to be displayed. * diff --git a/core/java/android/widget/ZoomButton.java b/core/java/android/widget/ZoomButton.java index eb372ca..af17c94 100644 --- a/core/java/android/widget/ZoomButton.java +++ b/core/java/android/widget/ZoomButton.java @@ -23,6 +23,8 @@ import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; import android.view.View.OnLongClickListener; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; public class ZoomButton extends ImageButton implements OnLongClickListener { @@ -96,4 +98,16 @@ public class ZoomButton extends ImageButton implements OnLongClickListener { clearFocus(); return super.dispatchUnhandledMove(focused, direction); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ZoomButton.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ZoomButton.class.getName()); + } } diff --git a/core/java/android/widget/ZoomControls.java b/core/java/android/widget/ZoomControls.java index a12aee5..8897875 100644 --- a/core/java/android/widget/ZoomControls.java +++ b/core/java/android/widget/ZoomControls.java @@ -22,6 +22,8 @@ import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.AlphaAnimation; import com.android.internal.R; @@ -106,4 +108,16 @@ public class ZoomControls extends LinearLayout { public boolean hasFocus() { return mZoomIn.hasFocus() || mZoomOut.hasFocus(); } + + @Override + public void onInitializeAccessibilityEvent(AccessibilityEvent event) { + super.onInitializeAccessibilityEvent(event); + event.setClassName(ZoomControls.class.getName()); + } + + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + info.setClassName(ZoomControls.class.getName()); + } } |