use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.
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);
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.
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);
}
}
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.
the class Settings method writeLPr.
void writeLPr() {
// been successfully written.
if (mSettingsFilename.exists()) {
// might have been corrupted.
if (!mBackupSettingsFilename.exists()) {
if (!mSettingsFilename.renameTo(mBackupSettingsFilename)) {
Slog.wtf(PackageManagerService.TAG, "Unable to backup package manager settings, " + " current changes will be lost at reboot");
return;
}
} else {
mSettingsFilename.delete();
Slog.w(PackageManagerService.TAG, "Preserving older settings backup");
}
}
mPastSignatures.clear();
try {
FileOutputStream fstr = new FileOutputStream(mSettingsFilename);
BufferedOutputStream str = new BufferedOutputStream(fstr);
//XmlSerializer serializer = XmlUtils.serializerInstance();
XmlSerializer serializer = new FastXmlSerializer();
serializer.setOutput(str, StandardCharsets.UTF_8.name());
serializer.startDocument(null, true);
serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
serializer.startTag(null, "packages");
for (int i = 0; i < mVersion.size(); i++) {
final String volumeUuid = mVersion.keyAt(i);
final VersionInfo ver = mVersion.valueAt(i);
serializer.startTag(null, TAG_VERSION);
XmlUtils.writeStringAttribute(serializer, ATTR_VOLUME_UUID, volumeUuid);
XmlUtils.writeIntAttribute(serializer, ATTR_SDK_VERSION, ver.sdkVersion);
XmlUtils.writeIntAttribute(serializer, ATTR_DATABASE_VERSION, ver.databaseVersion);
XmlUtils.writeStringAttribute(serializer, ATTR_FINGERPRINT, ver.fingerprint);
serializer.endTag(null, TAG_VERSION);
}
if (mVerifierDeviceIdentity != null) {
serializer.startTag(null, "verifier");
serializer.attribute(null, "device", mVerifierDeviceIdentity.toString());
serializer.endTag(null, "verifier");
}
if (mReadExternalStorageEnforced != null) {
serializer.startTag(null, TAG_READ_EXTERNAL_STORAGE);
serializer.attribute(null, ATTR_ENFORCEMENT, mReadExternalStorageEnforced ? "1" : "0");
serializer.endTag(null, TAG_READ_EXTERNAL_STORAGE);
}
serializer.startTag(null, "permission-trees");
for (BasePermission bp : mPermissionTrees.values()) {
writePermissionLPr(serializer, bp);
}
serializer.endTag(null, "permission-trees");
serializer.startTag(null, "permissions");
for (BasePermission bp : mPermissions.values()) {
writePermissionLPr(serializer, bp);
}
serializer.endTag(null, "permissions");
for (final PackageSetting pkg : mPackages.values()) {
writePackageLPr(serializer, pkg);
}
for (final PackageSetting pkg : mDisabledSysPackages.values()) {
writeDisabledSysPackageLPr(serializer, pkg);
}
for (final SharedUserSetting usr : mSharedUsers.values()) {
serializer.startTag(null, "shared-user");
serializer.attribute(null, ATTR_NAME, usr.name);
serializer.attribute(null, "userId", Integer.toString(usr.userId));
usr.signatures.writeXml(serializer, "sigs", mPastSignatures);
writePermissionsLPr(serializer, usr.getPermissionsState().getInstallPermissionStates());
serializer.endTag(null, "shared-user");
}
if (mPackagesToBeCleaned.size() > 0) {
for (PackageCleanItem item : mPackagesToBeCleaned) {
final String userStr = Integer.toString(item.userId);
serializer.startTag(null, "cleaning-package");
serializer.attribute(null, ATTR_NAME, item.packageName);
serializer.attribute(null, ATTR_CODE, item.andCode ? "true" : "false");
serializer.attribute(null, ATTR_USER, userStr);
serializer.endTag(null, "cleaning-package");
}
}
if (mRenamedPackages.size() > 0) {
for (Map.Entry<String, String> e : mRenamedPackages.entrySet()) {
serializer.startTag(null, "renamed-package");
serializer.attribute(null, "new", e.getKey());
serializer.attribute(null, "old", e.getValue());
serializer.endTag(null, "renamed-package");
}
}
final int numIVIs = mRestoredIntentFilterVerifications.size();
if (numIVIs > 0) {
if (DEBUG_DOMAIN_VERIFICATION) {
Slog.i(TAG, "Writing restored-ivi entries to packages.xml");
}
serializer.startTag(null, "restored-ivi");
for (int i = 0; i < numIVIs; i++) {
IntentFilterVerificationInfo ivi = mRestoredIntentFilterVerifications.valueAt(i);
writeDomainVerificationsLPr(serializer, ivi);
}
serializer.endTag(null, "restored-ivi");
} else {
if (DEBUG_DOMAIN_VERIFICATION) {
Slog.i(TAG, " no restored IVI entries to write");
}
}
mKeySetManagerService.writeKeySetManagerServiceLPr(serializer);
serializer.endTag(null, "packages");
serializer.endDocument();
str.flush();
FileUtils.sync(fstr);
str.close();
// New settings successfully written, old ones are no longer
// needed.
mBackupSettingsFilename.delete();
FileUtils.setPermissions(mSettingsFilename.toString(), FileUtils.S_IRUSR | FileUtils.S_IWUSR | FileUtils.S_IRGRP | FileUtils.S_IWGRP, -1, -1);
writeKernelMappingLPr();
writePackageListLPr();
writeAllUsersPackageRestrictionsLPr();
writeAllRuntimePermissionsLPr();
return;
} catch (XmlPullParserException e) {
Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e);
} catch (java.io.IOException e) {
Slog.wtf(PackageManagerService.TAG, "Unable to write package manager settings, " + "current changes will be lost at reboot", e);
}
// Clean up partially written files
if (mSettingsFilename.exists()) {
if (!mSettingsFilename.delete()) {
Slog.wtf(PackageManagerService.TAG, "Failed to clean up mangled file: " + mSettingsFilename);
}
}
//Debug.stopMethodTracing();
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by ResurrectionRemix.
the class Settings method readRestoredIntentFilterVerifications.
private void readRestoredIntentFilterVerifications(XmlPullParser parser) throws XmlPullParserException, IOException {
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;
}
final String tagName = parser.getName();
if (tagName.equals(TAG_DOMAIN_VERIFICATION)) {
IntentFilterVerificationInfo ivi = new IntentFilterVerificationInfo(parser);
if (DEBUG_DOMAIN_VERIFICATION) {
Slog.i(TAG, "Restored IVI for " + ivi.getPackageName() + " status=" + ivi.getStatusString());
}
mRestoredIntentFilterVerifications.put(ivi.getPackageName(), ivi);
} else {
Slog.w(TAG, "Unknown element: " + tagName);
XmlUtils.skipCurrentTag(parser);
}
}
}
use of android.content.pm.IntentFilterVerificationInfo in project android_frameworks_base by DirtyUnicorns.
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);
}
}
}
Aggregations