Add two panel home support for page binding logic

There's a logic which prioritizes the binding for the
current page and defers the other pages' binding.
If two panel home is enabled, we want to bind both pages
together. LauncherPageRestoreHelper has been created to
contain the logic for persisting restoring and calculating
which pages to load immediately.

Test: manual + run LauncherPageRestoreHelperTest robo test
Bug: 174464691
Change-Id: I57ac3f7150303b95b272e922f44bda26f9d5ce2a
This commit is contained in:
Andras Kloczl
2021-05-14 12:21:30 +02:00
parent f3649f5e98
commit 55edfe55f7
17 changed files with 499 additions and 85 deletions

View File

@@ -16,11 +16,13 @@
package com.android.launcher3.util;
import java.util.Arrays;
import java.util.Iterator;
/**
* A wrapper over IntArray implementing a growing set of int primitives.
* The elements in the array are sorted in ascending order.
*/
public class IntSet {
public class IntSet implements Iterable<Integer> {
final IntArray mArray = new IntArray();
@@ -61,6 +63,9 @@ public class IntSet {
return (obj instanceof IntSet) && ((IntSet) obj).mArray.equals(mArray);
}
/**
* Returns the wrapped IntArray. The elements in the array are sorted in ascending order.
*/
public IntArray getArray() {
return mArray;
}
@@ -78,4 +83,21 @@ public class IntSet {
Arrays.sort(set.mArray.mValues, 0, set.mArray.mSize);
return set;
}
/**
* Returns an IntSet with the given values.
*/
public static IntSet wrap(int... array) {
return wrap(IntArray.wrap(array));
}
@Override
public Iterator<Integer> iterator() {
return mArray.iterator();
}
@Override
public String toString() {
return "IntSet{" + mArray.toConcatString() + '}';
}
}