Loading core/java/android/app/backup/FullBackup.java +87 −86 Original line number Diff line number Diff line Loading @@ -724,9 +724,20 @@ public class FullBackup { int event; while ((event = parser.next()) != XmlPullParser.END_DOCUMENT && !parser.getName().equals(endingTag)) { switch (event) { case XmlPullParser.START_TAG: if (event != XmlPullParser.START_TAG) { continue; } validateInnerTagContents(parser); parseIncludeExcludeTag(parser, excludes, includes, maybeRequiredFlags); } } private void parseIncludeExcludeTag( XmlPullParser parser, Set<PathWithRequiredFlags> excludes, Map<String, Set<PathWithRequiredFlags>> includes, Optional<Integer> maybeRequiredFlags) throws XmlPullParserException, IOException { final String domainFromXml = parser.getAttributeValue(null, "domain"); final File domainDirectory = getDirectoryForCriteriaDomain(domainFromXml); if (domainDirectory == null) { Loading @@ -740,13 +751,12 @@ public class FullBackup { + domainFromXml + "\" invalid; skipping"); } break; return; } final File canonicalFile = extractCanonicalFile( domainDirectory, parser.getAttributeValue(null, "path")); extractCanonicalFile(domainDirectory, parser.getAttributeValue(null, "path")); if (canonicalFile == null) { break; return; } int requiredFlags = getRequiredFlagsForRule(parser, maybeRequiredFlags); Loading @@ -755,8 +765,7 @@ public class FullBackup { Set<PathWithRequiredFlags> activeSet = parseCurrentTagForDomain(parser, excludes, includes, domainFromXml); activeSet.add( new PathWithRequiredFlags( canonicalFile.getCanonicalPath(), requiredFlags)); new PathWithRequiredFlags(canonicalFile.getCanonicalPath(), requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -774,10 +783,8 @@ public class FullBackup { // exist). We have no way of knowing a priori whether or not to expect a // dir, so we add the -journal anyway to be safe. if ("database".equals(domainFromXml) && !canonicalFile.isDirectory()) { final String canonicalJournalPath = canonicalFile.getCanonicalPath() + "-journal"; activeSet.add( new PathWithRequiredFlags(canonicalJournalPath, requiredFlags)); final String canonicalJournalPath = canonicalFile.getCanonicalPath() + "-journal"; activeSet.add(new PathWithRequiredFlags(canonicalJournalPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -785,10 +792,8 @@ public class FullBackup { + canonicalJournalPath + ". Ignore if nonexistent."); } final String canonicalWalPath = canonicalFile.getCanonicalPath() + "-wal"; activeSet.add( new PathWithRequiredFlags(canonicalWalPath, requiredFlags)); final String canonicalWalPath = canonicalFile.getCanonicalPath() + "-wal"; activeSet.add(new PathWithRequiredFlags(canonicalWalPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -802,10 +807,8 @@ public class FullBackup { if ("sharedpref".equals(domainFromXml) && !canonicalFile.isDirectory() && !canonicalFile.getCanonicalPath().endsWith(".xml")) { final String canonicalXmlPath = canonicalFile.getCanonicalPath() + ".xml"; activeSet.add( new PathWithRequiredFlags(canonicalXmlPath, requiredFlags)); final String canonicalXmlPath = canonicalFile.getCanonicalPath() + ".xml"; activeSet.add(new PathWithRequiredFlags(canonicalXmlPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -815,8 +818,6 @@ public class FullBackup { } } } } } private void logParsingResults( Set<PathWithRequiredFlags> excludes, Loading Loading
core/java/android/app/backup/FullBackup.java +87 −86 Original line number Diff line number Diff line Loading @@ -724,9 +724,20 @@ public class FullBackup { int event; while ((event = parser.next()) != XmlPullParser.END_DOCUMENT && !parser.getName().equals(endingTag)) { switch (event) { case XmlPullParser.START_TAG: if (event != XmlPullParser.START_TAG) { continue; } validateInnerTagContents(parser); parseIncludeExcludeTag(parser, excludes, includes, maybeRequiredFlags); } } private void parseIncludeExcludeTag( XmlPullParser parser, Set<PathWithRequiredFlags> excludes, Map<String, Set<PathWithRequiredFlags>> includes, Optional<Integer> maybeRequiredFlags) throws XmlPullParserException, IOException { final String domainFromXml = parser.getAttributeValue(null, "domain"); final File domainDirectory = getDirectoryForCriteriaDomain(domainFromXml); if (domainDirectory == null) { Loading @@ -740,13 +751,12 @@ public class FullBackup { + domainFromXml + "\" invalid; skipping"); } break; return; } final File canonicalFile = extractCanonicalFile( domainDirectory, parser.getAttributeValue(null, "path")); extractCanonicalFile(domainDirectory, parser.getAttributeValue(null, "path")); if (canonicalFile == null) { break; return; } int requiredFlags = getRequiredFlagsForRule(parser, maybeRequiredFlags); Loading @@ -755,8 +765,7 @@ public class FullBackup { Set<PathWithRequiredFlags> activeSet = parseCurrentTagForDomain(parser, excludes, includes, domainFromXml); activeSet.add( new PathWithRequiredFlags( canonicalFile.getCanonicalPath(), requiredFlags)); new PathWithRequiredFlags(canonicalFile.getCanonicalPath(), requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -774,10 +783,8 @@ public class FullBackup { // exist). We have no way of knowing a priori whether or not to expect a // dir, so we add the -journal anyway to be safe. if ("database".equals(domainFromXml) && !canonicalFile.isDirectory()) { final String canonicalJournalPath = canonicalFile.getCanonicalPath() + "-journal"; activeSet.add( new PathWithRequiredFlags(canonicalJournalPath, requiredFlags)); final String canonicalJournalPath = canonicalFile.getCanonicalPath() + "-journal"; activeSet.add(new PathWithRequiredFlags(canonicalJournalPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -785,10 +792,8 @@ public class FullBackup { + canonicalJournalPath + ". Ignore if nonexistent."); } final String canonicalWalPath = canonicalFile.getCanonicalPath() + "-wal"; activeSet.add( new PathWithRequiredFlags(canonicalWalPath, requiredFlags)); final String canonicalWalPath = canonicalFile.getCanonicalPath() + "-wal"; activeSet.add(new PathWithRequiredFlags(canonicalWalPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -802,10 +807,8 @@ public class FullBackup { if ("sharedpref".equals(domainFromXml) && !canonicalFile.isDirectory() && !canonicalFile.getCanonicalPath().endsWith(".xml")) { final String canonicalXmlPath = canonicalFile.getCanonicalPath() + ".xml"; activeSet.add( new PathWithRequiredFlags(canonicalXmlPath, requiredFlags)); final String canonicalXmlPath = canonicalFile.getCanonicalPath() + ".xml"; activeSet.add(new PathWithRequiredFlags(canonicalXmlPath, requiredFlags)); if (Log.isLoggable(TAG_XML_PARSER, Log.VERBOSE)) { Log.v( TAG_XML_PARSER, Loading @@ -815,8 +818,6 @@ public class FullBackup { } } } } } private void logParsingResults( Set<PathWithRequiredFlags> excludes, Loading