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

Commit b67b2380 authored by Piyush Mehrotra's avatar Piyush Mehrotra Committed by Android (Google) Code Review
Browse files

Merge "Fix parser's BMM event pattern" into main

parents 4a323a6f e338cc8a
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ public class BmgrOutputParser {
    private static final Pattern BACKUP_START_PATTERN =
            Pattern.compile("Running (.*?) backup for (.*?) packages.");
    private static final Pattern EVENT_PATTERN =
            Pattern.compile("=> Event\\{(.*?)/(.*?) : package = (.*?)\\(v(.*?)\\)\\}");
            Pattern.compile("=> Event\\{(.*?)/(.*?) : package = (.*?)\\(v(.*?)\\).*\\}");
    private static final Pattern PACKAGE_RESULT_PATTERN =
            Pattern.compile("Package (.*?) with result: (.*)");
    private static final Pattern BACKUP_FINISHED_PATTERN =
@@ -150,15 +150,14 @@ public class BmgrOutputParser {
        // -----------------------------------------------------------------------------------------
        // Errors due to the size of backup

        // This isn’t treated as an error by BackupTransport. Here it is reported as an error to let
        // the user decide whether this is intented or not.
        // This isn’t treated as an error by BackupTransport. Here it is reported as an 'error' to
        // let the user decide whether this is intented or not.
        sErrorEventInfoMap.put("NO_DATA_TO_SEND", "App did not provide any backup data.");
        sErrorEventInfoMap.put(
                "ERROR_PREFLIGHT",
                "Backup Preflight check failed. Either the estimated backup size is over quota or"
                        + " there is nothing to backup. Please ensure that backup size is within "
                        + "allowed quota (25MB for Cloud backups, 2GB for device-to-device "
                        + "backups).");
                "Backup Preflight check failed. Either the estimated backup size is over quota. "
                        + "Please ensure that backup size is within allowed quota (25MB for Cloud "
                        + "backups, 2GB for device-to-device backups).");
        sErrorEventInfoMap.put(
                "QUOTA_HIT_PREFLIGHT",
                "App hit quota limit for backup. Estimated backup size > quota (25MB for Cloud "
+2 −2
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ public class BmgrOutputParserTest {
        String output =
                "Running non-incremental backup for 2 requested packages.\n"
                        + "Package @pm@ with result: Success\n"
                        + "=> Event{BACKUP_MANAGER_POLICY / ERROR_PREFLIGHT : package = com.example.backuprestore(v1)}\n"
                        + "=> Event{BACKUP_MANAGER_POLICY / ERROR_PREFLIGHT : package = com.example.backuprestore(v1), other keys = android.app.backup.extra.LOG_PREFLIGHT_ERROR}\n"
                        + "Package com.example.backuprestore with result: Transport rejected package because it wasn't able to process it at the time\n"
                        + "Backup finished with result: Success";

@@ -71,7 +71,7 @@ public class BmgrOutputParserTest {
                        + "=> Event{TRANSPORT / UNKNOWN_ID : package = @pm@(v0)}\n"
                        + "Package @pm@ with result: Success\n"
                        + "=> Event{AGENT / AGENT_LOGGING_RESULTS : package = com.example.backuprestore(v1), results = []}\n"
                        + "=> Event{BACKUP_MANAGER_POLICY / NO_DATA_TO_SEND : package = com.example.backuprestore(v1)}\n"
                        + "=> Event{BACKUP_MANAGER_POLICY / NO_DATA_TO_SEND : package = com.example.backuprestore(v1), other keys = some.random.key}\n"
                        + "Package com.example.backuprestore with result: Success\n"
                        + "Backup finished with result: Success";