Revert^4 "Removing all restored backups except one so we don't have old backups"
To prevent the error I introduce the method restorePreviousState().
This reverts commit 1234090589.
Reason for revert: Fixing presubmit breaks
Bug: 325285743
Flag: ACONFIG narrow_grid_restore disabled
Test: BackupAndRestoreDBSelectionTest
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ad46eb75f4c239321b1e8f03062dd7599cdc9495)
Merged-In: I63666c29eb91dada4243af019ab0538c40bc0f78
Change-Id: I63666c29eb91dada4243af019ab0538c40bc0f78
This commit is contained in:
1 parent
6aa4389285
commit
87fbc2e02e
8 files changed
+273
-1
No files matched your search
@@ -72,6 +72,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class InvariantDeviceProfile {
|
||||
@@ -575,6 +576,45 @@ public class InvariantDeviceProfile {
|
||||
return filteredProfiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the GridOption associated to the given file name or null if the fileName is not
|
||||
* supported.
|
||||
* Ej, launcher.db -> "normal grid", launcher_4_by_4.db -> "practical grid"
|
||||
*/
|
||||
public GridOption getGridOptionFromFileName(Context context, String fileName) {
|
||||
return parseAllGridOptions(context).stream()
|
||||
.filter(gridOption -> Objects.equals(gridOption.dbFile, fileName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the given size on the current device or empty string if the size is not
|
||||
* supported. Ej. 4x4 -> normal, 5x4 -> practical, etc.
|
||||
* (Note: the name of the grid can be different for the same grid size depending of
|
||||
* the values of the InvariantDeviceProfile)
|
||||
*
|
||||
*/
|
||||
public String getGridNameFromSize(Context context, Point size) {
|
||||
return parseAllGridOptions(context).stream()
|
||||
.filter(gridOption -> gridOption.numColumns == size.x
|
||||
&& gridOption.numRows == size.y)
|
||||
.map(gridOption -> gridOption.name)
|
||||
.findFirst()
|
||||
.orElse("");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the grid option for the given gridName on the current device (Note: the gridOption
|
||||
* be different for the same gridName depending on the values of the InvariantDeviceProfile).
|
||||
*/
|
||||
public GridOption getGridOptionFromName(Context context, String gridName) {
|
||||
return parseAllGridOptions(context).stream()
|
||||
.filter(gridOption -> Objects.equals(gridOption.name, gridName))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return all the grid options that can be shown on the device
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user