summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorKenny Root <kroot@google.com>2011-01-10 13:48:15 -0800
committerKenny Root <kroot@google.com>2011-01-11 15:51:46 -0800
commit1c6e764275934b0ddf65aeb86179c75a50ba15d4 (patch)
tree9972e0a294e2f0fb7583573124c9297dfd7b642b /services
parent65ba2c421c19fde04e6b294087a5a9c507964575 (diff)
downloadframeworks_base-1c6e764275934b0ddf65aeb86179c75a50ba15d4.zip
frameworks_base-1c6e764275934b0ddf65aeb86179c75a50ba15d4.tar.gz
frameworks_base-1c6e764275934b0ddf65aeb86179c75a50ba15d4.tar.bz2
Allow updated system apps to retain priority
Previously any updated system apps would not be able to have a greater than 0 priority on an activity intent filter. Moving the priority check later in the package scanning allows it to apply to updated system packages as well. Bug: 2572398 Change-Id: I9fdf7906809518b28b49ffec31afec1442d85d3c
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/IntentResolver.java8
-rw-r--r--services/java/com/android/server/PackageManagerService.java14
2 files changed, 16 insertions, 6 deletions
diff --git a/services/java/com/android/server/IntentResolver.java b/services/java/com/android/server/IntentResolver.java
index e47de13..a8b2840 100644
--- a/services/java/com/android/server/IntentResolver.java
+++ b/services/java/com/android/server/IntentResolver.java
@@ -346,7 +346,7 @@ public class IntentResolver<F extends IntentFilter, R extends Object> {
int num = 0;
while (i.hasNext()) {
- String name = (String)i.next();
+ String name = i.next();
num++;
if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
@@ -395,7 +395,7 @@ public class IntentResolver<F extends IntentFilter, R extends Object> {
int num = 0;
while (i.hasNext()) {
- String name = (String)i.next();
+ String name = i.next();
num++;
if (localLOGV) Slog.v(TAG, prefix + name);
String baseName = name;
@@ -534,8 +534,8 @@ public class IntentResolver<F extends IntentFilter, R extends Object> {
// Sorts a List of IntentFilter objects into descending priority order.
private static final Comparator mResolvePrioritySorter = new Comparator() {
public int compare(Object o1, Object o2) {
- float q1 = ((IntentFilter)o1).getPriority();
- float q2 = ((IntentFilter)o2).getPriority();
+ final int q1 = ((IntentFilter) o1).getPriority();
+ final int q2 = ((IntentFilter) o2).getPriority();
return (q1 > q2) ? -1 : ((q1 < q2) ? 1 : 0);
}
};
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index cb9dfc8..894c649 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -2881,13 +2881,13 @@ class PackageManagerService extends IPackageManager.Stub {
SharedUserSetting suid = null;
PackageSetting pkgSetting = null;
- if ((pkg.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) == 0) {
+ if (!isSystemApp(pkg)) {
// Only system apps can use these features.
pkg.mOriginalPackages = null;
pkg.mRealPackage = null;
pkg.mAdoptPermissions = null;
}
-
+
synchronized (mPackages) {
// Check all shared libraries and map to their actual file path.
if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) {
@@ -4080,6 +4080,7 @@ class PackageManagerService extends IPackageManager.Stub {
}
public final void addActivity(PackageParser.Activity a, String type) {
+ final boolean systemApp = isSystemApp(a.info.applicationInfo);
mActivities.put(a.getComponentName(), a);
if (SHOW_INFO || Config.LOGV) Log.v(
TAG, " " + type + " " +
@@ -4088,6 +4089,11 @@ class PackageManagerService extends IPackageManager.Stub {
int NI = a.intents.size();
for (int j=0; j<NI; j++) {
PackageParser.ActivityIntentInfo intent = a.intents.get(j);
+ if (!systemApp && intent.getPriority() > 0 && "activity".equals(type)) {
+ intent.setPriority(0);
+ Log.w(TAG, "Package " + a.info.applicationInfo.packageName + " has activity "
+ + a.className + " with priority > 0, forcing to 0");
+ }
if (SHOW_INFO || Config.LOGV) {
Log.v(TAG, " IntentFilter:");
intent.dump(new LogPrinter(Log.VERBOSE, TAG), " ");
@@ -5952,6 +5958,10 @@ class PackageManagerService extends IPackageManager.Stub {
return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
}
+ private static boolean isSystemApp(ApplicationInfo info) {
+ return (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
+ }
+
private static boolean isUpdatedSystemApp(PackageParser.Package pkg) {
return (pkg.applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
}