Report long database transactions
This change updates the database "recent operations" log. There are
two changes:
1. Explicit transactions are now included as an operation. Explicit
transactions may include many SQL operations. If there are too
many nested operations, then the transaction-begin event might
fall off the ring buffer. Therefore, there is a special operation
reserved for explicit transactions.
When the recent operations are dumped, the currently-open
transaction, if any, is also dumped. The open transaction may
have fallen out of the recent-operations buffer, in which case it
is dumped from an operation variable dedicated to the current
transaction.
2. Operations longer than a compile-time default are saved in a
separate history buffer and are dumped in dumpsys. The duration
is chosen to be close to the SqliteDatabaseLockedException
timeout.
Small changes were made to dumpsys dbinfo to make it simpler to parse.
The unit tests now parse that output and perform rudimentary
validation. SQLiteDatabase.getConcurrentDatabasePaths() has been
removed. It was test-only, and the unit tests that needed it have
been rewritten to use dumpsys output.
Manually tested by creating lengthy operations and verifying the
dumpsys output.
Test: atest
* FrameworksCoreTests:android.database
* CtsDatabaseTestCases
* SQLiteDatabasePerfTest
Bug: 309135899
Change-Id: I34f2f26102f129ea21af1ccee5a9e9055296c8b4
4 files changed