Query for rowid column instead of * when we check row exists.
To be able to do this, we also add rowid to the projection in these
cases (only when we enforce calling permissions).
Also change assertions to use truth assertions, for easier debugging
(for string assertions only in this change).
Example assertion failure:
Before:
[1/33] com.android.providers.media.util.SQLiteQueryBuilderTest#testAllowRowid: FAILED (117ms)
STACKTRACE:
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at com.android.providers.media.util.SQLiteQueryBuilderTest.testAllowRowid(SQLiteQueryBuilderTest.java:174)
After:
[1/33] com.android.providers.media.util.SQLiteQueryBuilderTest#testAllowRowid: FAILED (116ms)
STACKTRACE:
expected to match: SELECT (age|name|address), (age|name|address), (age|name|address) FROM test
but was : SELECT name, rowid, age, address FROM test
at com.android.providers.media.util.SQLiteQueryBuilderTest.testAllowRowid(SQLiteQueryBuilderTest.java:176)
Bug: 161155718
Test: atest CtsProviderTestCases:android.provider.cts.media
Change-Id: I2262fa4ba36b22c65cee247c06f83ac8863cc4c0
3 files changed