Code example for PackageManager

Methods: getApplicationInfo

0
     * available and that it's installed in the device's system image. 
     */ 
    public void testSettingsHookTestAppAvailable() throws Exception { 
        Context context = mSettings.getApplicationContext();
        PackageManager pm = context.getPackageManager();
        ApplicationInfo applicationInfo = pm.getApplicationInfo(PACKAGE_NAME, 0);
        assertTrue((applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
    } 
 
    /** 
     * Test that the operator test activity has registered an intent-filter for 
     * an action named 'android.settings.OPERATOR_APPLICATION_SETTING'. 
     */ 
    public void testOperatorIntentFilter() { 
        boolean result = false;
        Context context = mSettings.getApplicationContext();
        PackageManager pm = context.getPackageManager();
        Intent intent = new Intent(INTENT_OPERATOR_HOOK);
        List<ResolveInfo> list = pm.queryIntentActivities(intent, 0);
        for (ResolveInfo resolveInfo : list) {
            if (resolveInfo.activityInfo.packageName.equals(PACKAGE_NAME)) {