Thursday, 1 October 2020

Is there any way to detect to which apps I can/can't reach their "app-info" screen?

Background

You can get a list of installed apps using PackageManager.getInstalledPackages.

And, you can reach the app-info screen of each app via :

val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:$appPackageName"))
startActivity(intent)

Example:

enter image description here

The problem

Thing is, I've noticed (after someone told me) that for some apps, you can't reach their app-info screen. Example of such package-names of those apps: "com.google.android.ext.services" ("Android Services Library") , "com.google.mainline.tememetry" ("Support components"), com.google.android.modulemetadata" (Main components") . Maybe more.

After reporting it to Google, I was told:

com.google.android.ext.services is mainline module, so Settings doesn't provide detail app info for it.

What I've tried

I've tried to look at various fields and functions of PackageInfo and ApplicationInfo.

I've found "isApex", but it seems to be always false, and the docs don't help about understanding what it is, at all ("Whether the package is an APEX package") .

I've also found a private boolean field (that I can reach via reflection) called "coreApp" , and indeed it's sometimes true, but it's not always that when it's true, it means I can't reach it's app-info screen.

This is the code to get it:

    fun isProbablyCoreApp(packageInfo: PackageInfo): Boolean {
        return try {
            val field = PackageInfo::class.java.getField("coreApp")
            field.getBoolean(packageInfo)
        } catch (e: Throwable) {
            false
        }
    }

The questions

  1. What does it mean "mainline module" ? It's a part of the OS that gets updated on its own? Related to "project mainline" of Android 10 and above ?
  2. Why couldn't I reach its app-info? It's not a real app? But if not, how come it's listed as a part of the list of apps?
  3. Is there any way to detect that an installed app is in fact a module that you can't reach its app-info screen ? How does the UI of the OS filters out those apps from its list?
  4. Are there more cases of apps that I can't reach their app-info screen?


from Is there any way to detect to which apps I can/can't reach their "app-info" screen?

No comments:

Post a Comment