Search in sources :

Example 96 with ResolveInfo

use of android.content.pm.ResolveInfo in project c-geo by just-radovan.

the class cgBase method isIntentAvailable.

public static boolean isIntentAvailable(Context context, Intent intent) {
    final PackageManager packageManager = context.getPackageManager();
    final List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return (list.size() > 0);
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager)

Example 97 with ResolveInfo

use of android.content.pm.ResolveInfo in project k-9 by k9mail.

the class Accounts method onImport.

private void onImport() {
    Intent i = new Intent(Intent.ACTION_GET_CONTENT);
    i.addCategory(Intent.CATEGORY_OPENABLE);
    i.setType("*/*");
    PackageManager packageManager = getPackageManager();
    List<ResolveInfo> infos = packageManager.queryIntentActivities(i, 0);
    if (infos.size() > 0) {
        startActivityForResult(Intent.createChooser(i, null), ACTIVITY_REQUEST_PICK_SETTINGS_FILE);
    } else {
        showDialog(DIALOG_NO_FILE_MANAGER);
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent)

Example 98 with ResolveInfo

use of android.content.pm.ResolveInfo in project superCleanMaster by joyoyao.

the class BootStartUtils method fetchAutoApps.

public static List<AutoStartInfo> fetchAutoApps(Context mContext) {
    PackageManager pm = mContext.getPackageManager();
    Intent intent = new Intent(Intent.ACTION_BOOT_COMPLETED);
    List<ResolveInfo> resolveInfoList = pm.queryBroadcastReceivers(intent, PackageManager.GET_DISABLED_COMPONENTS);
    List<AutoStartInfo> appList = new ArrayList<AutoStartInfo>();
    String appName = null;
    String packageReceiver = null;
    Drawable icon = null;
    boolean isSystem = false;
    boolean isenable = true;
    if (resolveInfoList.size() > 0) {
        appName = resolveInfoList.get(0).loadLabel(pm).toString();
        packageReceiver = resolveInfoList.get(0).activityInfo.packageName + "/" + resolveInfoList.get(0).activityInfo.name;
        icon = resolveInfoList.get(0).loadIcon(pm);
        ComponentName mComponentName1 = new ComponentName(resolveInfoList.get(0).activityInfo.packageName, resolveInfoList.get(0).activityInfo.name);
        if (pm.getComponentEnabledSetting(mComponentName1) == 2) {
            isenable = false;
        } else {
            isenable = true;
        }
        if ((resolveInfoList.get(0).activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
            isSystem = true;
        } else {
            isSystem = false;
        }
        for (int i = 1; i < resolveInfoList.size(); i++) {
            AutoStartInfo mAutoStartInfo = new AutoStartInfo();
            if (appName.equals(resolveInfoList.get(i).loadLabel(pm).toString())) {
                packageReceiver = packageReceiver + ";" + resolveInfoList.get(i).activityInfo.packageName + "/" + resolveInfoList.get(i).activityInfo.name;
            } else {
                mAutoStartInfo.setLabel(appName);
                mAutoStartInfo.setSystem(isSystem);
                mAutoStartInfo.setEnable(isenable);
                mAutoStartInfo.setIcon(icon);
                mAutoStartInfo.setPackageReceiver(packageReceiver);
                appList.add(mAutoStartInfo);
                appName = resolveInfoList.get(i).loadLabel(pm).toString();
                packageReceiver = resolveInfoList.get(i).activityInfo.packageName + "/" + resolveInfoList.get(i).activityInfo.name;
                icon = resolveInfoList.get(i).loadIcon(pm);
                ComponentName mComponentName2 = new ComponentName(resolveInfoList.get(i).activityInfo.packageName, resolveInfoList.get(i).activityInfo.name);
                if (pm.getComponentEnabledSetting(mComponentName2) == 2) {
                    isenable = false;
                } else {
                    isenable = true;
                }
                if ((resolveInfoList.get(i).activityInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                    isSystem = true;
                } else {
                    isSystem = false;
                }
            }
        }
        AutoStartInfo mAutoStartInfo = new AutoStartInfo();
        mAutoStartInfo.setLabel(appName);
        mAutoStartInfo.setSystem(isSystem);
        mAutoStartInfo.setEnable(isenable);
        mAutoStartInfo.setIcon(icon);
        mAutoStartInfo.setPackageReceiver(packageReceiver);
        appList.add(mAutoStartInfo);
    }
    return appList;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) AutoStartInfo(com.yzy.supercleanmaster.model.AutoStartInfo) PackageManager(android.content.pm.PackageManager) ArrayList(java.util.ArrayList) Drawable(android.graphics.drawable.Drawable) Intent(android.content.Intent) ComponentName(android.content.ComponentName)

Example 99 with ResolveInfo

use of android.content.pm.ResolveInfo in project Android by hmkcode.

the class MainActivity method hasDefualtCameraApp.

// method to check you have Camera Apps
private boolean hasDefualtCameraApp(String action) {
    final PackageManager packageManager = getPackageManager();
    final Intent intent = new Intent(action);
    List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
    return list.size() > 0;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent)

Example 100 with ResolveInfo

use of android.content.pm.ResolveInfo in project LollipopShowcase by mikepenz.

the class DetailActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    mCoordinatorLayout = (CoordinatorLayout) findViewById(R.id.container);
    mRowContainer = (LinearLayout) findViewById(R.id.row_container);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("");
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    // Handle Back Navigation :D
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            DetailActivity.this.onBackPressed();
        }
    });
    // Fab Button
    FloatingActionButton floatingActionButton = (FloatingActionButton) findViewById(R.id.fab_normal);
    floatingActionButton.setImageDrawable(new IconicsDrawable(this, GoogleMaterial.Icon.gmd_file_upload).color(Color.WHITE).actionBar());
    floatingActionButton.setOnClickListener(fabClickListener);
    for (int i = 1; i < mRowContainer.getChildCount(); i++) {
        View rowView = mRowContainer.getChildAt(i);
        rowView.animate().setStartDelay(100 + i * SCALE_DELAY).scaleX(1).scaleY(1);
    }
    ComponentName componentName = null;
    if (savedInstanceState != null) {
        componentName = savedInstanceState.getParcelable("appInfo");
    } else if (getIntent() != null && getIntent().getExtras() != null) {
        componentName = (ComponentName) getIntent().getExtras().get("appInfo");
    }
    if (componentName != null) {
        Intent intent = new Intent();
        intent.setComponent(componentName);
        ResolveInfo app = getPackageManager().resolveActivity(intent, 0);
        mAppInfo = new AppInfo(this, app);
    }
    if (mAppInfo != null) {
        //toolbar.setLogo(mAppInfo.getIcon());
        toolbar.setTitle(mAppInfo.getName());
        View view = mRowContainer.findViewById(R.id.row_name);
        fillRow(view, "Application Name", mAppInfo.getName());
        ((ImageView) view.findViewById(R.id.appIcon)).setImageDrawable(mAppInfo.getIcon());
        view = mRowContainer.findViewById(R.id.row_package_name);
        fillRow(view, "Package Name", mAppInfo.getPackageName());
        view = mRowContainer.findViewById(R.id.row_activity);
        fillRow(view, "Activity", mAppInfo.getActivityName());
        view = mRowContainer.findViewById(R.id.row_component_info);
        fillRow(view, "ComponentInfo", mAppInfo.getComponentInfo());
        view = mRowContainer.findViewById(R.id.row_version);
        fillRow(view, "Version", mAppInfo.getVersionName() + " (" + mAppInfo.getVersionCode() + ")");
        view = mRowContainer.findViewById(R.id.row_moments);
        fillRow(view, "Moments", "First installed: " + new Date(mAppInfo.getFirstInstallTime()) + "\nLast updated: " + new Date(mAppInfo.getLastUpdateTime()));
    }
}
Also used : Intent(android.content.Intent) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Date(java.util.Date) AppInfo(com.mikepenz.lollipopshowcase.entity.AppInfo) ResolveInfo(android.content.pm.ResolveInfo) FloatingActionButton(android.support.design.widget.FloatingActionButton) ComponentName(android.content.ComponentName) ImageView(android.widget.ImageView) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

ResolveInfo (android.content.pm.ResolveInfo)1196 Intent (android.content.Intent)746 PackageManager (android.content.pm.PackageManager)458 ComponentName (android.content.ComponentName)375 ArrayList (java.util.ArrayList)204 ActivityInfo (android.content.pm.ActivityInfo)203 PendingIntent (android.app.PendingIntent)159 RemoteException (android.os.RemoteException)137 ServiceInfo (android.content.pm.ServiceInfo)120 ApplicationInfo (android.content.pm.ApplicationInfo)72 EphemeralResolveInfo (android.content.pm.EphemeralResolveInfo)58 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)53 Bundle (android.os.Bundle)47 HashMap (java.util.HashMap)44 IOException (java.io.IOException)43 HashSet (java.util.HashSet)43 Point (android.graphics.Point)42 PackageInfo (android.content.pm.PackageInfo)37 ActivityNotFoundException (android.content.ActivityNotFoundException)33 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)33