Search in sources :

Example 66 with ActivityInfo

use of android.content.pm.ActivityInfo in project DroidPlugin by DroidPluginTeam.

the class PluginInstrumentation method onActivityDestory.

private void onActivityDestory(Activity activity) throws RemoteException {
    Intent targetIntent = activity.getIntent();
    if (targetIntent != null) {
        ActivityInfo targetInfo = targetIntent.getParcelableExtra(Env.EXTRA_TARGET_INFO);
        ActivityInfo stubInfo = targetIntent.getParcelableExtra(Env.EXTRA_STUB_INFO);
        if (targetInfo != null && stubInfo != null) {
            PluginManager.getInstance().onActivityDestory(stubInfo, targetInfo);
        }
    }
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) Intent(android.content.Intent)

Example 67 with ActivityInfo

use of android.content.pm.ActivityInfo in project DroidPlugin by DroidPluginTeam.

the class PluginPackageParser method getActivityInfo.

public ActivityInfo getActivityInfo(ComponentName className, int flags) throws Exception {
    Object data;
    synchronized (mActivityObjCache) {
        data = mActivityObjCache.get(className);
    }
    if (data != null) {
        ActivityInfo activityInfo = mParser.generateActivityInfo(data, flags);
        fixApplicationInfo(activityInfo.applicationInfo);
        if (TextUtils.isEmpty(activityInfo.processName)) {
            activityInfo.processName = activityInfo.packageName;
        }
        return activityInfo;
    }
    return null;
}
Also used : ActivityInfo(android.content.pm.ActivityInfo)

Example 68 with ActivityInfo

use of android.content.pm.ActivityInfo in project DroidPlugin by DroidPluginTeam.

the class PluginPackageParser method getReceiverInfo.

public ActivityInfo getReceiverInfo(ComponentName className, int flags) throws Exception {
    Object data;
    synchronized (mReceiversObjCache) {
        data = mReceiversObjCache.get(className);
    }
    if (data != null) {
        ActivityInfo activityInfo = mParser.generateReceiverInfo(data, flags);
        fixApplicationInfo(activityInfo.applicationInfo);
        if (TextUtils.isEmpty(activityInfo.processName)) {
            activityInfo.processName = activityInfo.packageName;
        }
        return activityInfo;
    }
    return null;
}
Also used : ActivityInfo(android.content.pm.ActivityInfo)

Example 69 with ActivityInfo

use of android.content.pm.ActivityInfo in project android_packages_apps_Launcher2 by CyanogenMod.

the class InstallShortcutReceiver method onReceive.

public void onReceive(Context context, Intent data) {
    if (!ACTION_INSTALL_SHORTCUT.equals(data.getAction())) {
        return;
    }
    Intent intent = data.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
    if (intent == null) {
        return;
    }
    // This name is only used for comparisons and notifications, so fall back to activity name
    // if not supplied
    String name = data.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
    if (name == null) {
        try {
            PackageManager pm = context.getPackageManager();
            ActivityInfo info = pm.getActivityInfo(intent.getComponent(), 0);
            name = info.loadLabel(pm).toString();
        } catch (PackageManager.NameNotFoundException nnfe) {
            return;
        }
    }
    // Queue the item up for adding if launcher has not loaded properly yet
    boolean launcherNotLoaded = LauncherModel.getCellCountX() <= 0 || LauncherModel.getCellCountY() <= 0;
    PendingInstallShortcutInfo info = new PendingInstallShortcutInfo(data, name, intent);
    if (mUseInstallQueue || launcherNotLoaded) {
        mInstallQueue.add(info);
    } else {
        processInstallShortcut(context, info);
    }
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent)

Example 70 with ActivityInfo

use of android.content.pm.ActivityInfo in project android_frameworks_base by DirtyUnicorns.

the class ChooserActivity method queryTargetServices.

void queryTargetServices(ChooserListAdapter adapter) {
    final PackageManager pm = getPackageManager();
    int targetsToQuery = 0;
    for (int i = 0, N = adapter.getDisplayResolveInfoCount(); i < N; i++) {
        final DisplayResolveInfo dri = adapter.getDisplayResolveInfo(i);
        if (adapter.getScore(dri) == 0) {
            // don't query it as it's not likely to be relevant.
            continue;
        }
        final ActivityInfo ai = dri.getResolveInfo().activityInfo;
        final Bundle md = ai.metaData;
        final String serviceName = md != null ? convertServiceName(ai.packageName, md.getString(ChooserTargetService.META_DATA_NAME)) : null;
        if (serviceName != null) {
            final ComponentName serviceComponent = new ComponentName(ai.packageName, serviceName);
            final Intent serviceIntent = new Intent(ChooserTargetService.SERVICE_INTERFACE).setComponent(serviceComponent);
            if (DEBUG) {
                Log.d(TAG, "queryTargets found target with service " + serviceComponent);
            }
            try {
                final String perm = pm.getServiceInfo(serviceComponent, 0).permission;
                if (!ChooserTargetService.BIND_PERMISSION.equals(perm)) {
                    Log.w(TAG, "ChooserTargetService " + serviceComponent + " does not require" + " permission " + ChooserTargetService.BIND_PERMISSION + " - this service will not be queried for ChooserTargets." + " add android:permission=\"" + ChooserTargetService.BIND_PERMISSION + "\"" + " to the <service> tag for " + serviceComponent + " in the manifest.");
                    continue;
                }
            } catch (NameNotFoundException e) {
                Log.e(TAG, "Could not look up service " + serviceComponent + "; component name not found");
                continue;
            }
            final ChooserTargetServiceConnection conn = new ChooserTargetServiceConnection(this, dri);
            // user handle
            if (bindServiceAsUser(serviceIntent, conn, BIND_AUTO_CREATE | BIND_NOT_FOREGROUND, Process.myUserHandle())) {
                if (DEBUG) {
                    Log.d(TAG, "Binding service connection for target " + dri + " intent " + serviceIntent);
                }
                mServiceConnections.add(conn);
                targetsToQuery++;
            }
        }
        if (targetsToQuery >= QUERY_TARGET_SERVICE_LIMIT) {
            if (DEBUG)
                Log.d(TAG, "queryTargets hit query target limit " + QUERY_TARGET_SERVICE_LIMIT);
            break;
        }
    }
    if (!mServiceConnections.isEmpty()) {
        if (DEBUG)
            Log.d(TAG, "queryTargets setting watchdog timer for " + WATCHDOG_TIMEOUT_MILLIS + "ms");
        mChooserHandler.sendEmptyMessageDelayed(CHOOSER_TARGET_SERVICE_WATCHDOG_TIMEOUT, WATCHDOG_TIMEOUT_MILLIS);
    } else {
        sendVoiceChoicesIfNeeded();
    }
}
Also used : ActivityInfo(android.content.pm.ActivityInfo) PackageManager(android.content.pm.PackageManager) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) Bundle(android.os.Bundle) ComponentName(android.content.ComponentName) LabeledIntent(android.content.pm.LabeledIntent) Intent(android.content.Intent)

Aggregations

ActivityInfo (android.content.pm.ActivityInfo)886 ResolveInfo (android.content.pm.ResolveInfo)360 Intent (android.content.Intent)339 ComponentName (android.content.ComponentName)324 PackageManager (android.content.pm.PackageManager)215 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)141 ArrayList (java.util.ArrayList)139 ApplicationInfo (android.content.pm.ApplicationInfo)115 Test (org.junit.Test)113 RemoteException (android.os.RemoteException)82 Bundle (android.os.Bundle)68 PendingIntent (android.app.PendingIntent)62 Drawable (android.graphics.drawable.Drawable)61 IOException (java.io.IOException)60 PackageInfo (android.content.pm.PackageInfo)59 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)54 XmlResourceParser (android.content.res.XmlResourceParser)43 Point (android.graphics.Point)35 SystemServicesProxy (com.android.systemui.recents.misc.SystemServicesProxy)34 Context (android.content.Context)33