diff --git a/services/core/java/com/android/server/pm/CrossProfileIntentResolver.java b/services/core/java/com/android/server/pm/CrossProfileIntentResolver.java index 7927538603582..9ea16d322c3c0 100644 --- a/services/core/java/com/android/server/pm/CrossProfileIntentResolver.java +++ b/services/core/java/com/android/server/pm/CrossProfileIntentResolver.java @@ -19,7 +19,6 @@ package com.android.server.pm; import android.annotation.NonNull; import android.content.IntentFilter; -import com.android.server.WatchedIntentResolver; import com.android.server.utils.Snappable; import com.android.server.utils.SnapshotCache; diff --git a/services/core/java/com/android/server/pm/PersistentPreferredIntentResolver.java b/services/core/java/com/android/server/pm/PersistentPreferredIntentResolver.java index bfddaea0dd756..bc65c3a7e20c0 100644 --- a/services/core/java/com/android/server/pm/PersistentPreferredIntentResolver.java +++ b/services/core/java/com/android/server/pm/PersistentPreferredIntentResolver.java @@ -19,7 +19,6 @@ package com.android.server.pm; import android.annotation.NonNull; import android.content.IntentFilter; -import com.android.server.WatchedIntentResolver; import com.android.server.utils.Snappable; import com.android.server.utils.SnapshotCache; diff --git a/services/core/java/com/android/server/pm/PreferredIntentResolver.java b/services/core/java/com/android/server/pm/PreferredIntentResolver.java index 0aca6eec25fcc..fc7680bad9d4e 100644 --- a/services/core/java/com/android/server/pm/PreferredIntentResolver.java +++ b/services/core/java/com/android/server/pm/PreferredIntentResolver.java @@ -19,7 +19,6 @@ package com.android.server.pm; import android.annotation.NonNull; import android.content.IntentFilter; -import com.android.server.WatchedIntentResolver; import com.android.server.utils.Snappable; import com.android.server.utils.SnapshotCache; diff --git a/services/core/java/com/android/server/WatchedIntentResolver.java b/services/core/java/com/android/server/pm/WatchedIntentResolver.java similarity index 82% rename from services/core/java/com/android/server/WatchedIntentResolver.java rename to services/core/java/com/android/server/pm/WatchedIntentResolver.java index 0831c36d2bf6a..1c3d884e3a988 100644 --- a/services/core/java/com/android/server/WatchedIntentResolver.java +++ b/services/core/java/com/android/server/pm/WatchedIntentResolver.java @@ -14,18 +14,20 @@ * limitations under the License. */ -package com.android.server; +package com.android.server.pm; import android.annotation.NonNull; import android.annotation.Nullable; -import com.android.server.pm.WatchedIntentFilter; +import com.android.server.IntentResolver; import com.android.server.utils.Snappable; import com.android.server.utils.Watchable; import com.android.server.utils.WatchableImpl; import com.android.server.utils.Watcher; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; /** @@ -34,7 +36,8 @@ import java.util.List; * @param The resolver type. * {@hide} */ -public abstract class WatchedIntentResolver +public abstract class WatchedIntentResolver extends IntentResolver implements Watchable, Snappable { @@ -116,11 +119,21 @@ public abstract class WatchedIntentResolver sResolvePrioritySorter = + new Comparator<>() { + public int compare(WatchedIntentFilter o1, WatchedIntentFilter o2) { + final int q1 = o1.getPriority(); + final int q2 = o2.getPriority(); + return (q1 > q2) ? -1 : ((q1 < q2) ? 1 : 0); + } + }; + @Override @SuppressWarnings("unchecked") protected void sortResults(List results) { - super.sortResults(results); - onChanged(); + Collections.sort(results, sResolvePrioritySorter); } /**