When you install, update, or uninstall an app on your Android device, several core system components work together behind the scenes. Two key players in this process are the Package Installer and the Android Package Manager (PM).
Let’s explore how these components work and interact to manage apps on your Android device.
What Is the Package Installer?
The Package Installer is the default system application responsible for installing APKs (Android application packages) on the device.
It handles both user-installed and system-installed apps, ensuring they are verified and properly configured before use.
Key Components of the Package Installer
- PackageInstaller – The main system responsible for installing applications.
- InstallAppProgress – An Activity launched by the Package Installer that captures user input (like confirming permissions or installation consent) during the installation process.
Important Classes Involved
PackageInstallerActivity.javaInstallAppProgress.javaPackageInstallerServiceinstalld(Linux daemon responsible for the actual installation process at the system level)
These components collectively handle everything from initiating an installation request to writing the final APK files to the device.
⚙️ Android Package Manager (PackageManager)
The Android Package Manager is an API that manages app installation, uninstallation, and upgrades.
It also maintains a registry of all installed applications and provides detailed metadata about each one.
In short, if the Package Installer is the app that executes installations, the Package Manager is the API that manages app-related data and system interactions.
🔍 What Happens When You Tap an App Icon
When you tap on any app icon:
- The Package Manager is invoked.
- It locates and parses the corresponding APK file.
- It initializes the app and launches the requested Activity.
For installations, the following method is typically invoked:
<package_manager_object>.installPackage(uri, flags, observer, packageNameToBeInstalled);
📁 Where Are APKs Stored?
Android keeps app files in two main directories depending on whether they’re system apps or user-installed apps.
| Type | Directory Path |
|---|---|
| Pre-installed (System apps) | /system/app/ |
| User-installed apps | /data/app/ |
These paths may vary slightly depending on Android version and device manufacturer.
💡 Working with PackageManager in Code
You can obtain a reference to the PackageManager using the following code snippet:
PackageManager pm = context.getPackageManager();
Once you have the PackageManager instance, you can query app details, permissions, activities, and more.
🧭 Example: Retrieve All Activities Matching a Given Intent
To find all the apps (and their activities) that can handle a specific intent, use:
List<ResolveInfo> resolvedActivityList =
pm.queryIntentActivities(<intent_object>, <queryFlag>);
ResolveInfo: Contains information about the resolved components such as Activities or Services from various applications.
For each ResolveInfo, you can extract Package Info like this:
PackageInfo packageInfo = pm.getPackageInfo(
resolveInfo.activityInfo.packageName,
PackageManager.GET_SIGNATURES
);
This helps developers inspect app metadata or identify compatible apps for specific intents — useful when building launchers, app pickers, or intent-based integrations.
📚 Summary
| Component | Purpose |
|---|---|
| Package Installer | Installs and manages the installation UI for APKs |
| InstallAppProgress | Captures user input during installation |
| Package Manager (API) | Manages install, uninstall, and app metadata |
| installd daemon | Handles low-level file operations during app installation |
🔗 Reference
Official Android Developer Documentation:
https://developer.android.com
