Don't try to create an app state instance during restore.
Added a static utility function to get the DeviceProfile instead.
Bug: 18504164
Change-Id: Ia510a84f1c195e58acf3bf4d1f6a42c739fdd413
diff --git a/src/com/android/launcher3/LauncherBackupHelper.java b/src/com/android/launcher3/LauncherBackupHelper.java
index c260fbc..4374347 100644
--- a/src/com/android/launcher3/LauncherBackupHelper.java
+++ b/src/com/android/launcher3/LauncherBackupHelper.java
@@ -371,16 +371,9 @@
if (mCurrentProfile != null) {
return mCurrentProfile;
}
- LauncherAppState.setApplicationContext(mContext.getApplicationContext());
- LauncherAppState app = LauncherAppState.getInstance();
-
- DeviceProfile profile;
- if (app.getDynamicGrid() == null) {
- // Initialize the grid
- profile = app.initDynamicGrid(mContext);
- } else {
- profile = app.getDynamicGrid().getDeviceProfile();
- }
+ final Context applicationContext = mContext.getApplicationContext();
+ DeviceProfile profile = LauncherAppState.createDynamicGrid(applicationContext, null)
+ .getDeviceProfile();
mCurrentProfile = new DeviceProfieData();
mCurrentProfile.desktopRows = profile.numRows;