Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f431517 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Mechanically apply TypedXml refaster template.

This is a purely mechanical CL that applies the output of the
recently added refaster templates to help guide towards more
efficient TypedXml methods.  There is no behavior change.

Bug: 171832118
Test: manual
Exempt-From-Owner-Approval: trivial refactoring
Change-Id: Ic95dd3de77c60482ad36b31706e6b701929f40b3
parent 236c03b5
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -1509,19 +1509,16 @@ public class ActivityManager {
                out.attribute(null, ATTR_TASKDESCRIPTIONLABEL, mLabel);
            }
            if (mColorPrimary != 0) {
                out.attribute(null, ATTR_TASKDESCRIPTIONCOLOR_PRIMARY,
                        Integer.toHexString(mColorPrimary));
                out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_PRIMARY, mColorPrimary);
            }
            if (mColorBackground != 0) {
                out.attribute(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND,
                        Integer.toHexString(mColorBackground));
                out.attributeIntHex(null, ATTR_TASKDESCRIPTIONCOLOR_BACKGROUND, mColorBackground);
            }
            if (mIconFilename != null) {
                out.attribute(null, ATTR_TASKDESCRIPTIONICON_FILENAME, mIconFilename);
            }
            if (mIcon != null && mIcon.getType() == Icon.TYPE_RESOURCE) {
                out.attribute(null, ATTR_TASKDESCRIPTIONICON_RESOURCE,
                        Integer.toString(mIcon.getResId()));
                out.attributeInt(null, ATTR_TASKDESCRIPTIONICON_RESOURCE, mIcon.getResId());
                out.attribute(null, ATTR_TASKDESCRIPTIONICON_RESOURCE_PACKAGE,
                        mIcon.getResPackage());
            }
+18 −22
Original line number Diff line number Diff line
@@ -983,62 +983,58 @@ public final class NotificationChannel implements Parcelable {
            out.attribute(null, ATT_DESC, getDescription());
        }
        if (getImportance() != DEFAULT_IMPORTANCE) {
            out.attribute(
                    null, ATT_IMPORTANCE, Integer.toString(getImportance()));
            out.attributeInt(null, ATT_IMPORTANCE, getImportance());
        }
        if (canBypassDnd()) {
            out.attribute(
                    null, ATT_PRIORITY, Integer.toString(Notification.PRIORITY_MAX));
            out.attributeInt(null, ATT_PRIORITY, Notification.PRIORITY_MAX);
        }
        if (getLockscreenVisibility() != DEFAULT_VISIBILITY) {
            out.attribute(null, ATT_VISIBILITY,
                    Integer.toString(getLockscreenVisibility()));
            out.attributeInt(null, ATT_VISIBILITY, getLockscreenVisibility());
        }
        Uri sound = forBackup ? getSoundForBackup(context) : getSound();
        if (sound != null) {
            out.attribute(null, ATT_SOUND, sound.toString());
        }
        if (getAudioAttributes() != null) {
            out.attribute(null, ATT_USAGE, Integer.toString(getAudioAttributes().getUsage()));
            out.attribute(null, ATT_CONTENT_TYPE,
                    Integer.toString(getAudioAttributes().getContentType()));
            out.attribute(null, ATT_FLAGS, Integer.toString(getAudioAttributes().getFlags()));
            out.attributeInt(null, ATT_USAGE, getAudioAttributes().getUsage());
            out.attributeInt(null, ATT_CONTENT_TYPE, getAudioAttributes().getContentType());
            out.attributeInt(null, ATT_FLAGS, getAudioAttributes().getFlags());
        }
        if (shouldShowLights()) {
            out.attribute(null, ATT_LIGHTS, Boolean.toString(shouldShowLights()));
            out.attributeBoolean(null, ATT_LIGHTS, shouldShowLights());
        }
        if (getLightColor() != DEFAULT_LIGHT_COLOR) {
            out.attribute(null, ATT_LIGHT_COLOR, Integer.toString(getLightColor()));
            out.attributeInt(null, ATT_LIGHT_COLOR, getLightColor());
        }
        if (shouldVibrate()) {
            out.attribute(null, ATT_VIBRATION_ENABLED, Boolean.toString(shouldVibrate()));
            out.attributeBoolean(null, ATT_VIBRATION_ENABLED, shouldVibrate());
        }
        if (getVibrationPattern() != null) {
            out.attribute(null, ATT_VIBRATION, longArrayToString(getVibrationPattern()));
        }
        if (getUserLockedFields() != 0) {
            out.attribute(null, ATT_USER_LOCKED, Integer.toString(getUserLockedFields()));
            out.attributeInt(null, ATT_USER_LOCKED, getUserLockedFields());
        }
        if (isFgServiceShown()) {
            out.attribute(null, ATT_FG_SERVICE_SHOWN, Boolean.toString(isFgServiceShown()));
            out.attributeBoolean(null, ATT_FG_SERVICE_SHOWN, isFgServiceShown());
        }
        if (canShowBadge()) {
            out.attribute(null, ATT_SHOW_BADGE, Boolean.toString(canShowBadge()));
            out.attributeBoolean(null, ATT_SHOW_BADGE, canShowBadge());
        }
        if (isDeleted()) {
            out.attribute(null, ATT_DELETED, Boolean.toString(isDeleted()));
            out.attributeBoolean(null, ATT_DELETED, isDeleted());
        }
        if (getGroup() != null) {
            out.attribute(null, ATT_GROUP, getGroup());
        }
        if (isBlockable()) {
            out.attribute(null, ATT_BLOCKABLE_SYSTEM, Boolean.toString(isBlockable()));
            out.attributeBoolean(null, ATT_BLOCKABLE_SYSTEM, isBlockable());
        }
        if (getAllowBubbles() != DEFAULT_ALLOW_BUBBLE) {
            out.attribute(null, ATT_ALLOW_BUBBLE, Integer.toString(getAllowBubbles()));
            out.attributeInt(null, ATT_ALLOW_BUBBLE, getAllowBubbles());
        }
        if (getOriginalImportance() != DEFAULT_IMPORTANCE) {
            out.attribute(null, ATT_ORIG_IMP, Integer.toString(getOriginalImportance()));
            out.attributeInt(null, ATT_ORIG_IMP, getOriginalImportance());
        }
        if (getParentChannelId() != null) {
            out.attribute(null, ATT_PARENT_CHANNEL, getParentChannelId());
@@ -1047,10 +1043,10 @@ public final class NotificationChannel implements Parcelable {
            out.attribute(null, ATT_CONVERSATION_ID, getConversationId());
        }
        if (isDemoted()) {
            out.attribute(null, ATT_DEMOTE, Boolean.toString(isDemoted()));
            out.attributeBoolean(null, ATT_DEMOTE, isDemoted());
        }
        if (isImportantConversation()) {
            out.attribute(null, ATT_IMP_CONVERSATION, Boolean.toString(isImportantConversation()));
            out.attributeBoolean(null, ATT_IMP_CONVERSATION, isImportantConversation());
        }

        // mImportanceLockedDefaultApp and mImportanceLockedByOEM have a different source of
+2 −2
Original line number Diff line number Diff line
@@ -253,8 +253,8 @@ public final class NotificationChannelGroup implements Parcelable {
        if (getDescription() != null) {
            out.attribute(null, ATT_DESC, getDescription().toString());
        }
        out.attribute(null, ATT_BLOCKED, Boolean.toString(isBlocked()));
        out.attribute(null, ATT_USER_LOCKED, Integer.toString(mUserLockedFields));
        out.attributeBoolean(null, ATT_BLOCKED, isBlocked());
        out.attributeInt(null, ATT_USER_LOCKED, mUserLockedFields);

        out.endTag(null, TAG_GROUP);
    }
+2 −3
Original line number Diff line number Diff line
@@ -475,14 +475,13 @@ public final class DeviceAdminInfo implements Parcelable {
    /** @hide */
    public void writePoliciesToXml(TypedXmlSerializer out)
            throws IllegalArgumentException, IllegalStateException, IOException {
        out.attribute(null, "flags", Integer.toString(mUsesPolicies));
        out.attributeInt(null, "flags", mUsesPolicies);
    }

    /** @hide */
    public void readPoliciesFromXml(TypedXmlPullParser parser)
            throws XmlPullParserException, IOException {
        mUsesPolicies = Integer.parseInt(
                parser.getAttributeValue(null, "flags"));
        mUsesPolicies = parser.getAttributeInt(null, "flags");
    }

    public void dump(Printer pw, String prefix) {
+4 −4
Original line number Diff line number Diff line
@@ -203,8 +203,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable {
    @Nullable
    public static FactoryResetProtectionPolicy readFromXml(@NonNull TypedXmlPullParser parser) {
        try {
            boolean factoryResetProtectionEnabled = Boolean.parseBoolean(
                    parser.getAttributeValue(null, KEY_FACTORY_RESET_PROTECTION_ENABLED));
            boolean factoryResetProtectionEnabled = parser.getAttributeBoolean(null,
                    KEY_FACTORY_RESET_PROTECTION_ENABLED, false);

            List<String> factoryResetProtectionAccounts = new ArrayList<>();
            int outerDepth = parser.getDepth();
@@ -233,8 +233,8 @@ public final class FactoryResetProtectionPolicy implements Parcelable {
     * @hide
     */
    public void writeToXml(@NonNull TypedXmlSerializer out) throws IOException {
        out.attribute(null, KEY_FACTORY_RESET_PROTECTION_ENABLED,
                Boolean.toString(mFactoryResetProtectionEnabled));
        out.attributeBoolean(null, KEY_FACTORY_RESET_PROTECTION_ENABLED,
                mFactoryResetProtectionEnabled);
        for (String account : mFactoryResetProtectionAccounts) {
            out.startTag(null, KEY_FACTORY_RESET_PROTECTION_ACCOUNT);
            out.attribute(null, ATTR_VALUE, account);
Loading