Make a11y node info parceling more robust
am: d0e54c1c09
Change-Id: Ie4c34b84540bc928859ef1c271b4eb9d520fa6bc
This commit is contained in:
@@ -2670,16 +2670,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);
|
||||
@@ -2690,6 +2693,7 @@ public class AccessibilityNodeInfo implements Parcelable {
|
||||
}
|
||||
} else {
|
||||
parcel.writeInt(0);
|
||||
parcel.writeInt(0);
|
||||
}
|
||||
|
||||
parcel.writeInt(mMaxTextLength);
|
||||
@@ -2853,16 +2857,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