From b8bddfedbf89f37d3e3fce805186d8e078d09905 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 15 Aug 2021 20:32:34 +0200 Subject: [PATCH] Added log types --- app/schemas/eu.faircode.email.DB/208.json | 2514 +++++++++++++++++ app/src/main/java/eu/faircode/email/Core.java | 8 +- app/src/main/java/eu/faircode/email/DB.java | 8 +- .../main/java/eu/faircode/email/DaoLog.java | 6 +- .../java/eu/faircode/email/EntityLog.java | 13 + .../java/eu/faircode/email/FragmentLogs.java | 2 +- app/src/main/java/eu/faircode/email/Log.java | 2 +- .../eu/faircode/email/ServiceSynchronize.java | 258 +- 8 files changed, 2695 insertions(+), 116 deletions(-) create mode 100644 app/schemas/eu.faircode.email.DB/208.json diff --git a/app/schemas/eu.faircode.email.DB/208.json b/app/schemas/eu.faircode.email.DB/208.json new file mode 100644 index 0000000000..7b3c5debd3 --- /dev/null +++ b/app/schemas/eu.faircode.email.DB/208.json @@ -0,0 +1,2514 @@ +{ + "formatVersion": 1, + "database": { + "version": 208, + "identityHash": "c3ba3803793a1769d5c21d85d20a539b", + "entities": [ + { + "tableName": "identity", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `email` TEXT NOT NULL, `account` INTEGER NOT NULL, `display` TEXT, `color` INTEGER, `signature` TEXT, `host` TEXT NOT NULL, `starttls` INTEGER NOT NULL, `insecure` INTEGER NOT NULL, `port` INTEGER NOT NULL, `auth_type` INTEGER NOT NULL, `provider` TEXT, `user` TEXT NOT NULL, `password` TEXT NOT NULL, `certificate` INTEGER NOT NULL, `certificate_alias` TEXT, `realm` TEXT, `fingerprint` TEXT, `use_ip` INTEGER NOT NULL, `ehlo` TEXT, `synchronize` INTEGER NOT NULL, `primary` INTEGER NOT NULL, `self` INTEGER NOT NULL, `sender_extra` INTEGER NOT NULL, `sender_extra_name` INTEGER NOT NULL, `sender_extra_regex` TEXT, `replyto` TEXT, `cc` TEXT, `bcc` TEXT, `internal` TEXT, `unicode` INTEGER NOT NULL, `plain_only` INTEGER NOT NULL, `sign_default` INTEGER NOT NULL, `encrypt_default` INTEGER NOT NULL, `encrypt` INTEGER NOT NULL, `delivery_receipt` INTEGER NOT NULL, `read_receipt` INTEGER NOT NULL, `store_sent` INTEGER NOT NULL, `sent_folder` INTEGER, `sign_key` INTEGER, `sign_key_alias` TEXT, `tbd` INTEGER, `state` TEXT, `error` TEXT, `last_connected` INTEGER, `max_size` INTEGER, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "email", + "columnName": "email", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "display", + "columnName": "display", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "color", + "columnName": "color", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "signature", + "columnName": "signature", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "host", + "columnName": "host", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "encryption", + "columnName": "starttls", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "insecure", + "columnName": "insecure", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "port", + "columnName": "port", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auth_type", + "columnName": "auth_type", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "provider", + "columnName": "provider", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "user", + "columnName": "user", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "password", + "columnName": "password", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "certificate", + "columnName": "certificate", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "certificate_alias", + "columnName": "certificate_alias", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "realm", + "columnName": "realm", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fingerprint", + "columnName": "fingerprint", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "use_ip", + "columnName": "use_ip", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ehlo", + "columnName": "ehlo", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "synchronize", + "columnName": "synchronize", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "primary", + "columnName": "primary", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "self", + "columnName": "self", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sender_extra", + "columnName": "sender_extra", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sender_extra_name", + "columnName": "sender_extra_name", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sender_extra_regex", + "columnName": "sender_extra_regex", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "replyto", + "columnName": "replyto", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "cc", + "columnName": "cc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "bcc", + "columnName": "bcc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "internal", + "columnName": "internal", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "unicode", + "columnName": "unicode", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "plain_only", + "columnName": "plain_only", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sign_default", + "columnName": "sign_default", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "encrypt_default", + "columnName": "encrypt_default", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "encrypt", + "columnName": "encrypt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "delivery_receipt", + "columnName": "delivery_receipt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "read_receipt", + "columnName": "read_receipt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "store_sent", + "columnName": "store_sent", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sent_folder", + "columnName": "sent_folder", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sign_key", + "columnName": "sign_key", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sign_key_alias", + "columnName": "sign_key_alias", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "tbd", + "columnName": "tbd", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "last_connected", + "columnName": "last_connected", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "max_size", + "columnName": "max_size", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_identity_account", + "unique": false, + "columnNames": [ + "account" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_identity_account` ON `${TABLE_NAME}` (`account`)" + }, + { + "name": "index_identity_account_email", + "unique": false, + "columnNames": [ + "account", + "email" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_identity_account_email` ON `${TABLE_NAME}` (`account`, `email`)" + } + ], + "foreignKeys": [ + { + "table": "account", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "account" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "account", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`order` INTEGER, `id` INTEGER PRIMARY KEY AUTOINCREMENT, `uuid` TEXT NOT NULL, `pop` INTEGER NOT NULL, `host` TEXT NOT NULL, `starttls` INTEGER NOT NULL, `insecure` INTEGER NOT NULL, `port` INTEGER NOT NULL, `auth_type` INTEGER NOT NULL, `provider` TEXT, `user` TEXT NOT NULL, `password` TEXT NOT NULL, `certificate` INTEGER NOT NULL, `certificate_alias` TEXT, `realm` TEXT, `fingerprint` TEXT, `name` TEXT, `signature` TEXT, `color` INTEGER, `synchronize` INTEGER NOT NULL, `ondemand` INTEGER NOT NULL, `poll_exempted` INTEGER NOT NULL, `primary` INTEGER NOT NULL, `notify` INTEGER NOT NULL, `browse` INTEGER NOT NULL, `leave_on_server` INTEGER NOT NULL, `leave_deleted` INTEGER NOT NULL, `leave_on_device` INTEGER NOT NULL, `max_messages` INTEGER, `auto_seen` INTEGER NOT NULL, `separator` INTEGER, `swipe_left` INTEGER, `swipe_right` INTEGER, `move_to` INTEGER, `poll_interval` INTEGER NOT NULL, `keep_alive_ok` INTEGER NOT NULL, `keep_alive_failed` INTEGER NOT NULL, `keep_alive_succeeded` INTEGER NOT NULL, `partial_fetch` INTEGER NOT NULL, `ignore_size` INTEGER NOT NULL, `use_date` INTEGER NOT NULL, `use_received` INTEGER NOT NULL, `prefix` TEXT, `quota_usage` INTEGER, `quota_limit` INTEGER, `created` INTEGER, `tbd` INTEGER, `thread` INTEGER, `state` TEXT, `warning` TEXT, `error` TEXT, `last_connected` INTEGER, `backoff_until` INTEGER, `max_size` INTEGER, `capabilities` TEXT, `capability_idle` INTEGER, `capability_utf8` INTEGER)", + "fields": [ + { + "fieldPath": "order", + "columnName": "order", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uuid", + "columnName": "uuid", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "protocol", + "columnName": "pop", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "host", + "columnName": "host", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "encryption", + "columnName": "starttls", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "insecure", + "columnName": "insecure", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "port", + "columnName": "port", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auth_type", + "columnName": "auth_type", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "provider", + "columnName": "provider", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "user", + "columnName": "user", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "password", + "columnName": "password", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "certificate", + "columnName": "certificate", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "certificate_alias", + "columnName": "certificate_alias", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "realm", + "columnName": "realm", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fingerprint", + "columnName": "fingerprint", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "signature", + "columnName": "signature", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "color", + "columnName": "color", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "synchronize", + "columnName": "synchronize", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ondemand", + "columnName": "ondemand", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "poll_exempted", + "columnName": "poll_exempted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "primary", + "columnName": "primary", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "notify", + "columnName": "notify", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "browse", + "columnName": "browse", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "leave_on_server", + "columnName": "leave_on_server", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "leave_deleted", + "columnName": "leave_deleted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "leave_on_device", + "columnName": "leave_on_device", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "max_messages", + "columnName": "max_messages", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "auto_seen", + "columnName": "auto_seen", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "separator", + "columnName": "separator", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "swipe_left", + "columnName": "swipe_left", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "swipe_right", + "columnName": "swipe_right", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "move_to", + "columnName": "move_to", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "poll_interval", + "columnName": "poll_interval", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "keep_alive_ok", + "columnName": "keep_alive_ok", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "keep_alive_failed", + "columnName": "keep_alive_failed", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "keep_alive_succeeded", + "columnName": "keep_alive_succeeded", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "partial_fetch", + "columnName": "partial_fetch", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ignore_size", + "columnName": "ignore_size", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "use_date", + "columnName": "use_date", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "use_received", + "columnName": "use_received", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "prefix", + "columnName": "prefix", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "quota_usage", + "columnName": "quota_usage", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "quota_limit", + "columnName": "quota_limit", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "created", + "columnName": "created", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "tbd", + "columnName": "tbd", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "thread", + "columnName": "thread", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "warning", + "columnName": "warning", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "last_connected", + "columnName": "last_connected", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "backoff_until", + "columnName": "backoff_until", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "max_size", + "columnName": "max_size", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "capabilities", + "columnName": "capabilities", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "capability_idle", + "columnName": "capability_idle", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "capability_utf8", + "columnName": "capability_utf8", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "folder", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`order` INTEGER, `id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `parent` INTEGER, `uidv` INTEGER, `modseq` INTEGER, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `level` INTEGER NOT NULL, `local` INTEGER NOT NULL, `synchronize` INTEGER NOT NULL, `poll` INTEGER NOT NULL, `poll_factor` INTEGER NOT NULL, `poll_count` INTEGER NOT NULL, `download` INTEGER NOT NULL, `auto_classify_source` INTEGER NOT NULL, `auto_classify_target` INTEGER NOT NULL, `subscribed` INTEGER, `sync_days` INTEGER NOT NULL, `keep_days` INTEGER NOT NULL, `auto_delete` INTEGER NOT NULL, `display` TEXT, `color` INTEGER, `hide` INTEGER NOT NULL, `collapsed` INTEGER NOT NULL, `unified` INTEGER NOT NULL, `navigation` INTEGER NOT NULL, `notify` INTEGER NOT NULL, `total` INTEGER, `keywords` TEXT, `selected_last` INTEGER NOT NULL, `selected_count` INTEGER NOT NULL, `initialize` INTEGER NOT NULL, `tbc` INTEGER, `tbd` INTEGER, `rename` TEXT, `state` TEXT, `sync_state` TEXT, `read_only` INTEGER NOT NULL, `selectable` INTEGER NOT NULL, `inferiors` INTEGER NOT NULL, `error` TEXT, `last_sync` INTEGER, `last_sync_count` INTEGER, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "order", + "columnName": "order", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "parent", + "columnName": "parent", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uidv", + "columnName": "uidv", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "modseq", + "columnName": "modseq", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "level", + "columnName": "level", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "local", + "columnName": "local", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "synchronize", + "columnName": "synchronize", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "poll", + "columnName": "poll", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "poll_factor", + "columnName": "poll_factor", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "poll_count", + "columnName": "poll_count", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "download", + "columnName": "download", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auto_classify_source", + "columnName": "auto_classify_source", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auto_classify_target", + "columnName": "auto_classify_target", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "subscribed", + "columnName": "subscribed", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "sync_days", + "columnName": "sync_days", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "keep_days", + "columnName": "keep_days", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auto_delete", + "columnName": "auto_delete", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "display", + "columnName": "display", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "color", + "columnName": "color", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "hide", + "columnName": "hide", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "collapsed", + "columnName": "collapsed", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "unified", + "columnName": "unified", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "navigation", + "columnName": "navigation", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "notify", + "columnName": "notify", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "total", + "columnName": "total", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "keywords", + "columnName": "keywords", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "selected_last", + "columnName": "selected_last", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "selected_count", + "columnName": "selected_count", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "initialize", + "columnName": "initialize", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "tbc", + "columnName": "tbc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "tbd", + "columnName": "tbd", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "rename", + "columnName": "rename", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sync_state", + "columnName": "sync_state", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "read_only", + "columnName": "read_only", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "selectable", + "columnName": "selectable", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "inferiors", + "columnName": "inferiors", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "last_sync", + "columnName": "last_sync", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "last_sync_count", + "columnName": "last_sync_count", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_folder_account_name", + "unique": true, + "columnNames": [ + "account", + "name" + ], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_folder_account_name` ON `${TABLE_NAME}` (`account`, `name`)" + }, + { + "name": "index_folder_account", + "unique": false, + "columnNames": [ + "account" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_folder_account` ON `${TABLE_NAME}` (`account`)" + }, + { + "name": "index_folder_name", + "unique": false, + "columnNames": [ + "name" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_folder_name` ON `${TABLE_NAME}` (`name`)" + }, + { + "name": "index_folder_type", + "unique": false, + "columnNames": [ + "type" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_folder_type` ON `${TABLE_NAME}` (`type`)" + }, + { + "name": "index_folder_unified", + "unique": false, + "columnNames": [ + "unified" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_folder_unified` ON `${TABLE_NAME}` (`unified`)" + } + ], + "foreignKeys": [ + { + "table": "account", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "account" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "message", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER NOT NULL, `folder` INTEGER NOT NULL, `identity` INTEGER, `extra` TEXT, `replying` INTEGER, `forwarding` INTEGER, `uid` INTEGER, `uidl` TEXT, `msgid` TEXT, `hash` TEXT, `references` TEXT, `deliveredto` TEXT, `inreplyto` TEXT, `wasforwardedfrom` TEXT, `thread` TEXT, `priority` INTEGER, `importance` INTEGER, `auto_submitted` INTEGER, `receipt` INTEGER, `receipt_request` INTEGER, `receipt_to` TEXT, `bimi_selector` TEXT, `dkim` INTEGER, `spf` INTEGER, `dmarc` INTEGER, `mx` INTEGER, `blocklist` INTEGER, `reply_domain` INTEGER, `avatar` TEXT, `sender` TEXT, `return_path` TEXT, `submitter` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `list_post` TEXT, `unsubscribe` TEXT, `autocrypt` TEXT, `headers` TEXT, `raw` INTEGER, `subject` TEXT, `size` INTEGER, `total` INTEGER, `attachments` INTEGER NOT NULL, `content` INTEGER NOT NULL, `language` TEXT, `plain_only` INTEGER, `encrypt` INTEGER, `ui_encrypt` INTEGER, `verified` INTEGER NOT NULL, `preview` TEXT, `notes` TEXT, `notes_color` INTEGER, `signature` INTEGER NOT NULL, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `answered` INTEGER NOT NULL, `flagged` INTEGER NOT NULL, `deleted` INTEGER NOT NULL, `flags` TEXT, `keywords` TEXT, `labels` TEXT, `fts` INTEGER NOT NULL, `auto_classified` INTEGER NOT NULL, `notifying` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_answered` INTEGER NOT NULL, `ui_flagged` INTEGER NOT NULL, `ui_deleted` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `ui_found` INTEGER NOT NULL, `ui_ignored` INTEGER NOT NULL, `ui_silent` INTEGER NOT NULL, `ui_browsed` INTEGER NOT NULL, `ui_busy` INTEGER, `ui_snoozed` INTEGER, `ui_unsnoozed` INTEGER NOT NULL, `show_images` INTEGER NOT NULL, `show_full` INTEGER NOT NULL, `color` INTEGER, `revision` INTEGER, `revisions` INTEGER, `warning` TEXT, `error` TEXT, `last_attempt` INTEGER, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL , FOREIGN KEY(`forwarding`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE SET NULL )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "folder", + "columnName": "folder", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "identity", + "columnName": "identity", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "extra", + "columnName": "extra", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "replying", + "columnName": "replying", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "forwarding", + "columnName": "forwarding", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uid", + "columnName": "uid", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "uidl", + "columnName": "uidl", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "msgid", + "columnName": "msgid", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "hash", + "columnName": "hash", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "references", + "columnName": "references", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "deliveredto", + "columnName": "deliveredto", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "inreplyto", + "columnName": "inreplyto", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "wasforwardedfrom", + "columnName": "wasforwardedfrom", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "thread", + "columnName": "thread", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "priority", + "columnName": "priority", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "importance", + "columnName": "importance", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "auto_submitted", + "columnName": "auto_submitted", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dsn", + "columnName": "receipt", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "receipt_request", + "columnName": "receipt_request", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "receipt_to", + "columnName": "receipt_to", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "bimi_selector", + "columnName": "bimi_selector", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "dkim", + "columnName": "dkim", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "spf", + "columnName": "spf", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "dmarc", + "columnName": "dmarc", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "mx", + "columnName": "mx", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "blocklist", + "columnName": "blocklist", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "reply_domain", + "columnName": "reply_domain", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "sender", + "columnName": "sender", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "return_path", + "columnName": "return_path", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "submitter", + "columnName": "submitter", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "from", + "columnName": "from", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "to", + "columnName": "to", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "cc", + "columnName": "cc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "bcc", + "columnName": "bcc", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "reply", + "columnName": "reply", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "list_post", + "columnName": "list_post", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "unsubscribe", + "columnName": "unsubscribe", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "autocrypt", + "columnName": "autocrypt", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "headers", + "columnName": "headers", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "raw", + "columnName": "raw", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "subject", + "columnName": "subject", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "size", + "columnName": "size", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "total", + "columnName": "total", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "attachments", + "columnName": "attachments", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "content", + "columnName": "content", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "language", + "columnName": "language", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "plain_only", + "columnName": "plain_only", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "encrypt", + "columnName": "encrypt", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ui_encrypt", + "columnName": "ui_encrypt", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "verified", + "columnName": "verified", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "preview", + "columnName": "preview", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "notes", + "columnName": "notes", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "notes_color", + "columnName": "notes_color", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "signature", + "columnName": "signature", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sent", + "columnName": "sent", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "received", + "columnName": "received", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "stored", + "columnName": "stored", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "seen", + "columnName": "seen", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "answered", + "columnName": "answered", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "flagged", + "columnName": "flagged", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "deleted", + "columnName": "deleted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "flags", + "columnName": "flags", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "keywords", + "columnName": "keywords", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "labels", + "columnName": "labels", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "fts", + "columnName": "fts", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "auto_classified", + "columnName": "auto_classified", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "notifying", + "columnName": "notifying", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_seen", + "columnName": "ui_seen", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_answered", + "columnName": "ui_answered", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_flagged", + "columnName": "ui_flagged", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_deleted", + "columnName": "ui_deleted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_hide", + "columnName": "ui_hide", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_found", + "columnName": "ui_found", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_ignored", + "columnName": "ui_ignored", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_silent", + "columnName": "ui_silent", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_browsed", + "columnName": "ui_browsed", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "ui_busy", + "columnName": "ui_busy", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ui_snoozed", + "columnName": "ui_snoozed", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "ui_unsnoozed", + "columnName": "ui_unsnoozed", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "show_images", + "columnName": "show_images", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "show_full", + "columnName": "show_full", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "color", + "columnName": "color", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "revision", + "columnName": "revision", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "revisions", + "columnName": "revisions", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "warning", + "columnName": "warning", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "last_attempt", + "columnName": "last_attempt", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_message_account", + "unique": false, + "columnNames": [ + "account" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_account` ON `${TABLE_NAME}` (`account`)" + }, + { + "name": "index_message_folder", + "unique": false, + "columnNames": [ + "folder" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_folder` ON `${TABLE_NAME}` (`folder`)" + }, + { + "name": "index_message_identity", + "unique": false, + "columnNames": [ + "identity" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_identity` ON `${TABLE_NAME}` (`identity`)" + }, + { + "name": "index_message_folder_uid", + "unique": true, + "columnNames": [ + "folder", + "uid" + ], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_message_folder_uid` ON `${TABLE_NAME}` (`folder`, `uid`)" + }, + { + "name": "index_message_inreplyto", + "unique": false, + "columnNames": [ + "inreplyto" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_inreplyto` ON `${TABLE_NAME}` (`inreplyto`)" + }, + { + "name": "index_message_msgid", + "unique": false, + "columnNames": [ + "msgid" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_msgid` ON `${TABLE_NAME}` (`msgid`)" + }, + { + "name": "index_message_thread", + "unique": false, + "columnNames": [ + "thread" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_thread` ON `${TABLE_NAME}` (`thread`)" + }, + { + "name": "index_message_sender", + "unique": false, + "columnNames": [ + "sender" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_sender` ON `${TABLE_NAME}` (`sender`)" + }, + { + "name": "index_message_received", + "unique": false, + "columnNames": [ + "received" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_received` ON `${TABLE_NAME}` (`received`)" + }, + { + "name": "index_message_subject", + "unique": false, + "columnNames": [ + "subject" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_subject` ON `${TABLE_NAME}` (`subject`)" + }, + { + "name": "index_message_ui_seen", + "unique": false, + "columnNames": [ + "ui_seen" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_seen` ON `${TABLE_NAME}` (`ui_seen`)" + }, + { + "name": "index_message_ui_flagged", + "unique": false, + "columnNames": [ + "ui_flagged" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_flagged` ON `${TABLE_NAME}` (`ui_flagged`)" + }, + { + "name": "index_message_ui_hide", + "unique": false, + "columnNames": [ + "ui_hide" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_hide` ON `${TABLE_NAME}` (`ui_hide`)" + }, + { + "name": "index_message_ui_found", + "unique": false, + "columnNames": [ + "ui_found" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_found` ON `${TABLE_NAME}` (`ui_found`)" + }, + { + "name": "index_message_ui_ignored", + "unique": false, + "columnNames": [ + "ui_ignored" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_ignored` ON `${TABLE_NAME}` (`ui_ignored`)" + }, + { + "name": "index_message_ui_browsed", + "unique": false, + "columnNames": [ + "ui_browsed" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_browsed` ON `${TABLE_NAME}` (`ui_browsed`)" + }, + { + "name": "index_message_ui_snoozed", + "unique": false, + "columnNames": [ + "ui_snoozed" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_message_ui_snoozed` ON `${TABLE_NAME}` (`ui_snoozed`)" + } + ], + "foreignKeys": [ + { + "table": "account", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "account" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "folder", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "folder" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "identity", + "onDelete": "SET NULL", + "onUpdate": "NO ACTION", + "columns": [ + "identity" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "message", + "onDelete": "SET NULL", + "onUpdate": "NO ACTION", + "columns": [ + "replying" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "message", + "onDelete": "SET NULL", + "onUpdate": "NO ACTION", + "columns": [ + "forwarding" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "attachment", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `message` INTEGER NOT NULL, `sequence` INTEGER NOT NULL, `subsequence` INTEGER, `name` TEXT, `type` TEXT NOT NULL, `disposition` TEXT, `cid` TEXT, `encryption` INTEGER, `size` INTEGER, `progress` INTEGER, `available` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "message", + "columnName": "message", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sequence", + "columnName": "sequence", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "subsequence", + "columnName": "subsequence", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "disposition", + "columnName": "disposition", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "cid", + "columnName": "cid", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "encryption", + "columnName": "encryption", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "size", + "columnName": "size", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "progress", + "columnName": "progress", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "available", + "columnName": "available", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_attachment_message", + "unique": false, + "columnNames": [ + "message" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_attachment_message` ON `${TABLE_NAME}` (`message`)" + }, + { + "name": "index_attachment_message_sequence_subsequence", + "unique": true, + "columnNames": [ + "message", + "sequence", + "subsequence" + ], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_attachment_message_sequence_subsequence` ON `${TABLE_NAME}` (`message`, `sequence`, `subsequence`)" + }, + { + "name": "index_attachment_message_cid", + "unique": false, + "columnNames": [ + "message", + "cid" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_attachment_message_cid` ON `${TABLE_NAME}` (`message`, `cid`)" + } + ], + "foreignKeys": [ + { + "table": "message", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "message" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "operation", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `message` INTEGER, `name` TEXT NOT NULL, `args` TEXT NOT NULL, `created` INTEGER NOT NULL, `tries` INTEGER NOT NULL, `state` TEXT, `error` TEXT, FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "folder", + "columnName": "folder", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "message", + "columnName": "message", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "args", + "columnName": "args", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "created", + "columnName": "created", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "tries", + "columnName": "tries", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "error", + "columnName": "error", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_operation_account", + "unique": false, + "columnNames": [ + "account" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_operation_account` ON `${TABLE_NAME}` (`account`)" + }, + { + "name": "index_operation_folder", + "unique": false, + "columnNames": [ + "folder" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_operation_folder` ON `${TABLE_NAME}` (`folder`)" + }, + { + "name": "index_operation_message", + "unique": false, + "columnNames": [ + "message" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_operation_message` ON `${TABLE_NAME}` (`message`)" + }, + { + "name": "index_operation_name", + "unique": false, + "columnNames": [ + "name" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_operation_name` ON `${TABLE_NAME}` (`name`)" + }, + { + "name": "index_operation_state", + "unique": false, + "columnNames": [ + "state" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_operation_state` ON `${TABLE_NAME}` (`state`)" + } + ], + "foreignKeys": [ + { + "table": "folder", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "folder" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "message", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "message" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "contact", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER NOT NULL, `type` INTEGER NOT NULL, `email` TEXT NOT NULL, `name` TEXT, `avatar` TEXT, `times_contacted` INTEGER NOT NULL, `first_contacted` INTEGER NOT NULL, `last_contacted` INTEGER NOT NULL, `state` INTEGER NOT NULL, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "email", + "columnName": "email", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "avatar", + "columnName": "avatar", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "times_contacted", + "columnName": "times_contacted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "first_contacted", + "columnName": "first_contacted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "last_contacted", + "columnName": "last_contacted", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "state", + "columnName": "state", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_contact_account_type_email", + "unique": true, + "columnNames": [ + "account", + "type", + "email" + ], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_contact_account_type_email` ON `${TABLE_NAME}` (`account`, `type`, `email`)" + }, + { + "name": "index_contact_email", + "unique": false, + "columnNames": [ + "email" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_email` ON `${TABLE_NAME}` (`email`)" + }, + { + "name": "index_contact_name", + "unique": false, + "columnNames": [ + "name" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_name` ON `${TABLE_NAME}` (`name`)" + }, + { + "name": "index_contact_avatar", + "unique": false, + "columnNames": [ + "avatar" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_avatar` ON `${TABLE_NAME}` (`avatar`)" + }, + { + "name": "index_contact_times_contacted", + "unique": false, + "columnNames": [ + "times_contacted" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_times_contacted` ON `${TABLE_NAME}` (`times_contacted`)" + }, + { + "name": "index_contact_last_contacted", + "unique": false, + "columnNames": [ + "last_contacted" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_last_contacted` ON `${TABLE_NAME}` (`last_contacted`)" + }, + { + "name": "index_contact_state", + "unique": false, + "columnNames": [ + "state" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_contact_state` ON `${TABLE_NAME}` (`state`)" + } + ], + "foreignKeys": [ + { + "table": "account", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "account" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "certificate", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `fingerprint` TEXT NOT NULL, `intermediate` INTEGER NOT NULL, `email` TEXT NOT NULL, `subject` TEXT, `after` INTEGER, `before` INTEGER, `data` TEXT NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "fingerprint", + "columnName": "fingerprint", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "intermediate", + "columnName": "intermediate", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "email", + "columnName": "email", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "subject", + "columnName": "subject", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "after", + "columnName": "after", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "before", + "columnName": "before", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "data", + "columnName": "data", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_certificate_fingerprint_email", + "unique": true, + "columnNames": [ + "fingerprint", + "email" + ], + "createSql": "CREATE UNIQUE INDEX IF NOT EXISTS `index_certificate_fingerprint_email` ON `${TABLE_NAME}` (`fingerprint`, `email`)" + }, + { + "name": "index_certificate_email", + "unique": false, + "columnNames": [ + "email" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_certificate_email` ON `${TABLE_NAME}` (`email`)" + } + ], + "foreignKeys": [] + }, + { + "tableName": "answer", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `group` TEXT, `standard` INTEGER NOT NULL, `receipt` INTEGER NOT NULL, `favorite` INTEGER NOT NULL, `hide` INTEGER NOT NULL, `external` INTEGER NOT NULL, `text` TEXT NOT NULL, `applied` INTEGER NOT NULL, `last_applied` INTEGER)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "group", + "columnName": "group", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "standard", + "columnName": "standard", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "receipt", + "columnName": "receipt", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "favorite", + "columnName": "favorite", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "hide", + "columnName": "hide", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "external", + "columnName": "external", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "text", + "columnName": "text", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "applied", + "columnName": "applied", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "last_applied", + "columnName": "last_applied", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "rule", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `folder` INTEGER NOT NULL, `name` TEXT NOT NULL, `order` INTEGER NOT NULL, `enabled` INTEGER NOT NULL, `stop` INTEGER NOT NULL, `condition` TEXT NOT NULL, `action` TEXT NOT NULL, `applied` INTEGER NOT NULL, `last_applied` INTEGER, FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "folder", + "columnName": "folder", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "order", + "columnName": "order", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "enabled", + "columnName": "enabled", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "stop", + "columnName": "stop", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "condition", + "columnName": "condition", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "action", + "columnName": "action", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "applied", + "columnName": "applied", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "last_applied", + "columnName": "last_applied", + "affinity": "INTEGER", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_rule_folder", + "unique": false, + "columnNames": [ + "folder" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rule_folder` ON `${TABLE_NAME}` (`folder`)" + }, + { + "name": "index_rule_order", + "unique": false, + "columnNames": [ + "order" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_rule_order` ON `${TABLE_NAME}` (`order`)" + } + ], + "foreignKeys": [ + { + "table": "folder", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "folder" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "log", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `time` INTEGER NOT NULL, `type` INTEGER NOT NULL, `data` TEXT NOT NULL)", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "time", + "columnName": "time", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "type", + "columnName": "type", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "data", + "columnName": "data", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_log_time", + "unique": false, + "columnNames": [ + "time" + ], + "createSql": "CREATE INDEX IF NOT EXISTS `index_log_time` ON `${TABLE_NAME}` (`time`)" + } + ], + "foreignKeys": [] + } + ], + "views": [ + { + "viewName": "account_view", + "createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, pop, name, color, synchronize, notify, leave_deleted, auto_seen, created FROM account" + }, + { + "viewName": "identity_view", + "createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, name, email, display, color, synchronize FROM identity" + }, + { + "viewName": "folder_view", + "createSql": "CREATE VIEW `${VIEW_NAME}` AS SELECT id, account, name, type, display, color, unified, notify, read_only FROM folder" + } + ], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'c3ba3803793a1769d5c21d85d20a539b')" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index 99a3d91120..30d552f7cb 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -24,6 +24,8 @@ import static androidx.core.app.NotificationCompat.DEFAULT_LIGHTS; import static androidx.core.app.NotificationCompat.DEFAULT_SOUND; import static javax.mail.Folder.READ_WRITE; +import static eu.faircode.email.EntityLog.LOG_STATS; + import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationChannel; @@ -1480,7 +1482,8 @@ class Core { } if (!stats.isEmpty()) - EntityLog.log(context, account.name + "/" + folder.name + " fetch stats " + stats); + EntityLog.log(context, LOG_STATS, + account.name + "/" + folder.name + " fetch stats " + stats); } catch (MessageRemovedException | MessageRemovedIOException ex) { Log.i(ex); @@ -3206,7 +3209,8 @@ class Core { stats.total = (SystemClock.elapsedRealtime() - search); - EntityLog.log(context, account.name + "/" + folder.name + " sync stats " + stats); + EntityLog.log(context, LOG_STATS, + account.name + "/" + folder.name + " sync stats " + stats); } finally { Log.i(folder.name + " end sync state=" + state); db.folder().setFolderSyncState(folder.id, null); diff --git a/app/src/main/java/eu/faircode/email/DB.java b/app/src/main/java/eu/faircode/email/DB.java index ecccd72338..9b3027c625 100644 --- a/app/src/main/java/eu/faircode/email/DB.java +++ b/app/src/main/java/eu/faircode/email/DB.java @@ -67,7 +67,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase; // https://developer.android.com/topic/libraries/architecture/room.html @Database( - version = 207, + version = 208, entities = { EntityIdentity.class, EntityAccount.class, @@ -2100,6 +2100,12 @@ public abstract class DB extends RoomDatabase { db.execSQL("DROP VIEW `account_view`"); db.execSQL("CREATE VIEW IF NOT EXISTS `account_view` AS " + TupleAccountView.query); } + }).addMigrations(new Migration(207, 208) { + @Override + public void migrate(@NonNull SupportSQLiteDatabase db) { + Log.i("DB migration from version " + startVersion + " to " + endVersion); + db.execSQL("ALTER TABLE `log` ADD COLUMN `type` INTEGER NOT NULL DEFAULT " + EntityLog.LOG_GENERAL); + } }).addMigrations(new Migration(998, 999) { @Override public void migrate(@NonNull SupportSQLiteDatabase db) { diff --git a/app/src/main/java/eu/faircode/email/DaoLog.java b/app/src/main/java/eu/faircode/email/DaoLog.java index 4e5c6e2372..801a98bce7 100644 --- a/app/src/main/java/eu/faircode/email/DaoLog.java +++ b/app/src/main/java/eu/faircode/email/DaoLog.java @@ -30,14 +30,16 @@ import java.util.List; public interface DaoLog { @Query("SELECT * FROM log" + " WHERE time > :from" + + " AND (:type IS NULL OR type = :type)" + " ORDER BY time DESC" + " LIMIT 2000") - LiveData> liveLogs(long from); + LiveData> liveLogs(long from, Integer type); @Query("SELECT * FROM log" + " WHERE time > :from" + + " AND (:type IS NULL OR type = :type)" + " ORDER BY time DESC") - List getLogs(long from); + List getLogs(long from, Integer type); @Insert long insertLog(EntityLog log); diff --git a/app/src/main/java/eu/faircode/email/EntityLog.java b/app/src/main/java/eu/faircode/email/EntityLog.java index 3b42981c4b..6c3b97ce82 100644 --- a/app/src/main/java/eu/faircode/email/EntityLog.java +++ b/app/src/main/java/eu/faircode/email/EntityLog.java @@ -55,12 +55,24 @@ public class EntityLog { @NonNull public Long time; @NonNull + public Integer type = LOG_GENERAL; + @NonNull public String data; + static final int LOG_GENERAL = 0; + static final int LOG_STATS = 1; + static final int LOG_SCHEDULE = 2; + static final int LOG_NETWORK = 3; + static final int LOG_ACCOUNT = 4; + private static final ExecutorService executor = Helper.getBackgroundExecutor(1, "log"); static void log(final Context context, String data) { + log(context, LOG_GENERAL, data); + } + + static void log(final Context context, int type, String data) { Log.i(data); if (context == null) @@ -73,6 +85,7 @@ public class EntityLog { final EntityLog entry = new EntityLog(); entry.time = new Date().getTime(); + entry.type = type; entry.data = data; final DB db = DB.getInstance(context); diff --git a/app/src/main/java/eu/faircode/email/FragmentLogs.java b/app/src/main/java/eu/faircode/email/FragmentLogs.java index 305da1aa98..3f8595f224 100644 --- a/app/src/main/java/eu/faircode/email/FragmentLogs.java +++ b/app/src/main/java/eu/faircode/email/FragmentLogs.java @@ -84,7 +84,7 @@ public class FragmentLogs extends FragmentBase { long from = new Date().getTime() - 24 * 3600 * 1000L; DB db = DB.getInstance(getContext()); - db.log().liveLogs(from).observe(getViewLifecycleOwner(), new Observer>() { + db.log().liveLogs(from, null).observe(getViewLifecycleOwner(), new Observer>() { @Override public void onChanged(List logs) { if (logs == null) diff --git a/app/src/main/java/eu/faircode/email/Log.java b/app/src/main/java/eu/faircode/email/Log.java index 81be4efffd..11d573ce8d 100644 --- a/app/src/main/java/eu/faircode/email/Log.java +++ b/app/src/main/java/eu/faircode/email/Log.java @@ -2099,7 +2099,7 @@ public class Log { long from = new Date().getTime() - 24 * 3600 * 1000L; DateFormat TF = Helper.getTimeInstance(context); - for (EntityLog entry : db.log().getLogs(from)) + for (EntityLog entry : db.log().getLogs(from, null)) size += write(os, String.format("%s %s\r\n", TF.format(entry.time), entry.data)); } diff --git a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java index 2e80b4338a..5171a5afa7 100644 --- a/app/src/main/java/eu/faircode/email/ServiceSynchronize.java +++ b/app/src/main/java/eu/faircode/email/ServiceSynchronize.java @@ -21,6 +21,10 @@ package eu.faircode.email; import static android.os.Process.THREAD_PRIORITY_BACKGROUND; +import static eu.faircode.email.EntityLog.LOG_ACCOUNT; +import static eu.faircode.email.EntityLog.LOG_NETWORK; +import static eu.faircode.email.EntityLog.LOG_SCHEDULE; + import android.app.AlarmManager; import android.app.NotificationManager; import android.app.PendingIntent; @@ -273,17 +277,18 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences int index = accountStates.indexOf(current); if (index < 0) { if (current.canRun()) { - EntityLog.log(ServiceSynchronize.this, "### new " + current + - " force=" + force + - " start=" + current.canRun() + - " sync=" + current.accountState.isEnabled(current.enabled) + - " enabled=" + current.accountState.synchronize + - " ondemand=" + current.accountState.ondemand + - " folders=" + current.accountState.folders + - " ops=" + current.accountState.operations + - " tbd=" + current.accountState.tbd + - " state=" + current.accountState.state + - " active=" + current.networkState.getActive()); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### new " + current + + " force=" + force + + " start=" + current.canRun() + + " sync=" + current.accountState.isEnabled(current.enabled) + + " enabled=" + current.accountState.synchronize + + " ondemand=" + current.accountState.ondemand + + " folders=" + current.accountState.folders + + " ops=" + current.accountState.operations + + " tbd=" + current.accountState.tbd + + " state=" + current.accountState.state + + " active=" + current.networkState.getActive()); event = true; start(current, current.accountState.isEnabled(current.enabled) || sync, force); } @@ -308,22 +313,23 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences prev.canRun() != current.canRun() || !prev.accountState.equals(current.accountState)) { if (prev.canRun() || current.canRun()) - EntityLog.log(ServiceSynchronize.this, "### changed " + current + - " reload=" + reload + - " force=" + force + - " stop=" + prev.canRun() + - " start=" + current.canRun() + - " sync=" + sync + - " enabled=" + current.accountState.isEnabled(current.enabled) + - " should=" + current.accountState.shouldRun(current.enabled) + - " changed=" + !prev.accountState.equals(current.accountState) + - " synchronize=" + current.accountState.synchronize + - " ondemand=" + current.accountState.ondemand + - " folders=" + current.accountState.folders + - " ops=" + current.accountState.operations + - " tbd=" + current.accountState.tbd + - " state=" + current.accountState.state + - " active=" + prev.networkState.getActive() + "/" + current.networkState.getActive()); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### changed " + current + + " reload=" + reload + + " force=" + force + + " stop=" + prev.canRun() + + " start=" + current.canRun() + + " sync=" + sync + + " enabled=" + current.accountState.isEnabled(current.enabled) + + " should=" + current.accountState.shouldRun(current.enabled) + + " changed=" + !prev.accountState.equals(current.accountState) + + " synchronize=" + current.accountState.synchronize + + " ondemand=" + current.accountState.ondemand + + " folders=" + current.accountState.folders + + " ops=" + current.accountState.operations + + " tbd=" + current.accountState.tbd + + " state=" + current.accountState.state + + " active=" + prev.networkState.getActive() + "/" + current.networkState.getActive()); if (prev.canRun()) { event = true; stop(prev); @@ -336,8 +342,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (state != null) { Network p = prev.networkState.getActive(); if (p != null && !p.equals(current.networkState.getActive())) { - EntityLog.log(ServiceSynchronize.this, "### changed " + current + - " active=" + prev.networkState.getActive() + "/" + current.networkState.getActive()); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### changed " + current + + " active=" + prev.networkState.getActive() + "/" + current.networkState.getActive()); state.error(new OperationCanceledException("Active network changed")); } } @@ -354,7 +361,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (event) { lastEventId++; - EntityLog.log(ServiceSynchronize.this, "### eventId=" + lastEventId); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### eventId=" + lastEventId); } if (lastAccounts != accounts || lastOperations != operations) { @@ -394,9 +402,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } if (!runService && lastQuitId != lastEventId) { - EntityLog.log(ServiceSynchronize.this, "### quitting" + - " run=" + runService + - " startId=" + lastQuitId + "/" + lastEventId); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### quitting" + + " run=" + runService + + " startId=" + lastQuitId + "/" + lastEventId); lastQuitId = lastEventId; quit(lastEventId); } @@ -407,7 +416,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences queue.submit(new Runnable() { @Override public void run() { - EntityLog.log(ServiceSynchronize.this, "### init " + accountNetworkState); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### init " + accountNetworkState); DB db = DB.getInstance(ServiceSynchronize.this); try { @@ -435,7 +445,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } private void start(final TupleAccountNetworkState accountNetworkState, boolean sync, boolean force) { - EntityLog.log(ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, "Service start=" + accountNetworkState + " sync=" + sync + " force=" + force); final Core.State astate = new Core.State(accountNetworkState.networkState); @@ -466,7 +476,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Log.i("### start=" + accountNetworkState + " sync=" + sync); astate.start(); - EntityLog.log(ServiceSynchronize.this, "### started=" + accountNetworkState); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### started=" + accountNetworkState); } catch (Throwable ex) { Log.e(ex); } @@ -480,7 +491,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences return; coreStates.remove(accountNetworkState.accountState.id); - EntityLog.log(ServiceSynchronize.this, "Service stop=" + accountNetworkState); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "Service stop=" + accountNetworkState); queue.submit(new Runnable() { @Override @@ -499,7 +511,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences db.account().setAccountThread(accountNetworkState.accountState.id, null); state.stop(); state.join(); - EntityLog.log(ServiceSynchronize.this, "### stopped=" + accountNetworkState); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### stopped=" + accountNetworkState); } catch (Throwable ex) { Log.e(ex); } @@ -508,7 +521,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } private void delete(final TupleAccountNetworkState accountNetworkState) { - EntityLog.log(ServiceSynchronize.this, "Service delete=" + accountNetworkState); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "Service delete=" + accountNetworkState); queue.submit(new Runnable() { @Override @@ -533,7 +547,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences @Override public void run() { try { - EntityLog.log(ServiceSynchronize.this, "### quit eventId=" + eventId); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### quit eventId=" + eventId); if (eventId == null) { // Service destroy @@ -554,14 +569,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } if (!eventId.equals(lastEventId)) { - EntityLog.log(ServiceSynchronize.this, "### quit cancelled eventId=" + eventId + "/" + lastEventId); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### quit cancelled eventId=" + eventId + "/" + lastEventId); return; } } // Stop service stopSelf(); - EntityLog.log(ServiceSynchronize.this, "### stop self eventId=" + eventId); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### stop self eventId=" + eventId); WorkerCleanup.cleanupConditionally(ServiceSynchronize.this); } @@ -799,8 +816,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences public int onStartCommand(Intent intent, int flags, int startId) { String action = (intent == null ? null : intent.getAction()); String reason = (intent == null ? null : intent.getStringExtra("reason")); - EntityLog.log(ServiceSynchronize.this, "### Service command " + intent + - " action=" + action + " reason=" + reason); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### Service command " + intent + + " action=" + action + " reason=" + reason); Log.logExtras(intent); super.onStartCommand(intent, flags, startId); @@ -899,11 +917,14 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Core.State state = coreStates.get(account); if (state == null) - EntityLog.log(this, "### wakeup missing account=" + account); + EntityLog.log(this, LOG_SCHEDULE, + "### wakeup missing account=" + account); else { - EntityLog.log(this, "### waking up account=" + account); + EntityLog.log(this, LOG_SCHEDULE, + "### waking up account=" + account); if (!state.release()) - EntityLog.log(this, "### waking up failed account=" + account); + EntityLog.log(this, LOG_SCHEDULE, + "### waking up failed account=" + account); } } @@ -940,18 +961,19 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences EntityOperation.queue(ServiceSynchronize.this, message, EntityOperation.SEND); } } else { - EntityLog.log(ServiceSynchronize.this, folder.name + " Unsnooze" + - " id=" + message.id + - " ui_seen=" + message.ui_seen + "" + - " ui_ignored=" + message.ui_ignored + - " ui_hide=" + message.ui_hide + - " notifying=" + message.notifying + - " silent=" + message.ui_silent + - " received=" + new Date(message.received) + - " sent=" + (message.sent == null ? null : new Date(message.sent)) + - " created=" + (account.created == null ? null : new Date(account.created)) + - " notify=" + folder.notify + - " sync=" + account.synchronize); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + folder.name + " Unsnooze" + + " id=" + message.id + + " ui_seen=" + message.ui_seen + "" + + " ui_ignored=" + message.ui_ignored + + " ui_hide=" + message.ui_hide + + " notifying=" + message.notifying + + " silent=" + message.ui_silent + + " received=" + new Date(message.received) + + " sent=" + (message.sent == null ? null : new Date(message.sent)) + + " created=" + (account.created == null ? null : new Date(account.created)) + + " notify=" + folder.notify + + " sync=" + account.synchronize); if (folder.notify) { List attachments = db.attachment().getAttachments(id); @@ -1109,7 +1131,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } private void onWatchdog(Intent intent) { - EntityLog.log(this, "Watchdog"); + EntityLog.log(this, LOG_SCHEDULE, "Watchdog"); schedule(this, false); if (lastNetworkState == null || !lastNetworkState.isSuitable()) @@ -1259,7 +1281,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (TextUtils.isEmpty(message)) message = "?"; if (e.getMessageType() == StoreEvent.NOTICE) { - EntityLog.log(ServiceSynchronize.this, account.name + " notice: " + message); + EntityLog.log(ServiceSynchronize.this, LOG_ACCOUNT, + account.name + " notice: " + message); if ("Still here".equals(message) && !account.isTransient(ServiceSynchronize.this)) { @@ -1277,7 +1300,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences try { wlFolder.acquire(); - EntityLog.log(ServiceSynchronize.this, account.name + " alert: " + message); + EntityLog.log(ServiceSynchronize.this, LOG_ACCOUNT, + account.name + " alert: " + message); if (!ConnectionHelper.isMaxConnections(message)) try { @@ -1298,7 +1322,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences List idlers = new ArrayList<>(); try { // Initiate connection - EntityLog.log(this, account.name + " connecting"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " connecting"); db.folder().setFolderStates(account.id, null); db.account().setAccountState(account.id, "connecting"); @@ -1353,10 +1378,12 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Store istore = iservice.getStore(); if (istore instanceof IMAPStore) { Map caps = ((IMAPStore) istore).getCapabilities(); - EntityLog.log(this, account.name + " connected" + - " caps=" + (caps == null ? null : TextUtils.join(" ", caps.keySet()))); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " connected" + + " caps=" + (caps == null ? null : TextUtils.join(" ", caps.keySet()))); } else - EntityLog.log(this, account.name + " connected"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " connected"); db.account().setAccountMaxSize(account.id, iservice.getMaxSize()); if (istore instanceof IMAPStore) @@ -1523,8 +1550,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Thread.sleep(FETCH_YIELD_DURATION); } catch (Throwable ex) { Log.e(folder.name, ex); - EntityLog.log( - ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, folder.name + " added " + Log.formatThrowable(ex, false)); state.error(ex); } finally { @@ -1554,8 +1580,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Thread.sleep(FETCH_YIELD_DURATION); } catch (Throwable ex) { Log.e(folder.name, ex); - EntityLog.log( - ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, folder.name + " removed " + Log.formatThrowable(ex, false)); state.error(ex); } finally { @@ -1580,8 +1605,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences Thread.sleep(FETCH_YIELD_DURATION); } catch (Throwable ex) { Log.e(folder.name, ex); - EntityLog.log( - ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, folder.name + " changed " + Log.formatThrowable(ex, false)); state.error(ex); } finally { @@ -1603,8 +1627,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } } catch (Throwable ex) { Log.e(folder.name, ex); - EntityLog.log( - ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_ACCOUNT, folder.name + " idle " + Log.formatThrowable(ex, false)); state.error(new FolderClosedException(ifolder, "IDLE", new Exception(ex))); } finally { @@ -1847,8 +1870,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } catch (Throwable ex) { Log.e(folder.name, ex); - EntityLog.log( - ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_ACCOUNT, folder.name + " process " + Log.formatThrowable(ex, false)); db.folder().setFolderError(folder.id, Log.formatThrowable(ex)); if (!(ex instanceof FolderNotFoundException)) @@ -1887,9 +1909,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences !account.keep_alive_ok && account.poll_interval > 9 && Math.abs(idleTime - account.poll_interval * 60 * 1000L) < 60 * 1000L); if (tune_keep_alive && !first && !account.keep_alive_ok) - EntityLog.log(this, account.name + - " Tune interval=" + account.poll_interval + - " idle=" + idleTime + "/" + tune); + EntityLog.log(this, LOG_ACCOUNT, + account.name + + " Tune interval=" + account.poll_interval + + " idle=" + idleTime + "/" + tune); try { if (!state.isRecoverable()) { Throwable unrecoverable = state.getUnrecoverable(); @@ -1902,9 +1925,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Sends store NOOP if (EmailService.SEPARATE_STORE_CONNECTION) { - EntityLog.log(this, account.name + " checking store" + - " memory=" + Log.getFreeMemMb() + - " battery=" + Helper.getBatteryLevel(this)); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " checking store" + + " memory=" + Log.getFreeMemMb() + + " battery=" + Helper.getBatteryLevel(this)); if (!iservice.getStore().isConnected()) throw new StoreClosedException(iservice.getStore(), "NOOP"); } @@ -1917,7 +1941,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } if (sync) { - EntityLog.log(this, account.name + " checking folders"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " checking folders"); for (EntityFolder folder : mapFolders.keySet()) if (folder.selectable && folder.synchronize) if (!folder.poll && capIdle) { @@ -1981,7 +2006,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences // Record successful connection account.last_connected = new Date().getTime(); - EntityLog.log(this, account.name + " set last_connected=" + new Date(account.last_connected)); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " set last_connected=" + new Date(account.last_connected)); db.account().setAccountConnected(account.id, account.last_connected); db.account().setAccountWarning(account.id, capIdle ? null : getString(R.string.title_no_idle)); @@ -2000,8 +2026,9 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences try { long duration = account.poll_interval * 60 * 1000L; long trigger = System.currentTimeMillis() + duration; - EntityLog.log(this, "### " + account.name + " keep alive" + - " wait=" + account.poll_interval + " until=" + new Date(trigger)); + EntityLog.log(this, LOG_ACCOUNT, + "### " + account.name + " keep alive" + + " wait=" + account.poll_interval + " until=" + new Date(trigger)); AlarmManagerCompatEx.setAndAllowWhileIdle(ServiceSynchronize.this, am, AlarmManager.RTC_WAKEUP, trigger, pi); try { @@ -2024,13 +2051,14 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } catch (Throwable ex) { last_fail = ex; Log.e(account.name, ex); - EntityLog.log(this, + EntityLog.log(this, LOG_ACCOUNT, account.name + " connect " + Log.formatThrowable(ex, false)); db.account().setAccountError(account.id, Log.formatThrowable(ex)); // Report account connection error if (account.last_connected != null && !ConnectionHelper.airplaneMode(this)) { - EntityLog.log(this, account.name + " last connected: " + new Date(account.last_connected)); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " last connected: " + new Date(account.last_connected)); int pollInterval = getPollInterval(this); long now = new Date().getTime(); @@ -2057,7 +2085,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences } } finally { // Update state - EntityLog.log(this, account.name + " closing"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " closing"); // Stop watching operations Log.i(account.name + " stop watching operations"); @@ -2084,13 +2113,16 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences for (EntityFolder folder : mapFolders.keySet()) if (folder.selectable && folder.synchronize && !folder.poll && mapFolders.get(folder) != null) db.folder().setFolderState(folder.id, "closing"); - EntityLog.log(this, account.name + " store closing"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " store closing"); iservice.close(); - EntityLog.log(this, account.name + " store closed"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " store closed"); } catch (Throwable ex) { Log.w(account.name, ex); } finally { - EntityLog.log(this, account.name + " closed"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " closed"); db.account().setAccountState(account.id, null); for (EntityFolder folder : mapFolders.keySet()) db.folder().setFolderState(folder.id, null); @@ -2140,7 +2172,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences " ex=" + Log.formatThrowable(last_fail, false); if (compensate > 2) Log.e(msg); - EntityLog.log(this, msg); + EntityLog.log(this, LOG_ACCOUNT, msg); state.setBackoff(backoff * 60); } @@ -2154,7 +2186,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences int backoff = state.getBackoff(); int recently = (lastLost + LOST_RECENTLY < now ? 1 : 2); - EntityLog.log(this, account.name + " backoff=" + backoff + " recently=" + recently + "x"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " backoff=" + backoff + " recently=" + recently + "x"); if (backoff < CONNECT_BACKOFF_MAX) state.setBackoff(backoff * 2); @@ -2205,7 +2238,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences AlarmManager am = (AlarmManager) getSystemService(Context.ALARM_SERVICE); try { long trigger = System.currentTimeMillis() + backoff * 1000L; - EntityLog.log(this, "### " + account.name + " backoff until=" + new Date(trigger)); + EntityLog.log(this, LOG_ACCOUNT, + "### " + account.name + " backoff until=" + new Date(trigger)); AlarmManagerCompatEx.setAndAllowWhileIdle(ServiceSynchronize.this, am, AlarmManager.RTC_WAKEUP, trigger, pi); try { @@ -2231,7 +2265,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (!currentThread.equals(accountThread) && accountThread != null) Log.w(account.name + " orphan thread id=" + currentThread + "/" + accountThread); } finally { - EntityLog.log(this, account.name + " stopped"); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " stopped"); wlAccount.release(); } } @@ -2276,9 +2311,10 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences DB db = DB.getInstance(this); int pollInterval = getPollInterval(this); - EntityLog.log(this, account.name + " auto optimize" + - " reason=" + reason + - " poll interval=" + pollInterval); + EntityLog.log(this, LOG_ACCOUNT, + account.name + " auto optimize" + + " reason=" + reason + + " poll interval=" + pollInterval); if (pollInterval == 0) { try { db.beginTransaction(); @@ -2315,7 +2351,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences @Override public void onBlockedStatusChanged(@NonNull Network network, boolean blocked) { - EntityLog.log(ServiceSynchronize.this, "Network " + network + " blocked=" + blocked); + EntityLog.log(ServiceSynchronize.this, LOG_NETWORK, + "Network " + network + " blocked=" + blocked); } @Override @@ -2332,7 +2369,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (Intent.ACTION_AIRPLANE_MODE_CHANGED.equals(intent.getAction())) { boolean on = intent.getBooleanExtra("state", false); - EntityLog.log(context, "Airplane mode on=" + on); + EntityLog.log(context, LOG_NETWORK, + "Airplane mode on=" + on); if (!on) lastLost = 0; } @@ -2375,13 +2413,13 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (active != null && !active.equals(lastActive)) { if (ConnectionHelper.isConnected(ServiceSynchronize.this, active)) { - EntityLog.log(ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_NETWORK, reason + ": new active network=" + active + "/" + lastActive); lastActive = active; } } else if (lastActive != null) { if (!ConnectionHelper.isConnected(ServiceSynchronize.this, lastActive)) { - EntityLog.log(ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_NETWORK, reason + ": lost active network=" + lastActive); lastActive = null; lastLost = new Date().getTime(); @@ -2391,7 +2429,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (network == null || Objects.equals(network, active)) { ConnectionHelper.NetworkState ns = ConnectionHelper.getNetworkState(ServiceSynchronize.this); if (!Objects.equals(lastNetworkState, ns)) { - EntityLog.log(ServiceSynchronize.this, + EntityLog.log(ServiceSynchronize.this, LOG_NETWORK, reason + ": updating state network=" + active + " info=" + ConnectionHelper.getNetworkInfo(ServiceSynchronize.this, active) + " " + ns); lastNetworkState = ns; @@ -2402,7 +2440,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences boolean isSuitable = (lastNetworkState != null && lastNetworkState.isSuitable()); if (lastSuitable == null || lastSuitable != isSuitable) { lastSuitable = isSuitable; - EntityLog.log(ServiceSynchronize.this, reason + ": updated suitable=" + lastSuitable); + EntityLog.log(ServiceSynchronize.this, LOG_NETWORK, + reason + ": updated suitable=" + lastSuitable); if (!isBackgroundService(ServiceSynchronize.this)) try { @@ -2428,8 +2467,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences private List lastAccountStates = null; private void post(Bundle command) { - EntityLog.log(ServiceSynchronize.this, "### command " + - TextUtils.join(" ", Log.getExtras(command))); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, + "### command " + TextUtils.join(" ", Log.getExtras(command))); if (command.getBoolean("sync") || command.getBoolean("force")) lastNetworkState = ConnectionHelper.getNetworkState(ServiceSynchronize.this); @@ -2464,7 +2503,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences networkState = ConnectionHelper.getNetworkState(ServiceSynchronize.this); if (accountStates == null) { - EntityLog.log(ServiceSynchronize.this, "### no accounts"); + EntityLog.log(ServiceSynchronize.this, LOG_SCHEDULE, "### no accounts"); lastCommand = command; return; } @@ -2589,7 +2628,8 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences if (polled && next < now + interval / 5) next += interval; - EntityLog.log(context, "Poll next=" + new Date(next) + " polled=" + polled); + EntityLog.log(context, LOG_SCHEDULE, + "Poll next=" + new Date(next) + " polled=" + polled); AlarmManagerCompatEx.setAndAllowWhileIdle(context, am, AlarmManager.RTC_WAKEUP, next, piSync); }