Search in sources :

Example 81 with ServiceInfo

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

the class PackageManagerService method queryIntentServicesInternal.

@NonNull
private List<ResolveInfo> queryIntentServicesInternal(Intent intent, String resolvedType, int flags, int userId) {
    if (!sUserManager.exists(userId))
        return Collections.emptyList();
    flags = updateFlagsForResolve(flags, userId, intent);
    ComponentName comp = intent.getComponent();
    if (comp == null) {
        if (intent.getSelector() != null) {
            intent = intent.getSelector();
            comp = intent.getComponent();
        }
    }
    if (comp != null) {
        final List<ResolveInfo> list = new ArrayList<ResolveInfo>(1);
        final ServiceInfo si = getServiceInfo(comp, flags, userId);
        if (si != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.serviceInfo = si;
            list.add(ri);
        }
        return list;
    }
    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mServices.queryIntent(intent, resolvedType, flags, userId);
        }
        final PackageParser.Package pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mServices.queryIntentForPackage(intent, resolvedType, flags, pkg.services, userId);
        }
        return Collections.emptyList();
    }
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) ServiceInfo(android.content.pm.ServiceInfo) PackageParser(android.content.pm.PackageParser) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) NonNull(android.annotation.NonNull)

Example 82 with ServiceInfo

use of android.content.pm.ServiceInfo in project android_frameworks_base by ParanoidAndroid.

the class InputMethodInfo method buildDummyResolveInfo.

private static ResolveInfo buildDummyResolveInfo(String packageName, String className, CharSequence label) {
    ResolveInfo ri = new ResolveInfo();
    ServiceInfo si = new ServiceInfo();
    ApplicationInfo ai = new ApplicationInfo();
    ai.packageName = packageName;
    ai.enabled = true;
    si.applicationInfo = ai;
    si.enabled = true;
    si.packageName = packageName;
    si.name = className;
    si.exported = true;
    si.nonLocalizedLabel = label;
    ri.serviceInfo = si;
    return ri;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) ServiceInfo(android.content.pm.ServiceInfo) ApplicationInfo(android.content.pm.ApplicationInfo)

Example 83 with ServiceInfo

use of android.content.pm.ServiceInfo in project android_frameworks_base by ParanoidAndroid.

the class MetaDataTest method testServiceWithData.

@SmallTest
public void testServiceWithData() throws Exception {
    ComponentName cn = new ComponentName(mContext, LocalService.class);
    ServiceInfo si = mContext.getPackageManager().getServiceInfo(cn, PackageManager.GET_META_DATA);
    checkMetaData(cn, si);
    si = mContext.getPackageManager().getServiceInfo(cn, 0);
    assertNull("Meta data returned when not requested", si.metaData);
}
Also used : ServiceInfo(android.content.pm.ServiceInfo) ComponentName(android.content.ComponentName) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 84 with ServiceInfo

use of android.content.pm.ServiceInfo in project android_frameworks_base by AOSPA.

the class InputMethodUtilsTest method createDummyInputMethodInfo.

private static InputMethodInfo createDummyInputMethodInfo(String packageName, String name, CharSequence label, boolean isAuxIme, boolean isDefault, List<InputMethodSubtype> subtypes) {
    final ResolveInfo ri = new ResolveInfo();
    final ServiceInfo si = new ServiceInfo();
    final ApplicationInfo ai = new ApplicationInfo();
    ai.packageName = packageName;
    ai.enabled = true;
    ai.flags |= ApplicationInfo.FLAG_SYSTEM;
    si.applicationInfo = ai;
    si.enabled = true;
    si.packageName = packageName;
    si.name = name;
    si.exported = true;
    si.nonLocalizedLabel = label;
    ri.serviceInfo = si;
    return new InputMethodInfo(ri, isAuxIme, "", subtypes, 1, isDefault);
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) ServiceInfo(android.content.pm.ServiceInfo) ApplicationInfo(android.content.pm.ApplicationInfo) InputMethodInfo(android.view.inputmethod.InputMethodInfo)

Example 85 with ServiceInfo

use of android.content.pm.ServiceInfo in project android_frameworks_base by AOSPA.

the class BackupManagerService method checkForTransportAndBind.

// Check whether the given package hosts a transport, and bind if so
void checkForTransportAndBind(PackageInfo pkgInfo) {
    Intent intent = new Intent(mTransportServiceIntent).setPackage(pkgInfo.packageName);
    // TODO: http://b/22388012
    List<ResolveInfo> hosts = mPackageManager.queryIntentServicesAsUser(intent, 0, UserHandle.USER_SYSTEM);
    if (hosts != null) {
        final int N = hosts.size();
        for (int i = 0; i < N; i++) {
            final ServiceInfo info = hosts.get(i).serviceInfo;
            tryBindTransport(info);
        }
    }
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) ServiceInfo(android.content.pm.ServiceInfo) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Aggregations

ServiceInfo (android.content.pm.ServiceInfo)238 ResolveInfo (android.content.pm.ResolveInfo)120 Intent (android.content.Intent)99 ComponentName (android.content.ComponentName)96 PackageManager (android.content.pm.PackageManager)62 RemoteException (android.os.RemoteException)48 PendingIntent (android.app.PendingIntent)37 ApplicationInfo (android.content.pm.ApplicationInfo)35 AccessibilityServiceInfo (android.accessibilityservice.AccessibilityServiceInfo)32 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)29 IOException (java.io.IOException)28 ArrayList (java.util.ArrayList)27 InputMethodInfo (android.view.inputmethod.InputMethodInfo)21 PackageInfo (android.content.pm.PackageInfo)18 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)16 Service (android.app.Service)13 Point (android.graphics.Point)11 SpellCheckerInfo (android.view.textservice.SpellCheckerInfo)11 ArraySet (android.util.ArraySet)10 ActivityInfo (android.content.pm.ActivityInfo)9