mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Fix race in LauncherModel that causes it to show duplicate icons.
Change-Id: I78130d6f237f476bc33a4718ca5ef245fe502857
This commit is contained in:
@@ -57,8 +57,13 @@ class AllAppsList {
|
||||
/**
|
||||
* Add the supplied ApplicationInfo objects to the list, and enqueue it into the
|
||||
* list to broadcast when notify() is called.
|
||||
*
|
||||
* If the app is already in the list, doesn't add it.
|
||||
*/
|
||||
public void add(ApplicationInfo info) {
|
||||
if (findActivity(data, info.componentName)) {
|
||||
return;
|
||||
}
|
||||
data.add(info);
|
||||
added.add(info);
|
||||
}
|
||||
@@ -189,6 +194,20 @@ class AllAppsList {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether <em>apps</em> contains <em>component</em>.
|
||||
*/
|
||||
private static boolean findActivity(ArrayList<ApplicationInfo> apps, ComponentName component) {
|
||||
final int N = apps.size();
|
||||
for (int i=0; i<N; i++) {
|
||||
final ApplicationInfo info = apps.get(i);
|
||||
if (info.componentName.equals(component)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find an ApplicationInfo object for the given packageName and className.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user