Stay organized with collections
Save and categorize content based on your preferences.
If your app relies on interactions with other apps to complete its use cases,
it's useful to test how package visibility
changes in Android 11 (API level 30) and higher affect your app.
This guide also gives some suggestions on how to test the behavior changes
and helps you configure log messages to determine at a more granular
level how your app might be affected.
Test the behavior changes
To test whether this behavior change affects your app, complete the
following steps:
Introduce appropriate <queries>
entries to fix those features.
Configure log messages for package filtering
To discover more details about how the default visibility of apps affects your
app, you can enable log messages for package filtering. If you're developing a
test app or debuggable app in Android Studio, the system log provides this
capability for you. Otherwise, you can run the
following command in a terminal window to enable it manually:
adb shell pm log-visibility --enable PACKAGE_NAME
Then, whenever packages are filtered out of a PackageManager object's return
values, you see a message similar to the following in Logcat:
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-26 UTC."],[],[],null,["If your app relies on interactions with other apps to complete its use cases,\nit's useful to test how [package visibility](/training/package-visibility)\nchanges in Android 11 (API level 30) and higher affect your app.\n\nThis guide also gives some suggestions on how to test the behavior changes\nand helps you configure log messages to determine at a more granular\nlevel how your app might be affected.\n\nTest the behavior changes\n\nTo test whether this behavior change affects your app, complete the\nfollowing steps:\n\n1. Install [Android Studio 3.6.1](/studio) or higher.\n2. Install the latest version of Gradle that Android Studio supports.\n3. Set your app's `targetSdkVersion` to `30` or higher.\n4. Don't include the `\u003cqueries\u003e` element in your app's manifest file.\n5. Call [`getInstalledApplications()`](/reference/android/content/pm/PackageManager#getInstalledApplications(int)) or [`getInstalledPackages()`](/reference/android/content/pm/PackageManager#getInstalledPackages(int)). Both methods return a filtered list when they are successful.\n6. See which features of your app aren't working.\n7. Introduce appropriate [`\u003cqueries\u003e`](/guide/topics/manifest/queries-element) entries to fix those features.\n\nConfigure log messages for package filtering\n\nTo discover more details about how the default visibility of apps affects your\napp, you can enable log messages for package filtering. If you're developing a\ntest app or debuggable app in Android Studio, the [system log provides this\ncapability](/studio/debug#systemLog) for you. Otherwise, you can run the\nfollowing command in a terminal window to enable it manually: \n\n```\nadb shell pm log-visibility --enable PACKAGE_NAME\n```\n\nThen, whenever packages are filtered out of a `PackageManager` object's return\nvalues, you see a message similar to the following in Logcat: \n\n```\nI/AppsFilter: interaction: PackageSetting{7654321 \\\n com.example.myapp/12345} -\u003e PackageSetting{...} BLOCKED\n```\n| **Caution:** Your app's performance is affected when this flag is enabled. Unless you're testing how package visibility affects your app, disable the logging of messages related to package visibility."]]