From 27b2fa177dbfcab826dc9cc743f7f18e050666b5 Mon Sep 17 00:00:00 2001 From: Deepika Likhite Date: Tue, 19 Nov 2019 21:41:35 +0000 Subject: Revert "Make getStateDescription() in View none final" This reverts commit c9cb2e8307b50ea1867e898123b66af46f64bbdd. Reason for revert: Bug: 144786884 Exempt-From-Owner-Approval:see go/perf-revert-first Change-Id: I0dd6047c2d3c8d757d8e1afe66d85a60075536b6 --- api/current.txt | 2 +- core/java/android/view/View.java | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/current.txt b/api/current.txt index d8355ede4456..2cf1f44ebb6c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -50659,7 +50659,7 @@ package android.view { method public final int getScrollY(); method @android.view.ViewDebug.ExportedProperty(category="drawing") @ColorInt public int getSolidColor(); method @LayoutRes public int getSourceLayoutResId(); - method @android.view.ViewDebug.ExportedProperty(category="accessibility") @Nullable public CharSequence getStateDescription(); + method @android.view.ViewDebug.ExportedProperty(category="accessibility") @Nullable public final CharSequence getStateDescription(); method public android.animation.StateListAnimator getStateListAnimator(); method protected int getSuggestedMinimumHeight(); method protected int getSuggestedMinimumWidth(); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index b90ce876aeb3..1599afb358e0 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8727,7 +8727,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, structure.setContextClickable(true); } structure.setClassName(getAccessibilityClassName().toString()); - structure.setContentDescription(mContentDescription); + structure.setContentDescription(getContentDescription()); } /** @@ -9934,8 +9934,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, info.setImportantForAccessibility(isImportantForAccessibility()); info.setPackageName(mContext.getPackageName()); info.setClassName(getAccessibilityClassName()); - info.setStateDescription(mStateDescription); - info.setContentDescription(mContentDescription); + info.setStateDescription(getStateDescription()); + info.setContentDescription(getContentDescription()); info.setEnabled(isEnabled()); info.setClickable(isClickable()); @@ -10318,7 +10318,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @see #setStateDescription(CharSequence) */ @ViewDebug.ExportedProperty(category = "accessibility") - public @Nullable CharSequence getStateDescription() { + public final @Nullable CharSequence getStateDescription() { return mStateDescription; } @@ -13724,7 +13724,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, */ @UnsupportedAppUsage public CharSequence getIterableTextForAccessibility() { - return mContentDescription; + return getContentDescription(); } /** @@ -29514,10 +29514,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, stream.addProperty("text:textAlignment", getTextAlignment()); // accessibility + CharSequence contentDescription = getContentDescription(); stream.addProperty("accessibility:contentDescription", - mContentDescription == null ? "" : mContentDescription.toString()); - stream.addProperty("accessibility:stateDescription", - mStateDescription == null ? "" : mStateDescription.toString()); + contentDescription == null ? "" : contentDescription.toString()); stream.addProperty("accessibility:labelFor", getLabelFor()); stream.addProperty("accessibility:importantForAccessibility", getImportantForAccessibility()); } -- cgit v1.2.3-59-g8ed1b