()
| 139 | |
| 140 | Helper.getSerialExecutor().submit(new Runnable() { |
| 141 | @Override |
| 142 | public void run() { |
| 143 | // Check available storage space |
| 144 | if (!ok || (++count % LOG_DELETE_BATCH_SIZE) == 0) { |
| 145 | long cake = Helper.getAvailableStorageSpace(); |
| 146 | boolean wasOk = ok; |
| 147 | ok = (cake > Helper.MIN_REQUIRED_SPACE); |
| 148 | if (!ok) |
| 149 | if (wasOk) { |
| 150 | entry.type = Type.General; |
| 151 | entry.account = null; |
| 152 | entry.folder = null; |
| 153 | entry.message = null; |
| 154 | entry.data = "Insufficient storage space=" + |
| 155 | Helper.humanReadableByteCount(cake) + "/" + |
| 156 | Helper.humanReadableByteCount(Helper.MIN_REQUIRED_SPACE); |
| 157 | } else |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | try { |
| 162 | db.beginTransaction(); |
| 163 | db.log().insertLog(entry); |
| 164 | db.setTransactionSuccessful(); |
| 165 | } catch (Throwable ex) { |
| 166 | Log.e(ex); |
| 167 | } finally { |
| 168 | db.endTransaction(); |
| 169 | } |
| 170 | |
| 171 | long now = new Date().getTime(); |
| 172 | if (last_cleanup == null || last_cleanup + LOG_CLEANUP_INTERVAL < now) { |
| 173 | last_cleanup = now; |
| 174 | cleanup(acontext, now - LOG_KEEP_DURATION); |
| 175 | } |
| 176 | } |
| 177 | }); |
| 178 | } |
| 179 |
nothing calls this directly
no test coverage detected