diff options
| author | Svetoslav <svetoslavganov@google.com> | 2013-10-29 15:24:14 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-10-29 15:24:14 +0000 |
| commit | ac5d3827409dff757531347c5232bb34ea727274 (patch) | |
| tree | 295ab33988cef5c33f40b7e6ffd222d33a9150f0 /core/java | |
| parent | 86bfb3af4296a1263cb2c01a9e87b5b20015fedb (diff) | |
| parent | 27f592df8ce604c62327cc93ee5adac3152a0bd2 (diff) | |
| download | frameworks_base-ac5d3827409dff757531347c5232bb34ea727274.zip frameworks_base-ac5d3827409dff757531347c5232bb34ea727274.tar.gz frameworks_base-ac5d3827409dff757531347c5232bb34ea727274.tar.bz2 | |
Merge "Share pack historical sorting using wrong keys." into klp-dev
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/widget/ActivityChooserModel.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/core/java/android/widget/ActivityChooserModel.java b/core/java/android/widget/ActivityChooserModel.java index 00a92ca..61df922 100644 --- a/core/java/android/widget/ActivityChooserModel.java +++ b/core/java/android/widget/ActivityChooserModel.java @@ -938,29 +938,31 @@ public class ActivityChooserModel extends DataSetObservable { private final class DefaultSorter implements ActivitySorter { private static final float WEIGHT_DECAY_COEFFICIENT = 0.95f; - private final Map<String, ActivityResolveInfo> mPackageNameToActivityMap = - new HashMap<String, ActivityResolveInfo>(); + private final Map<ComponentName, ActivityResolveInfo> mPackageNameToActivityMap = + new HashMap<ComponentName, ActivityResolveInfo>(); public void sort(Intent intent, List<ActivityResolveInfo> activities, List<HistoricalRecord> historicalRecords) { - Map<String, ActivityResolveInfo> packageNameToActivityMap = - mPackageNameToActivityMap; - packageNameToActivityMap.clear(); + Map<ComponentName, ActivityResolveInfo> componentNameToActivityMap = + mPackageNameToActivityMap; + componentNameToActivityMap.clear(); final int activityCount = activities.size(); for (int i = 0; i < activityCount; i++) { ActivityResolveInfo activity = activities.get(i); activity.weight = 0.0f; - String packageName = activity.resolveInfo.activityInfo.packageName; - packageNameToActivityMap.put(packageName, activity); + ComponentName componentName = new ComponentName( + activity.resolveInfo.activityInfo.packageName, + activity.resolveInfo.activityInfo.name); + componentNameToActivityMap.put(componentName, activity); } final int lastShareIndex = historicalRecords.size() - 1; float nextRecordWeight = 1; for (int i = lastShareIndex; i >= 0; i--) { HistoricalRecord historicalRecord = historicalRecords.get(i); - String packageName = historicalRecord.activity.getPackageName(); - ActivityResolveInfo activity = packageNameToActivityMap.get(packageName); + ComponentName componentName = historicalRecord.activity; + ActivityResolveInfo activity = componentNameToActivityMap.get(componentName); if (activity != null) { activity.weight += historicalRecord.weight * nextRecordWeight; nextRecordWeight = nextRecordWeight * WEIGHT_DECAY_COEFFICIENT; |
