I am migrating my Android app to be TargetSDK 30 compliant. One of the limitations\changes for this is the package visibility restrictions: https://developer.android.com/about/versions/11/privacy/package-visibility
and google requires the apps to declare the queries element in the manifest like so:
<queries>
<!-- Specific apps you interact with, eg: -->
<package android:name="packageid" />
Without this entry, function calls like
context.getPackageManager.getApplicationInfo("packageid",0);
will result in a NameNotFouncException
.
I have verified this to be true for most apps which I explicitly query including the google maps app and adding those app's package id to the manifest resolves the issue.
However I saw that calling this function for the gms packageId: viz
context.getPackageManager.getApplicationInfo("com.google.android.gms",0)
I did NOT need to declare it in the <queries>
as part of the manifest!! The functions returned correct value despite the app being migrated to targetSdk = 30 and running on Android-11/Android-12 device.
I thought some of the android libraries are auto-injecting the <queries>
for com.google.android.gms
via manifest merger, but decompiling the manifest revealed no such entries.
I am curious to know why this package is skipped from the tarsget30 SDK package visibility restrictions and if there are any other such packages. Is this a bug or an undocumented feature?