diff options
Diffstat (limited to 'android/view/ViewGroup.java')
-rw-r--r-- | android/view/ViewGroup.java | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/android/view/ViewGroup.java b/android/view/ViewGroup.java index 122df934..4631261e 100644 --- a/android/view/ViewGroup.java +++ b/android/view/ViewGroup.java @@ -57,6 +57,7 @@ import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.view.animation.LayoutAnimationController; import android.view.animation.Transformation; +import android.view.autofill.Helper; import com.android.internal.R; @@ -3215,22 +3216,31 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } int descendantFocusability = getDescendantFocusability(); + boolean result; switch (descendantFocusability) { case FOCUS_BLOCK_DESCENDANTS: - return super.requestFocus(direction, previouslyFocusedRect); + result = super.requestFocus(direction, previouslyFocusedRect); + break; case FOCUS_BEFORE_DESCENDANTS: { final boolean took = super.requestFocus(direction, previouslyFocusedRect); - return took ? took : onRequestFocusInDescendants(direction, previouslyFocusedRect); + result = took ? took : onRequestFocusInDescendants(direction, + previouslyFocusedRect); + break; } case FOCUS_AFTER_DESCENDANTS: { final boolean took = onRequestFocusInDescendants(direction, previouslyFocusedRect); - return took ? took : super.requestFocus(direction, previouslyFocusedRect); + result = took ? took : super.requestFocus(direction, previouslyFocusedRect); + break; } default: throw new IllegalStateException("descendant focusability must be " + "one of FOCUS_BEFORE_DESCENDANTS, FOCUS_AFTER_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS " + "but is " + descendantFocusability); } + if (result && !isLayoutValid() && ((mPrivateFlags & PFLAG_WANTS_FOCUS) == 0)) { + mPrivateFlags |= PFLAG_WANTS_FOCUS; + } + return result; } /** @@ -3465,8 +3475,10 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } if (!isLaidOut()) { - Log.v(VIEW_LOG_TAG, "dispatchProvideStructure(): not laid out, ignoring " - + childrenCount + " children of " + getAccessibilityViewId()); + if (Helper.sVerbose) { + Log.v(VIEW_LOG_TAG, "dispatchProvideStructure(): not laid out, ignoring " + + childrenCount + " children of " + getAccessibilityViewId()); + } return; } @@ -3637,44 +3649,34 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager return ViewGroup.class.getName(); } - @Override - public void notifySubtreeAccessibilityStateChanged(View child, View source, int changeType) { - // If this is a live region, we should send a subtree change event - // from this view. Otherwise, we can let it propagate up. - if (getAccessibilityLiveRegion() != ACCESSIBILITY_LIVE_REGION_NONE) { - notifyViewAccessibilityStateChangedIfNeeded( - AccessibilityEvent.CONTENT_CHANGE_TYPE_SUBTREE); - } else if (mParent != null) { - try { - mParent.notifySubtreeAccessibilityStateChanged(this, source, changeType); - } catch (AbstractMethodError e) { - Log.e(VIEW_LOG_TAG, mParent.getClass().getSimpleName() + - " does not fully implement ViewParent", e); - } - } - } - /** @hide */ @Override - public void notifySubtreeAccessibilityStateChangedIfNeeded() { + public void notifyAccessibilitySubtreeChanged() { if (!AccessibilityManager.getInstance(mContext).isEnabled() || mAttachInfo == null) { return; } // If something important for a11y is happening in this subtree, make sure it's dispatched // from a view that is important for a11y so it doesn't get lost. - if ((getImportantForAccessibility() != IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS) - && !isImportantForAccessibility() && (getChildCount() > 0)) { + if (getImportantForAccessibility() != IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS + && !isImportantForAccessibility() + && getChildCount() > 0) { ViewParent a11yParent = getParentForAccessibility(); if (a11yParent instanceof View) { - ((View) a11yParent).notifySubtreeAccessibilityStateChangedIfNeeded(); + ((View) a11yParent).notifyAccessibilitySubtreeChanged(); return; } } - super.notifySubtreeAccessibilityStateChangedIfNeeded(); + super.notifyAccessibilitySubtreeChanged(); + } + + @Override + public void notifySubtreeAccessibilityStateChanged(View child, View source, int changeType) { + notifyAccessibilityStateChanged(source, changeType); } + /** @hide */ @Override - void resetSubtreeAccessibilityStateChanged() { + public void resetSubtreeAccessibilityStateChanged() { super.resetSubtreeAccessibilityStateChanged(); View[] children = mChildren; final int childCount = mChildrenCount; @@ -3854,7 +3856,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager * @hide */ @Override - public Bitmap createSnapshot(Bitmap.Config quality, int backgroundColor, boolean skipChildren) { + public Bitmap createSnapshot(ViewDebug.CanvasProvider canvasProvider, boolean skipChildren) { int count = mChildrenCount; int[] visibilities = null; @@ -3870,17 +3872,17 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } } - Bitmap b = super.createSnapshot(quality, backgroundColor, skipChildren); - - if (skipChildren) { - for (int i = 0; i < count; i++) { - View child = getChildAt(i); - child.mViewFlags = (child.mViewFlags & ~View.VISIBILITY_MASK) - | (visibilities[i] & View.VISIBILITY_MASK); + try { + return super.createSnapshot(canvasProvider, skipChildren); + } finally { + if (skipChildren) { + for (int i = 0; i < count; i++) { + View child = getChildAt(i); + child.mViewFlags = (child.mViewFlags & ~View.VISIBILITY_MASK) + | (visibilities[i] & View.VISIBILITY_MASK); + } } } - - return b; } /** Return true if this ViewGroup is laying out using optical bounds. */ @@ -5086,7 +5088,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager } if (child.getVisibility() != View.GONE) { - notifySubtreeAccessibilityStateChangedIfNeeded(); + notifyAccessibilitySubtreeChanged(); } if (mTransientIndices != null) { @@ -5356,7 +5358,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager dispatchViewRemoved(view); if (view.getVisibility() != View.GONE) { - notifySubtreeAccessibilityStateChangedIfNeeded(); + notifyAccessibilitySubtreeChanged(); } int transientCount = mTransientIndices == null ? 0 : mTransientIndices.size(); @@ -6075,7 +6077,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager if (invalidate) { invalidateViewProperty(false, false); } - notifySubtreeAccessibilityStateChangedIfNeeded(); + notifyAccessibilitySubtreeChanged(); } @Override |