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.

Cherry-pick from gingerbread branch

Bug: 2572398
Change-Id: I95d8b6360bf7a3f39cd7a1ff09e1ee57e11583d8
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 @@
 
         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 @@
 
         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 @@
     // 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);
         }
     };