getContentResolver(); mPackageName = context.getPackageName(); // Callers can access filename columns when targeting old platform // versions; otherwise we throw telling them it's deprecated. mAccessFilename = context.getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.N; } ...
我们需要使用getApplicationInfo(java.lang.String,android.content.pm.PackageManager.ApplicationInfoFlags)
从API 24的源码可以看到,其实GET_UNINSTALLED_PACKAGES标志仅仅用于查询在手机系统分区存在数据目录的应用: /** * @deprecated replaced with {@link #MATCH_UNINSTALLED_PACKAGES} */ @Deprecated public static final int GET_UNINSTALLED_PACKAGES = 0x00002000; /** * Flag parameter to retrieve some information...