Unlocking All Apps: A Deeper Dive Into Android's App Info Settings

Ever found yourself digging through your Android phone's settings, trying to find that one specific app, only to realize a bunch of them are just… missing? It’s a common frustration, especially when you’re trying to manage storage, clear cache, or just get a full picture of what’s running on your device. For a while, the default view in Android 11’s Settings app, under 'Apps & notifications,' would show you a curated list, conveniently filtering out many built-in system apps and background services. While this might be helpful for everyday users, it left some wanting more control, a way to see everything.

This desire for a complete overview led to a specific need: a way to toggle the visibility of all applications within the App Info screen. Initially, the idea was to add a menu option in the top-right corner. However, after a bit of digging into the Android Open Source Project (AOSP) code, it turned out that adding a new menu item was a bit more involved than anticipated. The development team opted for a more straightforward approach: adding a button directly to the top of the screen.

Navigating to the App Info Screen

The journey to this screen often starts with a tap on 'Apps & notifications,' then selecting 'See all apps.' In Android 11, the code responsible for this initial display can be found in RecentAppsPreferenceController.java. Here, a listener is attached to a specific UI element, which, when clicked, launches the ManageApplications activity. This is the gateway to our App Info screen. The original thought might have been to duplicate this button, but the structure made it less than ideal. Instead, the focus shifted to how the list itself is presented.

The Title and Beyond

Once you launch the ManageApplications activity, the title of the screen is set. If no specific arguments are passed, it defaults to R.string.application_info_label, which is precisely what you see – 'App info.' The real magic, and the filtering logic, happens a bit deeper within the ManageApplications.java file. This activity handles various scenarios, like displaying storage usage or apps with usage access, but for a general app list, it sets the mListType to LIST_TYPE_MAIN.

Where the Data Comes From

The heart of the app list lies in the onCreateView method within the ManageApplications activity. Here, a RecyclerView is set up, and crucially, an ApplicationsAdapter is assigned to it. This adapter is the gatekeeper, responsible for fetching and displaying all the application data. The filtering logic, therefore, is intrinsically linked to this adapter and how it processes the list of apps.

The Filtering Mechanism

Digging into the rebuild() function within the adapter's related classes reveals how certain apps are excluded. There's a conditional check: if (!mManageApplications.mShowSystem). If this condition is true (meaning system apps are not set to be shown), then specific filters like ApplicationsState.FILTER_DOWNLOADED_AND_LAUNCHER or FILTER_DOWNLOADED_AND_LAUNCHER_AND_INSTANT are applied. This is the code that hides those system apps and background services by default.

Implementing the 'Show All' Button

To bring back the ability to see all apps, the solution involved modifying the layout file (manage_applications_apps.xml). A new Button with the ID show_all_apps was added. To ensure this new button doesn't overlap with the app list, a top margin was adjusted for the RecyclerView. The next step, of course, is to implement the logic for this button – making it toggle the mShowSystem flag and then trigger a refresh of the app list, thereby revealing all installed applications, system apps included. It’s a small change, but it significantly enhances user control over their device's app management.

Leave a Reply

Your email address will not be published. Required fields are marked *