summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/pm
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2010-02-02 10:49:14 -0800
committerDianne Hackborn <hackbod@google.com>2010-02-03 15:42:02 -0800
commitb858dfda5012a1040927ed62c3bb856c3294d882 (patch)
treed865e8580e15ecda54e4fd4e891c489eb222a8b1 /core/java/android/content/pm
parent70d10c0156f5d2d1c639d0ebe62de8ec950d4306 (diff)
downloadframeworks_base-b858dfda5012a1040927ed62c3bb856c3294d882.zip
frameworks_base-b858dfda5012a1040927ed62c3bb856c3294d882.tar.gz
frameworks_base-b858dfda5012a1040927ed62c3bb856c3294d882.tar.bz2
Implement system data migration support.
This adds three new features: - <original-package android:name="com.foo" /> manifest tag. This allows an .apk to specify another package it originally came from, propagating all state and data from the old to new package. - <adopt-permissions android:name="com.foo" /> manifest tag. In some more complicated cases, a new .apk may be a combination of multiple older .apks that each declared their own permissions. This allows you to propagate the permissions from these other .apks into the new one. - A new system/etc/updatecmds directory. You can place files here which describe data files to move from one package to another. (See below for details.) Also in this change: we now clean up the data directories of .apks that disappear from the system image, and some improvements to logging and reporting error messages. A typical file in the updatecmds directory looks like this: ------- com.google.android.gsf:com.google.android.providers.talk databases/talk.db com.google.android.gsf:com.google.android.googleapps databases/gls.db ------- This says that for com.google.android.sfs, there are two packages to move files from: From com.google.android.providers.talk, the file databases/talk.db. From com.google.android.googleapps, the file databases/gls.db As part of moving the file, its owner will be changed from the old package to whoever is the owner of the new package's data directory. If those two files had existed, after booting you would now have the files: /data/data/com.google.android.gsf/databases/talk.db /data/data/com.google.android.gsf/databases/gls.db Note that all three of these facilities assume that the older .apk is completely removed from the newer system. The WILL NOT work correctly if the older .apk still remains.
Diffstat (limited to 'core/java/android/content/pm')
-rw-r--r--core/java/android/content/pm/PackageParser.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index bbde0a6..bac55cc 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -953,6 +953,39 @@ public class PackageParser {
return null;
}
+ } else if (tagName.equals("original-package")) {
+ sa = res.obtainAttributes(attrs,
+ com.android.internal.R.styleable.AndroidManifestOriginalPackage);
+
+ String name = sa.getNonResourceString(
+ com.android.internal.R.styleable.AndroidManifestOriginalPackage_name);
+
+ sa.recycle();
+
+ if (name != null && (flags&PARSE_IS_SYSTEM) != 0) {
+ pkg.mOriginalPackage = name;
+ }
+
+ XmlUtils.skipCurrentTag(parser);
+
+ } else if (tagName.equals("adopt-permissions")) {
+ sa = res.obtainAttributes(attrs,
+ com.android.internal.R.styleable.AndroidManifestOriginalPackage);
+
+ String name = sa.getNonResourceString(
+ com.android.internal.R.styleable.AndroidManifestOriginalPackage_name);
+
+ sa.recycle();
+
+ if (name != null && (flags&PARSE_IS_SYSTEM) != 0) {
+ if (pkg.mAdoptPermissions == null) {
+ pkg.mAdoptPermissions = new ArrayList<String>();
+ }
+ pkg.mAdoptPermissions.add(name);
+ }
+
+ XmlUtils.skipCurrentTag(parser);
+
} else if (tagName.equals("eat-comment")) {
// Just skip this tag
XmlUtils.skipCurrentTag(parser);
@@ -2528,6 +2561,9 @@ public class PackageParser {
public ArrayList<String> usesOptionalLibraries = null;
public String[] usesLibraryFiles = null;
+ public String mOriginalPackage = null;
+ public ArrayList<String> mAdoptPermissions = null;
+
// We store the application meta-data independently to avoid multiple unwanted references
public Bundle mAppMetaData = null;