(final Context context)
| 1125 | } |
| 1126 | |
| 1127 | static void boot(final Context context) { |
| 1128 | Helper.getSerialExecutor().submit(new Runnable() { |
| 1129 | @Override |
| 1130 | public void run() { |
| 1131 | try { |
| 1132 | EntityLog.log(context, "Boot send service"); |
| 1133 | |
| 1134 | DB db = DB.getInstance(context); |
| 1135 | |
| 1136 | EntityFolder outbox = db.folder().getOutbox(); |
| 1137 | if (outbox != null) { |
| 1138 | List<EntityOperation> operations = db.operation().getOperations(EntityOperation.SEND); |
| 1139 | EntityLog.log(context, "Start send service ops=" + operations.size()); |
| 1140 | for (EntityOperation operation : operations) |
| 1141 | Log.i("Send operation id=" + operation.id + |
| 1142 | " tries=" + operation.tries + |
| 1143 | " state=" + operation.state + |
| 1144 | " error=" + operation.error + |
| 1145 | " created=" + new Date(operation.created)); |
| 1146 | |
| 1147 | if (!operations.isEmpty()) |
| 1148 | start(context); |
| 1149 | else { |
| 1150 | db.folder().setFolderState(outbox.id, null); |
| 1151 | db.folder().setFolderSyncState(outbox.id, null); |
| 1152 | } |
| 1153 | } |
| 1154 | } catch (Throwable ex) { |
| 1155 | Log.e(ex); |
| 1156 | } |
| 1157 | } |
| 1158 | }); |
| 1159 | } |
| 1160 | |
| 1161 | static void start(Context context) { |
| 1162 | try { |
no test coverage detected