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);
}
}
}
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;
}
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;
}
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);
}
}
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();
}
}
Aggregations