Search in sources :

Example 46 with IntentFilterVerificationInfo

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

the class Settings method readAllDomainVerificationsLPr.

// Specifically for backup/restore
void readAllDomainVerificationsLPr(XmlPullParser parser, int userId) throws XmlPullParserException, IOException {
    mRestoredIntentFilterVerifications.clear();
    int outerDepth = parser.getDepth();
    int type;
    while ((type = parser.next()) != XmlPullParser.END_DOCUMENT && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
        if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
            continue;
        }
        String tagName = parser.getName();
        if (tagName.equals(TAG_DOMAIN_VERIFICATION)) {
            IntentFilterVerificationInfo ivi = new IntentFilterVerificationInfo(parser);
            final String pkgName = ivi.getPackageName();
            final PackageSetting ps = mPackages.get(pkgName);
            if (ps != null) {
                // known/existing package; update in place
                ps.setIntentFilterVerificationInfo(ivi);
                if (DEBUG_DOMAIN_VERIFICATION) {
                    Slog.d(TAG, "Restored IVI for existing app " + pkgName + " status=" + ivi.getStatusString());
                }
            } else {
                mRestoredIntentFilterVerifications.put(pkgName, ivi);
                if (DEBUG_DOMAIN_VERIFICATION) {
                    Slog.d(TAG, "Restored IVI for pending app " + pkgName + " status=" + ivi.getStatusString());
                }
            }
        } else {
            PackageManagerService.reportSettingsProblem(Log.WARN, "Unknown element under <all-intent-filter-verification>: " + parser.getName());
            XmlUtils.skipCurrentTag(parser);
        }
    }
}
Also used : IntentFilterVerificationInfo(android.content.pm.IntentFilterVerificationInfo)

Example 47 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_packages_apps_Settings by LineageOS.

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 48 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_packages_apps_Settings by crdroidandroid.

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 49 with IntentFilterVerificationInfo

use of android.content.pm.IntentFilterVerificationInfo in project android_packages_apps_Settings by SudaMod.

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 50 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 != null && 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)

Aggregations

IntentFilterVerificationInfo (android.content.pm.IntentFilterVerificationInfo)50 ArraySet (android.util.ArraySet)12 IntentFilter (android.content.IntentFilter)9 SpannableString (android.text.SpannableString)7 ArrayList (java.util.ArrayList)7 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 Map (java.util.Map)6 XmlSerializer (org.xmlpull.v1.XmlSerializer)6 PackageCleanItem (android.content.pm.PackageCleanItem)4 ActivityIntentInfo (android.content.pm.PackageParser.ActivityIntentInfo)4 XmlPullParserException (org.xmlpull.v1.XmlPullParserException)4 ComponentName (android.content.ComponentName)2 FeatureInfo (android.content.pm.FeatureInfo)2 IndentingPrintWriter (com.android.internal.util.IndentingPrintWriter)2 SystemConfig (com.android.server.SystemConfig)2