Make a11y node info parceling more robust am: d0e54c1c09 am: d87b12a4df am: a0f874d5c1
am: c30868369c
Change-Id: If1cfc920db5aea27397a8f79125db944d5c4580b
This commit is contained in:
@@ -2760,16 +2760,19 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
|
||||
if (mActions != null && !mActions.isEmpty()) {
|
||||
final int actionCount = mActions.size();
|
||||
parcel.writeInt(actionCount);
|
||||
|
||||
int nonLegacyActionCount = 0;
|
||||
int defaultLegacyStandardActions = 0;
|
||||
for (int i = 0; i < actionCount; i++) {
|
||||
AccessibilityAction action = mActions.get(i);
|
||||
if (isDefaultLegacyStandardAction(action)) {
|
||||
defaultLegacyStandardActions |= action.getId();
|
||||
} else {
|
||||
nonLegacyActionCount++;
|
||||
}
|
||||
}
|
||||
parcel.writeInt(defaultLegacyStandardActions);
|
||||
parcel.writeInt(nonLegacyActionCount);
|
||||
|
||||
for (int i = 0; i < actionCount; i++) {
|
||||
AccessibilityAction action = mActions.get(i);
|
||||
@@ -2780,6 +2783,7 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
}
|
||||
} else {
|
||||
parcel.writeInt(0);
|
||||
parcel.writeInt(0);
|
||||
}
|
||||
|
||||
parcel.writeInt(mMaxTextLength);
|
||||
@@ -2947,16 +2951,13 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
mBoundsInScreen.left = parcel.readInt();
|
||||
mBoundsInScreen.right = parcel.readInt();
|
||||
|
||||
final int actionCount = parcel.readInt();
|
||||
if (actionCount > 0) {
|
||||
final int legacyStandardActions = parcel.readInt();
|
||||
addLegacyStandardActions(legacyStandardActions);
|
||||
final int nonLegacyActionCount = actionCount - Integer.bitCount(legacyStandardActions);
|
||||
for (int i = 0; i < nonLegacyActionCount; i++) {
|
||||
final AccessibilityAction action = new AccessibilityAction(
|
||||
parcel.readInt(), parcel.readCharSequence());
|
||||
addActionUnchecked(action);
|
||||
}
|
||||
final int legacyStandardActions = parcel.readInt();
|
||||
addLegacyStandardActions(legacyStandardActions);
|
||||
final int nonLegacyActionCount = parcel.readInt();
|
||||
for (int i = 0; i < nonLegacyActionCount; i++) {
|
||||
final AccessibilityAction action = new AccessibilityAction(
|
||||
parcel.readInt(), parcel.readCharSequence());
|
||||
addActionUnchecked(action);
|
||||
}
|
||||
|
||||
mMaxTextLength = parcel.readInt();
|
||||
|
||||
Reference in New Issue
Block a user