Search in sources :

Example 66 with NonNull

use of android.annotation.NonNull in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerService method getRequiredUninstallerLPr.

@NonNull
private String getRequiredUninstallerLPr() {
    final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
    intent.addCategory(Intent.CATEGORY_DEFAULT);
    intent.setData(Uri.fromParts(PACKAGE_SCHEME, "foo.bar", null));
    final ResolveInfo resolveInfo = resolveIntent(intent, null, MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM);
    if (resolveInfo == null || mResolveActivity.name.equals(resolveInfo.getComponentInfo().name)) {
        throw new RuntimeException("There must be exactly one uninstaller; found " + resolveInfo);
    }
    return resolveInfo.getComponentInfo().packageName;
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) Intent(android.content.Intent) NonNull(android.annotation.NonNull)

Example 67 with NonNull

use of android.annotation.NonNull in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerService method queryIntentContentProvidersInternal.

@NonNull
private List<ResolveInfo> queryIntentContentProvidersInternal(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 ProviderInfo pi = getProviderInfo(comp, flags, userId);
        if (pi != null) {
            final ResolveInfo ri = new ResolveInfo();
            ri.providerInfo = pi;
            list.add(ri);
        }
        return list;
    }
    // reader
    synchronized (mPackages) {
        String pkgName = intent.getPackage();
        if (pkgName == null) {
            return mProviders.queryIntent(intent, resolvedType, flags, userId);
        }
        final PackageParser.Package pkg = mPackages.get(pkgName);
        if (pkg != null) {
            return mProviders.queryIntentForPackage(intent, resolvedType, flags, pkg.providers, userId);
        }
        return Collections.emptyList();
    }
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) ProviderInfo(android.content.pm.ProviderInfo) PackageParser(android.content.pm.PackageParser) ArrayList(java.util.ArrayList) ComponentName(android.content.ComponentName) NonNull(android.annotation.NonNull)

Example 68 with NonNull

use of android.annotation.NonNull in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerService method getIntentFilterVerifierComponentNameLPr.

@NonNull
private ComponentName getIntentFilterVerifierComponentNameLPr() {
    final Intent intent = new Intent(Intent.ACTION_INTENT_FILTER_NEEDS_VERIFICATION);
    final List<ResolveInfo> matches = queryIntentReceiversInternal(intent, PACKAGE_MIME_TYPE, MATCH_SYSTEM_ONLY | MATCH_DIRECT_BOOT_AWARE | MATCH_DIRECT_BOOT_UNAWARE, UserHandle.USER_SYSTEM);
    ResolveInfo best = null;
    final int N = matches.size();
    for (int i = 0; i < N; i++) {
        final ResolveInfo cur = matches.get(i);
        final String packageName = cur.getComponentInfo().packageName;
        if (checkPermission(android.Manifest.permission.INTENT_FILTER_VERIFICATION_AGENT, packageName, UserHandle.USER_SYSTEM) != PackageManager.PERMISSION_GRANTED) {
            continue;
        }
        if (best == null || cur.priority > best.priority) {
            best = cur;
        }
    }
    if (best != null) {
        return best.getComponentInfo().getComponentName();
    } else {
        throw new RuntimeException("There must be at least one intent filter verifier");
    }
}
Also used : EphemeralResolveInfo(android.content.pm.EphemeralResolveInfo) ResolveInfo(android.content.pm.ResolveInfo) Intent(android.content.Intent) NonNull(android.annotation.NonNull)

Example 69 with NonNull

use of android.annotation.NonNull in project android_frameworks_base by DirtyUnicorns.

the class PackageManagerService method getSystemAvailableFeatures.

@Override
@NonNull
public ParceledListSlice<FeatureInfo> getSystemAvailableFeatures() {
    synchronized (mPackages) {
        final ArrayList<FeatureInfo> res = new ArrayList<>(mAvailableFeatures.values());
        final FeatureInfo fi = new FeatureInfo();
        fi.reqGlEsVersion = SystemProperties.getInt("ro.opengles.version", FeatureInfo.GL_ES_VERSION_UNDEFINED);
        res.add(fi);
        return new ParceledListSlice<>(res);
    }
}
Also used : ArrayList(java.util.ArrayList) FeatureInfo(android.content.pm.FeatureInfo) ParceledListSlice(android.content.pm.ParceledListSlice) NonNull(android.annotation.NonNull)

Example 70 with NonNull

use of android.annotation.NonNull 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)

Aggregations

NonNull (android.annotation.NonNull)322 ArrayList (java.util.ArrayList)46 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)45 IOException (java.io.IOException)35 ComponentName (android.content.ComponentName)25 File (java.io.File)22 XmlPullParser (org.xmlpull.v1.XmlPullParser)20 Intent (android.content.Intent)18 EphemeralResolveInfo (android.content.pm.EphemeralResolveInfo)16 ResolveInfo (android.content.pm.ResolveInfo)16 Bundle (android.os.Bundle)15 RemoteException (android.os.RemoteException)15 FileNotFoundException (java.io.FileNotFoundException)15 Paint (android.graphics.Paint)14 PackageParser (android.content.pm.PackageParser)12 ContentResolver (android.content.ContentResolver)10 UserInfo (android.content.pm.UserInfo)10 StorageManager (android.os.storage.StorageManager)10 VolumeInfo (android.os.storage.VolumeInfo)10 KeyCharacteristics (android.security.keymaster.KeyCharacteristics)10