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

Commit 200476e6 authored by Guojing Yuan's avatar Guojing Yuan
Browse files

[CDM] Remove userId from SystemDataTransferRequest xml

Fix: 318709840

Test: CTS
Change-Id: I7292d767e22799d8ded863dd449d3e63100d26a8
parent 3bef74d0
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -67,7 +67,6 @@ import java.util.concurrent.TimeoutException;
 *   <request
 *     association_id="1"
 *     data_type="1"
 *     user_id="12"
 *     is_user_consented="true"
 *   </request>
 * </requests>
@@ -84,7 +83,6 @@ public class SystemDataTransferRequestStore {

    private static final String XML_ATTR_ASSOCIATION_ID = "association_id";
    private static final String XML_ATTR_DATA_TYPE = "data_type";
    private static final String XML_ATTR_USER_ID = "user_id";
    private static final String XML_ATTR_IS_USER_CONSENTED = "is_user_consented";

    private static final int READ_FROM_DISK_TIMEOUT = 5; // in seconds
@@ -197,7 +195,7 @@ public class SystemDataTransferRequestStore {
                final TypedXmlPullParser parser = Xml.resolvePullParser(in);
                XmlUtils.beginDocument(parser, XML_TAG_REQUESTS);

                return readRequestsFromXml(parser);
                return readRequestsFromXml(userId, parser);
            } catch (XmlPullParserException | IOException e) {
                Slog.e(LOG_TAG, "Error while reading requests file", e);
                return new ArrayList<>();
@@ -206,7 +204,7 @@ public class SystemDataTransferRequestStore {
    }

    @NonNull
    private ArrayList<SystemDataTransferRequest> readRequestsFromXml(
    private ArrayList<SystemDataTransferRequest> readRequestsFromXml(int userId,
            @NonNull TypedXmlPullParser parser) throws XmlPullParserException, IOException {
        if (!isStartOfTag(parser, XML_TAG_REQUESTS)) {
            throw new XmlPullParserException("The XML doesn't have start tag: " + XML_TAG_REQUESTS);
@@ -220,14 +218,15 @@ public class SystemDataTransferRequestStore {
                break;
            }
            if (isStartOfTag(parser, XML_TAG_REQUEST)) {
                requests.add(readRequestFromXml(parser));
                requests.add(readRequestFromXml(userId, parser));
            }
        }

        return requests;
    }

    private SystemDataTransferRequest readRequestFromXml(@NonNull TypedXmlPullParser parser)
    private SystemDataTransferRequest readRequestFromXml(int userId,
            @NonNull TypedXmlPullParser parser)
            throws XmlPullParserException, IOException {
        if (!isStartOfTag(parser, XML_TAG_REQUEST)) {
            throw new XmlPullParserException("XML doesn't have start tag: " + XML_TAG_REQUEST);
@@ -235,7 +234,6 @@ public class SystemDataTransferRequestStore {

        final int associationId = readIntAttribute(parser, XML_ATTR_ASSOCIATION_ID);
        final int dataType = readIntAttribute(parser, XML_ATTR_DATA_TYPE);
        final int userId = readIntAttribute(parser, XML_ATTR_USER_ID);
        final boolean isUserConsented = readBooleanAttribute(parser, XML_ATTR_IS_USER_CONSENTED);

        switch (dataType) {
@@ -292,7 +290,6 @@ public class SystemDataTransferRequestStore {

        writeIntAttribute(serializer, XML_ATTR_ASSOCIATION_ID, request.getAssociationId());
        writeIntAttribute(serializer, XML_ATTR_DATA_TYPE, request.getDataType());
        writeIntAttribute(serializer, XML_ATTR_USER_ID, request.getUserId());
        writeBooleanAttribute(serializer, XML_ATTR_IS_USER_CONSENTED, request.isUserConsented());

        serializer.endTag(null, XML_TAG_REQUEST);