[Android N] Content provider cannot be used in SQLCipher 3.5.1?


#1

Hi,

Thank you for your work to integrate SQLCipher to Android N OS.
Through your notification and the source code, the content provider scheme in Android seems to be not supported from SQLCipher 3.5.1.
Is this right ?
If so, I’d like to know that if you have any plan for supporting the content provider.

Thanks.


#2

Can you point to the specific change(s) that break the content provider compatibility?

Also can you give any pointers how to test the content provider compatibility in the future?


#3

In AOSP,
Content provider is a way of accessing common database from several processes.
https://developer.android.com/guide/topics/providers/content-provider-basics.html
As I know, CursorWindow must be created in ashmem to share the query result between the provider and the clients, and
binder protocol is also necessary.

The notification says that libbinder is removed.
-> 1.All internal and third-party library dependencies except for OpenSSL (the crypto provider) have been removed. Thisincludes libbinder, libandroid_runtime, libnativehelper, libcutils, libutils, and libicuc.
Besides there are no codes for ashmem in CursorWindow.cpp.
I think that inter-process share of database is not possible in SQLCipher.


#4

In case you haven’t seen it there is an excellent tutorial of how to create an Android SQLite Content Provider at: http://www.vogella.com/tutorials/AndroidSQLite/article.html

According to [2] you would have to implement functions such as query(), insert(), update(), delete(), etc. to create a custom content provider.

In [3] there is a sample content provider where the results of query() are simply returned as a subclass of android.database.Cursor. I think you know certain SQLCipher database functions such as multiple versions of net.sqlcipher.database.SQLiteDatabase.rawQuery() would return the SELECT query results as a subclass of android.database.Cursor.

In case a content provider returns a Cursor object that does not use shared memory, I suspect the Android system would handle the data sharing. Or do you think I am mistaken here?

In case you think this is an issue you may want to raise it on GitHub.

[1] http://www.vogella.com/tutorials/AndroidSQLite/article.html
[2] http://www.vogella.com/tutorials/AndroidSQLite/article.html#custom-content-provider
[3] http://www.vogella.com/tutorials/AndroidSQLite/article.html#custom-content-provider


#5

Hi @Kyle, @brodybits,

@Kyle is correct in that we removed the ashmem component of the old library as mentioned in our prerelease and release annoucements for our Android N support; this was at the request of the Google Android team and is a requirement for running on Android N. We do not have plans to support that going forward.


#6

Thanks @developernotes. I think the original question whether or not SQLCipher 3.5.1 can be used to support an Android Content Provider is still not answered 10)%. I think it should be possible to use SQLCIpher for a content provider but would have to test it to confirm. I have no idea when I would get a chance to test this.