Search in sources :

Example 36 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.

the class Settings method readDomainVerificationLPw.

private void readDomainVerificationLPw(XmlPullParser parser, PackageSettingBase packageSetting) throws XmlPullParserException, IOException {
    IntentFilterVerificationInfo ivi = new IntentFilterVerificationInfo(parser);
    packageSetting.setIntentFilterVerificationInfo(ivi);
    Log.d(TAG, "Read domain verification for package: " + ivi.getPackageName());
}
Also used : IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo)

Example 37 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.

the class Settings method getIntentFilterVerificationsLPr.

/**
     * Used for Settings App and PackageManagerService dump. Should be read only.
     */
List<IntentFilterVerificationInfo> getIntentFilterVerificationsLPr(String packageName) {
    if (packageName == null) {
        return Collections.<IntentFilterVerificationInfo>emptyList();
    }
    ArrayList<IntentFilterVerificationInfo> result = new ArrayList<>();
    for (PackageSetting ps : mPackages.values()) {
        IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
        if (ivi == null || TextUtils.isEmpty(ivi.getPackageName()) || !ivi.getPackageName().equalsIgnoreCase(packageName)) {
            continue;
        }
        result.add(ivi);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo)

Example 38 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class Utils method getHandledDomains.

public static ArraySet<String> getHandledDomains(PackageManager pm, String packageName) {
    List<IntentFilterVerificationInfo> iviList = pm.getIntentFilterVerifications(packageName);
    List<IntentFilter> filters = pm.getAllIntentFilters(packageName);
    ArraySet<String> result = new ArraySet<>();
    if (iviList.size() > 0) {
        for (IntentFilterVerificationInfo ivi : iviList) {
            for (String host : ivi.getDomains()) {
                result.add(host);
            }
        }
    }
    if (filters != null && filters.size() > 0) {
        for (IntentFilter filter : filters) {
            if (filter.hasCategory(Intent.CATEGORY_BROWSABLE) && (filter.hasDataScheme(IntentFilter.SCHEME_HTTP) || filter.hasDataScheme(IntentFilter.SCHEME_HTTPS))) {
                result.addAll(filter.getHostsList());
            }
        }
    }
    return result;
}
Also used : IntentFilter(android.content.IntentFilter) ArraySet(android.util.ArraySet) IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo) SpannableString(android.text.SpannableString)

Example 39 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.

the class Settings method createIntentFilterVerificationIfNeededLPw.

/* package protected */
IntentFilterVerificationInfo createIntentFilterVerificationIfNeededLPw(String packageName, ArrayList<String> domains) {
    PackageSetting ps = mPackages.get(packageName);
    if (ps == null) {
        if (DEBUG_DOMAIN_VERIFICATION) {
            Slog.w(PackageManagerService.TAG, "No package known: " + packageName);
        }
        return null;
    }
    IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
    if (ivi == null) {
        ivi = new IntentFilterVerificationInfo(packageName, domains);
        ps.setIntentFilterVerificationInfo(ivi);
        if (DEBUG_DOMAIN_VERIFICATION) {
            Slog.d(PackageManagerService.TAG, "Creating new IntentFilterVerificationInfo for pkg: " + packageName);
        }
    } else {
        ivi.setDomains(domains);
        if (DEBUG_DOMAIN_VERIFICATION) {
            Slog.d(PackageManagerService.TAG, "Setting domains to existing IntentFilterVerificationInfo for pkg: " + packageName + " and with domains: " + ivi.getDomainsString());
        }
    }
    return ivi;
}
Also used : IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo)

Example 40 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.

the class Settings method addPackageSettingLPw.

// Utility method that adds a PackageSetting to mPackages and
// completes updating the shared user attributes and any restored
// app link verification state
private void addPackageSettingLPw(PackageSetting p, String name, SharedUserSetting sharedUser) {
    mPackages.put(name, p);
    if (sharedUser != null) {
        if (p.sharedUser != null && p.sharedUser != sharedUser) {
            PackageManagerService.reportSettingsProblem(Log.ERROR, "Package " + p.name + " was user " + p.sharedUser + " but is now " + sharedUser + "; I am not changing its files so it will probably fail!");
            p.sharedUser.removePackage(p);
        } else if (p.appId != sharedUser.userId) {
            PackageManagerService.reportSettingsProblem(Log.ERROR, "Package " + p.name + " was user id " + p.appId + " but is now user " + sharedUser + " with id " + sharedUser.userId + "; I am not changing its files so it will probably fail!");
        }
        sharedUser.addPackage(p);
        p.sharedUser = sharedUser;
        p.appId = sharedUser.userId;
    }
    // If the we know about this user id, we have to update it as it
    // has to point to the same PackageSetting instance as the package.
    Object userIdPs = getUserIdLPr(p.appId);
    if (sharedUser == null) {
        if (userIdPs != null && userIdPs != p) {
            replaceUserIdLPw(p.appId, p);
        }
    } else {
        if (userIdPs != null && userIdPs != sharedUser) {
            replaceUserIdLPw(p.appId, sharedUser);
        }
    }
    IntentFilterVerificationInfo ivi = mRestoredIntentFilterVerifications.get(name);
    if (ivi != null) {
        if (DEBUG_DOMAIN_VERIFICATION) {
            Slog.i(TAG, "Applying restored IVI for " + name + " : " + ivi.getStatusString());
        }
        mRestoredIntentFilterVerifications.remove(name);
        p.setIntentFilterVerificationInfo(ivi);
    }
}
Also used : IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo)

Aggregations

IntentFilterVerificationInfo (android.content.pm.IntentFilterVerificationInfo)43 PackageParser (android.content.pm.PackageParser)6 ArrayMap (android.util.ArrayMap)6 FastXmlSerializer (com.android.internal.util.FastXmlSerializer)6 BufferedOutputStream (java.io.BufferedOutputStream)6 FileOutputStream (java.io.FileOutputStream)6 IOException (java.io.IOException)6 ArrayList (java.util.ArrayList)6 Map (java.util.Map)6 XmlSerializer (org.xmlpull.v1.XmlSerializer)6 ArraySet (android.util.ArraySet)5 PackageCleanItem (android.content.pm.PackageCleanItem)4 ActivityIntentInfo (android.content.pm.PackageParser.ActivityIntentInfo)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)4 IntentFilter (android.content.IntentFilter)3 ComponentName (android.content.ComponentName)2 FeatureInfo (android.content.pm.FeatureInfo)2 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)2 SystemConfig (com.android.server.SystemConfig)2 BufferedReader (java.io.BufferedReader)2