use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by crdroidandroid.
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;
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by crdroidandroid.
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;
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by crdroidandroid.
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);
}
}
use of android.content.pm.IntentFilterVerificationInfo in project platform_frameworks_base by android.
the class PackageManagerService method primeDomainVerificationsLPw.
private void primeDomainVerificationsLPw(int userId) {
if (DEBUG_DOMAIN_VERIFICATION) {
Slog.d(TAG, "Priming domain verifications in user " + userId);
}
SystemConfig systemConfig = SystemConfig.getInstance();
ArraySet<String> packages = systemConfig.getLinkedApps();
ArraySet<String> domains = new ArraySet<String>();
for (String packageName : packages) {
PackageParser.Package pkg = mPackages.get(packageName);
if (pkg != null) {
if (!pkg.isSystemApp()) {
Slog.w(TAG, "Non-system app '" + packageName + "' in sysconfig <app-link>");
continue;
}
domains.clear();
for (PackageParser.Activity a : pkg.activities) {
for (ActivityIntentInfo filter : a.intents) {
if (hasValidDomains(filter)) {
domains.addAll(filter.getHostsList());
}
}
}
if (domains.size() > 0) {
if (DEBUG_DOMAIN_VERIFICATION) {
Slog.v(TAG, " + " + packageName);
}
// 'Undefined' in the global IntentFilterVerificationInfo, i.e. the usual
// state w.r.t. the formal app-linkage "no verification attempted" state;
// and then 'always' in the per-user state actually used for intent resolution.
final IntentFilterVerificationInfo ivi;
ivi = mSettings.createIntentFilterVerificationIfNeededLPw(packageName, new ArrayList<String>(domains));
ivi.setStatus(INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED);
mSettings.updateIntentFilterVerificationStatusLPw(packageName, INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS, userId);
} else {
Slog.w(TAG, "Sysconfig <app-link> package '" + packageName + "' does not handle web links");
}
} else {
Slog.w(TAG, "Unknown package " + packageName + " in sysconfig <app-link>");
}
}
scheduleWritePackageRestrictionsLocked(userId);
scheduleWriteSettingsLocked();
}
use of android.content.pm.IntentFilterVerificationInfo in project platform_frameworks_base by android.
the class Settings method writeAllDomainVerificationsLPr.
// Specifically for backup/restore
void writeAllDomainVerificationsLPr(XmlSerializer serializer, int userId) throws IllegalArgumentException, IllegalStateException, IOException {
serializer.startTag(null, TAG_ALL_INTENT_FILTER_VERIFICATION);
final int N = mPackages.size();
for (int i = 0; i < N; i++) {
PackageSetting ps = mPackages.valueAt(i);
IntentFilterVerificationInfo ivi = ps.getIntentFilterVerificationInfo();
if (ivi != null) {
writeDomainVerificationsLPr(serializer, ivi);
}
}
serializer.endTag(null, TAG_ALL_INTENT_FILTER_VERIFICATION);
}
Aggregations