use of android.content.pm.ActivityInfo in project android_frameworks_base by ParanoidAndroid.
the class InputManagerService method visitKeyboardLayout.
private void visitKeyboardLayout(String keyboardLayoutDescriptor, KeyboardLayoutVisitor visitor) {
KeyboardLayoutDescriptor d = KeyboardLayoutDescriptor.parse(keyboardLayoutDescriptor);
if (d != null) {
final PackageManager pm = mContext.getPackageManager();
try {
ActivityInfo receiver = pm.getReceiverInfo(new ComponentName(d.packageName, d.receiverName), PackageManager.GET_META_DATA);
visitKeyboardLayoutsInPackage(pm, receiver, d.keyboardLayoutName, visitor);
} catch (NameNotFoundException ex) {
}
}
}
use of android.content.pm.ActivityInfo in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method matchComponentForVerifier.
private ComponentName matchComponentForVerifier(String packageName, List<ResolveInfo> receivers) {
ActivityInfo targetReceiver = null;
final int NR = receivers.size();
for (int i = 0; i < NR; i++) {
final ResolveInfo info = receivers.get(i);
if (info.activityInfo == null) {
continue;
}
if (packageName.equals(info.activityInfo.packageName)) {
targetReceiver = info.activityInfo;
break;
}
}
if (targetReceiver == null) {
return null;
}
return new ComponentName(targetReceiver.packageName, targetReceiver.name);
}
use of android.content.pm.ActivityInfo in project android_frameworks_base by ParanoidAndroid.
the class PackageManagerService method queryIntentReceivers.
@Override
public List<ResolveInfo> queryIntentReceivers(Intent intent, String resolvedType, int flags, int userId) {
if (!sUserManager.exists(userId))
return Collections.emptyList();
ComponentName comp = intent.getComponent();
if (comp == null) {
if (intent.getSelector() != null) {
intent = intent.getSelector();
comp = intent.getComponent();
}
}
if (comp != null) {
List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
ActivityInfo ai = getReceiverInfo(comp, flags, userId);
if (ai != null) {
ResolveInfo ri = new ResolveInfo();
ri.activityInfo = ai;
list.add(ri);
}
return list;
}
// reader
synchronized (mPackages) {
String pkgName = intent.getPackage();
if (pkgName == null) {
return mReceivers.queryIntent(intent, resolvedType, flags, userId);
}
final PackageParser.Package pkg = mPackages.get(pkgName);
if (pkg != null) {
return mReceivers.queryIntentForPackage(intent, resolvedType, flags, pkg.receivers, userId);
}
return null;
}
}
use of android.content.pm.ActivityInfo in project android_frameworks_base by ParanoidAndroid.
the class UsbSettingsManager method handlePackageUpdate.
// Check to see if the package supports any USB devices or accessories.
// If so, clear any non-matching preferences for matching devices/accessories.
private void handlePackageUpdate(String packageName) {
synchronized (mLock) {
PackageInfo info;
boolean changed = false;
try {
info = mPackageManager.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA);
} catch (NameNotFoundException e) {
Slog.e(TAG, "handlePackageUpdate could not find package " + packageName, e);
return;
}
ActivityInfo[] activities = info.activities;
if (activities == null)
return;
for (int i = 0; i < activities.length; i++) {
// check for meta-data, both for devices and accessories
if (handlePackageUpdateLocked(packageName, activities[i], UsbManager.ACTION_USB_DEVICE_ATTACHED)) {
changed = true;
}
if (handlePackageUpdateLocked(packageName, activities[i], UsbManager.ACTION_USB_ACCESSORY_ATTACHED)) {
changed = true;
}
}
if (changed) {
writeSettingsLocked();
}
}
}
use of android.content.pm.ActivityInfo in project android_frameworks_base by ParanoidAndroid.
the class Searchables method findWebSearchActivity.
/**
* Finds the web search activity.
*
* Only looks in the package of the global search activity.
*/
private ComponentName findWebSearchActivity(ComponentName globalSearchActivity) {
if (globalSearchActivity == null) {
return null;
}
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.setPackage(globalSearchActivity.getPackageName());
List<ResolveInfo> activities = queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
if (activities != null && !activities.isEmpty()) {
ActivityInfo ai = activities.get(0).activityInfo;
// TODO: do some sanity checks here?
return new ComponentName(ai.packageName, ai.name);
}
Log.w(LOG_TAG, "No web search activity found");
return null;
}
Aggregations