Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does QUERY_ALL_PACKAGES permission do?

Android R Preview 1 introduced a new permission called QUERY_ALL_PACKAGES. The documentation for the permission says the following:

Allows query of any normal app on the device, regardless of manifest declarations.

Has anyone worked out what this actually does?

I've tried running the following on the emulator image, and the permission had no effect on either of them:

  • packageManager.queryIntentActivities(intent, 0)
  • packageManager.getInstalledPackages(0)
like image 461
Sam Avatar asked Mar 14 '20 04:03

Sam


People also ask

What does READ_PHONE_STATE permission do?

READ_PHONE_STATE is one of the Android permissions categorized as dangerous. This is because it “allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any Phone Accounts registered on the device” [2] .

What is Query_all_packages permission?

The QUERY_ALL_PACKAGES permission only takes effect when your app targets Android API level 30 or later on devices running Android 11 or later. To use this permission, your app must fall within permitted uses below, and have a core purpose to search for all apps on the device.

What is the main purpose of runtime permission?

Users are prompted by the runtime permissions dialog to either always allow, allow while in use, or deny permissions. On an OS upgrade to Android 10, permissions given to apps are retained, but users can go into Settings and change them.

What is the purpose of setting the user permission for Access_fine_location?

If your app needs to access the user's location, you must request permission by adding the relevant Android location permissions to your app. Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION . The permission you choose determines the accuracy of the location returned by the API.


2 Answers

Even when permission QUERY_ALL_PACKAGES is added, you still need to add <queries> filter to your AndroidManifest.

E.g. for the launcher app it might be:

<permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<queries>
    <intent>
        <action android:name="android.intent.action.MAIN" />
    </intent>
</queries>
like image 134
Flovettee Avatar answered Oct 27 '22 19:10

Flovettee


Android 11 introduces changes related to package visibility. These changes affect apps only if they target Android 11. For more information on these changes, view the guides about package visibility on Android.

https://developer.android.com/training/package-visibility

https://developer.android.com/about/versions/11/privacy/package-visibility

https://developer.android.com/training/package-visibility

For my case, Cordova-android 10.1.1, targetSdkVersion 30

I added

 <queries>
                <package android:name="com.google.android.gm" />
                <package android:name="com.facebook.katana" />
                <intent>
                    <action android:name="android.intent.action.VIEW" />
                    <data android:scheme="https" />
                </intent>
                <intent>
                    <action android:name="android.intent.action.DIAL" />
                    <data android:scheme="tel" />
                </intent>
                <intent>
                    <action android:name="android.intent.action.SEND" />
                    <data android:mimeType="*/*" />
                </intent>
            </queries>

in AndroidManifest.xml

like image 44
Chen Litchian Avatar answered Oct 27 '22 21:10

Chen Litchian