diff options
-rw-r--r-- | src/com/android/launcher3/InvariantDeviceProfile.java | 18 | ||||
-rw-r--r-- | src/com/android/launcher3/LauncherAppState.java | 3 | ||||
-rw-r--r-- | src/com/android/launcher3/model/GridSizeMigrationTask.java | 18 |
3 files changed, 39 insertions, 0 deletions
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index e3c6965f7..8aeab8712 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -29,6 +29,7 @@ import android.view.WindowManager; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.config.ProviderConfig; +import com.android.launcher3.logging.FileLog; import com.android.launcher3.util.Thunk; import org.xmlpull.v1.XmlPullParser; @@ -187,6 +188,23 @@ public class InvariantDeviceProfile { } } + public void dumpDisplayInfo(Context context) { + WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); + Display display = wm.getDefaultDisplay(); + DisplayMetrics dm = new DisplayMetrics(); + display.getMetrics(dm); + + Point smallestSize = new Point(); + Point largestSize = new Point(); + display.getCurrentSizeRange(smallestSize, largestSize); + + FileLog.e("DisplayInfo", "Default Density: " + DisplayMetrics.DENSITY_DEFAULT); + FileLog.e("DisplayInfo", "Density: " + dm.densityDpi); + FileLog.e("DisplayInfo", "Smallest size: " + smallestSize); + FileLog.e("DisplayInfo", "Largest size: " + largestSize); + FileLog.e("DisplayInfo", "minWidth/Height DPS: " + minWidthDps + ", " + minHeightDps); + } + ArrayList<InvariantDeviceProfile> getPredefinedDeviceProfiles(Context context) { ArrayList<InvariantDeviceProfile> profiles = new ArrayList<>(); try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) { diff --git a/src/com/android/launcher3/LauncherAppState.java b/src/com/android/launcher3/LauncherAppState.java index 55c370387..e0e53a647 100644 --- a/src/com/android/launcher3/LauncherAppState.java +++ b/src/com/android/launcher3/LauncherAppState.java @@ -28,6 +28,7 @@ import com.android.launcher3.compat.PackageInstallerCompat; import com.android.launcher3.compat.UserManagerCompat; import com.android.launcher3.config.ProviderConfig; import com.android.launcher3.dynamicui.ExtractionUtils; +import com.android.launcher3.model.GridSizeMigrationTask; import com.android.launcher3.util.ConfigMonitor; import com.android.launcher3.util.Preconditions; import com.android.launcher3.util.TestingUtils; @@ -53,6 +54,8 @@ public class LauncherAppState { if (INSTANCE == null) { if (Looper.myLooper() == Looper.getMainLooper()) { INSTANCE = new LauncherAppState(context.getApplicationContext()); + GridSizeMigrationTask.logDeviceProfileIfChanged( + INSTANCE.getInvariantDeviceProfile(), context); } else { try { return new MainThreadExecutor().submit(new Callable<LauncherAppState>() { diff --git a/src/com/android/launcher3/model/GridSizeMigrationTask.java b/src/com/android/launcher3/model/GridSizeMigrationTask.java index bbc7ae461..01808c5ca 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationTask.java +++ b/src/com/android/launcher3/model/GridSizeMigrationTask.java @@ -27,6 +27,7 @@ import com.android.launcher3.Workspace; import com.android.launcher3.compat.AppWidgetManagerCompat; import com.android.launcher3.compat.PackageInstallerCompat; import com.android.launcher3.config.FeatureFlags; +import com.android.launcher3.logging.FileLog; import com.android.launcher3.util.GridOccupancy; import com.android.launcher3.util.LongArrayMap; @@ -889,6 +890,23 @@ public class GridSizeMigrationTask { .apply(); } + public static void logDeviceProfileIfChanged(InvariantDeviceProfile idp, Context context) { + SharedPreferences prefs = Utilities.getPrefs(context); + String gridSizeString = getPointString(idp.numColumns, idp.numRows); + + int oldHotseatCount = prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, idp.numHotseatIcons); + String oldSize = prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, gridSizeString); + if (gridSizeString.equals(oldSize) && idp.numHotseatIcons == oldHotseatCount) { + // Skip if workspace and hotseat sizes have not changed. + return; + } + + FileLog.e(TAG, "Grid size changed" + gridSizeString); + FileLog.e(TAG, " oldSize: " + oldSize + " , hotseat: " + oldHotseatCount); + FileLog.e(TAG, " newSize: " + gridSizeString + " , hotseat: " + idp.numHotseatIcons); + idp.dumpDisplayInfo(context); + } + /** * Migrates the workspace and hotseat in case their sizes changed. * @return false if the migration failed. |