UPDATE: I have to completely change my question since I found more details related to my problem.
The problem: My app that resolves Content Provider doesn't work in Emulator with API 30. The error:
java.lang.SecurityException: Failed to find provider com.a52.datafeeder01.MyProvider for user 0; expected to find a valid ContentProvider for this authority
If I use APIs 26,27,28 and 29 then there is no problem.
AndroidManifest.xml in app with ContentProvider:
<manifest>
<permission
android:name="MyProvider._READ_PERMISSION"
android:protectionLevel="normal" />
<application>
<activity>
...
</activity>
<provider android:name=".MyProvider"
android:authorities="com.a52.datafeeder01.MyProvider"
android:enabled="true"
android:exported="true"
android:readPermission="MyProvider._READ_PERMISSION"/>
</application>
</manifest>
AndroidManifest.xml in client app :
<manifest>
...
<uses-permission android:name="MyProvider._READ_PERMISSION" />
...
</manifest>
If I try to resolve Content Provider in the same app, it works.
If I use packageManager.getInstalledPackages(PackageManager.GET_PROVIDERS)
in my client code to get list of existing providers then for APIs [26,29] I can see my provider in the list. If I run this code in API 30 my provider is not in the list.
It seems that something was changed in API 30 related to registration of ContentProvider. However I can't find what.
queries
made my ContentProvider work in all APIs again. – Amperage