diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-16 09:24:19 -0700 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2014-10-28 09:27:10 -0700 |
commit | 33d443897658e6ad8b76bd2e58e3598161fd3ead (patch) | |
tree | 2205d9f2b6c9ce04a1fbb47495b45eae04345a11 /src/com/android/launcher3/LauncherAppState.java | |
parent | 09ae4aef52b4486b97ecc77feeb64307bcbd3993 (diff) | |
download | android_packages_apps_Trebuchet-33d443897658e6ad8b76bd2e58e3598161fd3ead.tar.gz android_packages_apps_Trebuchet-33d443897658e6ad8b76bd2e58e3598161fd3ead.tar.bz2 android_packages_apps_Trebuchet-33d443897658e6ad8b76bd2e58e3598161fd3ead.zip |
Updating backup restore logic
> Adding DeviceProfile information in the backup
> Removing SharedPreference backup
> Adding helper methods to abort backup in the middle
> Comparing keys against the backup journal during restore
to avoid restoring corrupt/lost entries
> Old backups are still compatible, but lost keys verification
will be ignored in that case.
Bug: 17937935
Bug: 17951775
Bug: 17260941
Change-Id: Iad48646cfdd69abaff5c163b2055f3b8a9b39b19
Diffstat (limited to 'src/com/android/launcher3/LauncherAppState.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAppState.java | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 03ab94bab..48af216bb 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -25,8 +25,12 @@ import android.content.IntentFilter; import android.content.res.Configuration; import android.content.res.Resources; import android.database.ContentObserver; +import android.graphics.Point; import android.os.Handler; +import android.util.DisplayMetrics; import android.util.Log; +import android.view.Display; +import android.view.WindowManager; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.compat.PackageInstallerCompat; @@ -190,21 +194,35 @@ public class LauncherAppState implements DeviceProfile.DeviceProfileCallbacks { return LauncherFiles.SHARED_PREFERENCES_KEY; } - DeviceProfile initDynamicGrid(Context context, int minWidth, int minHeight, - int width, int height, - int availableWidth, int availableHeight) { + DeviceProfile initDynamicGrid(Context context) { + // Determine the dynamic grid properties + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + Display display = wm.getDefaultDisplay(); + + Point realSize = new Point(); + display.getRealSize(realSize); + DisplayMetrics dm = new DisplayMetrics(); + display.getMetrics(dm); + if (mDynamicGrid == null) { + Point smallestSize = new Point(); + Point largestSize = new Point(); + display.getCurrentSizeRange(smallestSize, largestSize); + mDynamicGrid = new DynamicGrid(context, context.getResources(), - minWidth, minHeight, width, height, - availableWidth, availableHeight); + Math.min(smallestSize.x, smallestSize.y), + Math.min(largestSize.x, largestSize.y), + realSize.x, realSize.y, + dm.widthPixels, dm.heightPixels); mDynamicGrid.getDeviceProfile().addCallback(this); } // Update the icon size DeviceProfile grid = mDynamicGrid.getDeviceProfile(); - grid.updateFromConfiguration(context, context.getResources(), width, height, - availableWidth, availableHeight); + grid.updateFromConfiguration(context, context.getResources(), + realSize.x, realSize.y, + dm.widthPixels, dm.heightPixels); return grid; } public DynamicGrid getDynamicGrid() { |