diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2014-10-16 09:24:19 -0700 |
---|---|---|
committer | Danesh M <daneshm90@gmail.com> | 2015-09-27 18:55:56 -0700 |
commit | 8d43f06829523a920904c958e6545648b0b0c200 (patch) | |
tree | 642c551460c3ef832525a71069ceb7d0e3ce90d1 /src/com/android/launcher3/LauncherAppState.java | |
parent | 78e301e3cf00d6f57ec1d131979a47294d3b3668 (diff) | |
download | android_packages_apps_Trebuchet-8d43f06829523a920904c958e6545648b0b0c200.tar.gz android_packages_apps_Trebuchet-8d43f06829523a920904c958e6545648b0b0c200.tar.bz2 android_packages_apps_Trebuchet-8d43f06829523a920904c958e6545648b0b0c200.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 | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 6e3f80769..40d197139 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; @@ -189,20 +193,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) { - - mDynamicGrid = new DynamicGrid(context, - context.getResources(), - minWidth, minHeight, width, height, - availableWidth, availableHeight); - mDynamicGrid.getDeviceProfile().addCallback(this); + 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(), + 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() { |