package com.tatssense.sampleapp;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.ResolveInfo;

public class Util {

	public static void packageAnalysis(Context context){
		PackageManager pm = context.getPackageManager();
		try {
			PackageInfo pi = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES);
			PackageInfo pi1 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_CONFIGURATIONS);
			PackageInfo pi2 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_DISABLED_COMPONENTS);
			PackageInfo pi3 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
			PackageInfo pi4 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_GIDS);
			PackageInfo pi5 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_INSTRUMENTATION);
			PackageInfo pi6 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_INTENT_FILTERS);
			PackageInfo pi7 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_META_DATA);
			PackageInfo pi8 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_PERMISSIONS);
			PackageInfo pi9 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_PROVIDERS);
			PackageInfo pi10 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_RECEIVERS);
			PackageInfo pi11 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_RESOLVED_FILTER);
			PackageInfo pi12 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_SERVICES);
			PackageInfo pi13 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_SHARED_LIBRARY_FILES);
			PackageInfo pi14 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_SIGNATURES);
			PackageInfo pi15 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_UNINSTALLED_PACKAGES);
			PackageInfo pi16 = pm.getPackageInfo(context.getPackageName(), PackageManager.GET_URI_PERMISSION_PATTERNS);
			
			
			Intent intent = null;
			final PackageManager packageManager = context.getPackageManager();
			for(final ResolveInfo resolveInfo:packageManager.queryIntentActivities(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME), PackageManager.MATCH_DEFAULT_ONLY))
			{
			    if(!context.getPackageName().equals(resolveInfo.activityInfo.packageName))  //if this activity is not in our activity (in other words, it's another default home screen)
			    {
			        intent= packageManager.getLaunchIntentForPackage(context.getPackageName());
			        break;
			    }
			}
			
			
			System.out.println();
			
		} catch (NameNotFoundException e) {
			e.printStackTrace();
		}
	}

}
