diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java index 3f4dfd2330..676ea69a81 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/BaseSwipeUpHandler.java @@ -44,7 +44,6 @@ import android.os.Vibrator; import android.provider.Settings; import android.view.MotionEvent; import android.view.View; -import android.view.WindowManager; import android.view.animation.Interpolator; import androidx.annotation.UiThread; @@ -274,7 +273,7 @@ public abstract class BaseSwipeUpHandler { */ @TargetApi(Build.VERSION_CODES.Q) public class TouchInteractionService extends Service implements - NavigationModeChangeListener, DisplayListener { + NavigationModeChangeListener, DefaultDisplay.DisplayInfoChangeListener { /** * NOTE: This value should be kept same as @@ -323,8 +323,7 @@ public class TouchInteractionService extends Service implements registerReceiver(mUserUnlockedReceiver, new IntentFilter(Intent.ACTION_USER_UNLOCKED)); } - mDefaultDisplayId = getSystemService(WindowManager.class).getDefaultDisplay() - .getDisplayId(); + mDefaultDisplayId = DefaultDisplay.INSTANCE.get(this).getInfo().id; String blockingActivity = getString(R.string.gesture_blocking_activity); mGestureBlockingActivity = TextUtils.isEmpty(blockingActivity) ? null : ComponentName.unflattenFromString(blockingActivity); @@ -391,9 +390,8 @@ public class TouchInteractionService extends Service implements return; } - Display defaultDisplay = getSystemService(WindowManager.class).getDefaultDisplay(); - Point realSize = new Point(); - defaultDisplay.getRealSize(realSize); + DefaultDisplay.Info displayInfo = DefaultDisplay.INSTANCE.get(this).getInfo(); + Point realSize = new Point(displayInfo.realSize); mSwipeTouchRegion.set(0, 0, realSize.x, realSize.y); if (mMode == Mode.NO_BUTTON) { int touchHeight = getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE); @@ -415,7 +413,7 @@ public class TouchInteractionService extends Service implements } else { mAssistantLeftRegion.setEmpty(); mAssistantRightRegion.setEmpty(); - switch (defaultDisplay.getRotation()) { + switch (displayInfo.rotation) { case Surface.ROTATION_90: mSwipeTouchRegion.left = mSwipeTouchRegion.right - getNavbarSize(ResourceUtils.NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE); @@ -438,10 +436,9 @@ public class TouchInteractionService extends Service implements } if (mMode.hasGestures != newMode.hasGestures) { if (newMode.hasGestures) { - getSystemService(DisplayManager.class).registerDisplayListener( - this, MAIN_EXECUTOR.getHandler()); + DefaultDisplay.INSTANCE.get(this).addChangeListener(this); } else { - getSystemService(DisplayManager.class).unregisterDisplayListener(this); + DefaultDisplay.INSTANCE.get(this).removeChangeListener(this); } } mMode = newMode; @@ -457,14 +454,8 @@ public class TouchInteractionService extends Service implements } @Override - public void onDisplayAdded(int i) { } - - @Override - public void onDisplayRemoved(int i) { } - - @Override - public void onDisplayChanged(int displayId) { - if (displayId != mDefaultDisplayId) { + public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) { + if (info.id != mDefaultDisplayId) { return; } @@ -529,7 +520,7 @@ public class TouchInteractionService extends Service implements } disposeEventHandlers(); if (mMode.hasGestures) { - getSystemService(DisplayManager.class).unregisterDisplayListener(this); + DefaultDisplay.INSTANCE.get(this).removeChangeListener(this); } sConnected = false; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java index 0743925b82..b24c788107 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java @@ -18,6 +18,7 @@ package com.android.quickstep.inputconsumers; import static android.view.MotionEvent.ACTION_CANCEL; import static android.view.MotionEvent.ACTION_POINTER_DOWN; import static android.view.MotionEvent.ACTION_UP; + import static com.android.launcher3.Utilities.squaredHypot; import static com.android.launcher3.Utilities.squaredTouchSlop; import static com.android.quickstep.MultiStateCallback.DEBUG_STATES; @@ -35,9 +36,10 @@ import android.graphics.RectF; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.ViewConfiguration; -import android.view.WindowManager; + import com.android.launcher3.R; import com.android.launcher3.Utilities; +import com.android.launcher3.util.DefaultDisplay; import com.android.quickstep.LockScreenRecentsActivity; import com.android.quickstep.MultiStateCallback; import com.android.quickstep.SwipeSharedState; @@ -103,8 +105,7 @@ public class DeviceLockedInputConsumer implements InputConsumer, mRunningTaskId = runningTaskId; // Do not use DeviceProfile as the user data might be locked - mDisplaySize = new Point(); - context.getSystemService(WindowManager.class).getDefaultDisplay().getRealSize(mDisplaySize); + mDisplaySize = DefaultDisplay.INSTANCE.get(context).getInfo().realSize; // Init states mStateCallback = new MultiStateCallback(STATE_NAMES); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/NavBarPosition.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/NavBarPosition.java index 3ce341d8cf..bbb318a027 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/NavBarPosition.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/NavBarPosition.java @@ -21,9 +21,9 @@ import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON; import android.content.Context; import android.view.Surface; -import android.view.WindowManager; import com.android.launcher3.graphics.RotationMode; +import com.android.launcher3.util.DefaultDisplay; import com.android.quickstep.SysUINavigationMode; /** @@ -36,8 +36,7 @@ public class NavBarPosition { public NavBarPosition(Context context) { mMode = SysUINavigationMode.getMode(context); - mDisplayRotation = context.getSystemService(WindowManager.class) - .getDefaultDisplay().getRotation(); + mDisplayRotation = DefaultDisplay.INSTANCE.get(context).getInfo().rotation; } public boolean isRightEdge() { diff --git a/quickstep/src/com/android/quickstep/BaseRecentsActivity.java b/quickstep/src/com/android/quickstep/BaseRecentsActivity.java index c84013257b..1ac7ed4a3c 100644 --- a/quickstep/src/com/android/quickstep/BaseRecentsActivity.java +++ b/quickstep/src/com/android/quickstep/BaseRecentsActivity.java @@ -157,6 +157,6 @@ public abstract class BaseRecentsActivity extends BaseDraggingActivity { public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) { super.dump(prefix, fd, writer, args); writer.println(prefix + "Misc:"); - dumpMisc(writer); + dumpMisc(prefix + "\t", writer); } } diff --git a/src/com/android/launcher3/BaseActivity.java b/src/com/android/launcher3/BaseActivity.java index 64550560ff..b28077f7cd 100644 --- a/src/com/android/launcher3/BaseActivity.java +++ b/src/com/android/launcher3/BaseActivity.java @@ -27,6 +27,8 @@ import android.content.Intent; import android.content.res.Configuration; import android.view.ContextThemeWrapper; +import androidx.annotation.IntDef; + import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.logging.StatsLogManager; import com.android.launcher3.logging.StatsLogUtils; @@ -44,8 +46,6 @@ import java.io.PrintWriter; import java.lang.annotation.Retention; import java.util.ArrayList; -import androidx.annotation.IntDef; - public abstract class BaseActivity extends Activity implements UserEventDelegate, LogStateProvider, ActivityContext { @@ -265,12 +265,13 @@ public abstract class BaseActivity extends Activity } } - protected void dumpMisc(PrintWriter writer) { - writer.println(" deviceProfile isTransposed=" + getDeviceProfile().isVerticalBarLayout()); - writer.println(" orientation=" + getResources().getConfiguration().orientation); - writer.println(" mSystemUiController: " + mSystemUiController); - writer.println(" mActivityFlags: " + mActivityFlags); - writer.println(" mForceInvisible: " + mForceInvisible); + protected void dumpMisc(String prefix, PrintWriter writer) { + writer.println(prefix + "deviceProfile isTransposed=" + + getDeviceProfile().isVerticalBarLayout()); + writer.println(prefix + "orientation=" + getResources().getConfiguration().orientation); + writer.println(prefix + "mSystemUiController: " + mSystemUiController); + writer.println(prefix + "mActivityFlags: " + mActivityFlags); + writer.println(prefix + "mForceInvisible: " + mForceInvisible); } public static T fromContext(Context context) { diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java index f61051ff1a..994ba65a40 100644 --- a/src/com/android/launcher3/BaseDraggingActivity.java +++ b/src/com/android/launcher3/BaseDraggingActivity.java @@ -30,6 +30,8 @@ import android.view.ActionMode; import android.view.View; import android.widget.Toast; +import androidx.annotation.Nullable; + import com.android.launcher3.LauncherSettings.Favorites; import com.android.launcher3.compat.LauncherAppsCompat; import com.android.launcher3.model.AppLaunchTracker; @@ -39,8 +41,6 @@ import com.android.launcher3.uioverrides.WallpaperColorInfo; import com.android.launcher3.util.PackageManagerHelper; import com.android.launcher3.util.Themes; -import androidx.annotation.Nullable; - /** * Extension of BaseActivity allowing support for drag-n-drop */ @@ -241,14 +241,14 @@ public abstract class BaseDraggingActivity extends BaseActivity protected void onDeviceProfileInitiated() { if (mDeviceProfile.isVerticalBarLayout()) { mRotationListener.enable(); - mDeviceProfile.updateIsSeascape(getWindowManager()); + mDeviceProfile.updateIsSeascape(this); } else { mRotationListener.disable(); } } private void onDeviceRotationChanged() { - if (mDeviceProfile.updateIsSeascape(getWindowManager())) { + if (mDeviceProfile.updateIsSeascape(this)) { reapplyUi(); } } diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index 883e8c642b..61f247c391 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -24,12 +24,12 @@ import android.graphics.PointF; import android.graphics.Rect; import android.util.DisplayMetrics; import android.view.Surface; -import android.view.WindowManager; import com.android.launcher3.CellLayout.ContainerType; import com.android.launcher3.graphics.IconShape; import com.android.launcher3.icons.DotRenderer; import com.android.launcher3.icons.IconNormalizer; +import com.android.launcher3.util.DefaultDisplay; public class DeviceProfile { @@ -544,9 +544,10 @@ public class DeviceProfile { /** * Updates orientation information and returns true if it has changed from the previous value. */ - public boolean updateIsSeascape(WindowManager wm) { + public boolean updateIsSeascape(Context context) { if (isVerticalBarLayout()) { - boolean isSeascape = wm.getDefaultDisplay().getRotation() == Surface.ROTATION_270; + boolean isSeascape = DefaultDisplay.INSTANCE.get(context).getInfo().rotation + == Surface.ROTATION_270; if (mIsSeascape != isSeascape) { mIsSeascape = isSeascape; return true; diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 8ee530f0f9..208a822eba 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -40,14 +40,13 @@ import android.util.Log; import android.util.SparseArray; import android.util.TypedValue; import android.util.Xml; -import android.view.Display; -import android.view.WindowManager; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import com.android.launcher3.graphics.IconShape; import com.android.launcher3.util.ConfigMonitor; +import com.android.launcher3.util.DefaultDisplay; import com.android.launcher3.util.IntArray; import com.android.launcher3.util.MainThreadInitializedObject; import com.android.launcher3.util.Themes; @@ -173,19 +172,17 @@ public class InvariantDeviceProfile { } private String initGrid(Context context, String gridName) { - WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); - Display display = wm.getDefaultDisplay(); - DisplayMetrics dm = new DisplayMetrics(); - display.getMetrics(dm); + DefaultDisplay.Info displayInfo = DefaultDisplay.INSTANCE.get(context).getInfo(); - Point smallestSize = new Point(); - Point largestSize = new Point(); - display.getCurrentSizeRange(smallestSize, largestSize); + Point smallestSize = new Point(displayInfo.smallestSize); + Point largestSize = new Point(displayInfo.largestSize); ArrayList allOptions = getPredefinedDeviceProfiles(context, gridName); // This guarantees that width < height - float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), dm); - float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), dm); + float minWidthDps = Utilities.dpiFromPx(Math.min(smallestSize.x, smallestSize.y), + displayInfo.metrics); + float minHeightDps = Utilities.dpiFromPx(Math.min(largestSize.x, largestSize.y), + displayInfo.metrics); // Sort the profiles based on the closeness to the device size Collections.sort(allOptions, (a, b) -> Float.compare(dist(minWidthDps, minHeightDps, a.minWidthDps, a.minHeightDps), @@ -211,16 +208,15 @@ public class InvariantDeviceProfile { iconSize = interpolatedDisplayOption.iconSize; iconShapePath = getIconShapePath(context); landscapeIconSize = interpolatedDisplayOption.landscapeIconSize; - iconBitmapSize = ResourceUtils.pxFromDp(iconSize, dm); + iconBitmapSize = ResourceUtils.pxFromDp(iconSize, displayInfo.metrics); iconTextSize = interpolatedDisplayOption.iconTextSize; fillResIconDpi = getLauncherIconDensity(iconBitmapSize); // If the partner customization apk contains any grid overrides, apply them // Supported overrides: numRows, numColumns, iconSize - applyPartnerDeviceProfileOverrides(context, dm); + applyPartnerDeviceProfileOverrides(context, displayInfo.metrics); - Point realSize = new Point(); - display.getRealSize(realSize); + Point realSize = new Point(displayInfo.realSize); // The real size never changes. smallSide and largeSide will remain the // same in any orientation. int smallSide = Math.min(realSize.x, realSize.y); diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 886fd8e638..61d05c1e6a 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -500,6 +500,8 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, // Load configuration-specific DeviceProfile mDeviceProfile = idp.getDeviceProfile(this); if (isInMultiWindowMode()) { + // Note: Calls to getSize() can't rely on our cached DefaultDisplay since it can return + // the app window size Display display = getWindowManager().getDefaultDisplay(); Point mwSize = new Point(); display.getSize(mwSize); @@ -943,8 +945,7 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } - protected void onStateSet(LauncherState state) { - getAppWidgetHost().setResumed(state == LauncherState.NORMAL); + public void onStateSetStart(LauncherState state) { if (mDeferredResumePending) { handleDeferredResume(); } @@ -953,6 +954,12 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } } + public void onStateSetEnd(LauncherState state) { + getAppWidgetHost().setResumed(state == LauncherState.NORMAL); + getWorkspace().setClipChildren(!state.disablePageClipping); + finishAutoCancelActionMode(); + } + @Override protected void onResume() { RaceConditionTracker.onEvent(ON_RESUME_EVT, ENTER); @@ -2470,14 +2477,16 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns, } writer.println(prefix + "Misc:"); - writer.print(prefix + "\tmWorkspaceLoading=" + mWorkspaceLoading); - writer.print(" mPendingRequestArgs=" + mPendingRequestArgs); - writer.println(" mPendingActivityResult=" + mPendingActivityResult); - writer.println(" mRotationHelper: " + mRotationHelper); + dumpMisc(prefix + "\t", writer); + writer.println(prefix + "\tmWorkspaceLoading=" + mWorkspaceLoading); + writer.println(prefix + "\tmPendingRequestArgs=" + mPendingRequestArgs + + " mPendingActivityResult=" + mPendingActivityResult); + writer.println(prefix + "\tmRotationHelper: " + mRotationHelper); + writer.println(prefix + "\tmAppWidgetHost.isListening: " + mAppWidgetHost.isListening()); + // Extra logging for b/116853349 mDragLayer.dump(prefix, writer); mStateManager.dump(prefix, writer); - dumpMisc(writer); try { FileLog.flushAll(writer); diff --git a/src/com/android/launcher3/LauncherAppWidgetHost.java b/src/com/android/launcher3/LauncherAppWidgetHost.java index 7f5ac52760..ffdd6b70bc 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHost.java +++ b/src/com/android/launcher3/LauncherAppWidgetHost.java @@ -105,6 +105,10 @@ public class LauncherAppWidgetHost extends AppWidgetHost { super.stopListening(); } + public boolean isListening() { + return (mFlags & FLAG_LISTENING) != 0; + } + /** * Updates the resumed state of the host. * When a host is not resumed, it defers calls to startListening until host is resumed again. diff --git a/src/com/android/launcher3/LauncherStateManager.java b/src/com/android/launcher3/LauncherStateManager.java index 63914b0eb5..6bfae1311f 100644 --- a/src/com/android/launcher3/LauncherStateManager.java +++ b/src/com/android/launcher3/LauncherStateManager.java @@ -136,7 +136,7 @@ public class LauncherStateManager { } public void dump(String prefix, PrintWriter writer) { - writer.println(prefix + "LauncherState"); + writer.println(prefix + "LauncherState:"); writer.println(prefix + "\tmLastStableState:" + mLastStableState); writer.println(prefix + "\tmCurrentStableState:" + mCurrentStableState); writer.println(prefix + "\tmState:" + mState); @@ -418,7 +418,7 @@ public class LauncherStateManager { " @ " + Log.getStackTraceString(new Throwable())); } mState.onStateEnabled(mLauncher); - mLauncher.onStateSet(mState); + mLauncher.onStateSetStart(mState); if (state.disablePageClipping) { // Only disable clipping if needed, otherwise leave it as previous value. @@ -444,8 +444,7 @@ public class LauncherStateManager { } state.onStateTransitionEnd(mLauncher); - mLauncher.getWorkspace().setClipChildren(!state.disablePageClipping); - mLauncher.finishAutoCancelActionMode(); + mLauncher.onStateSetEnd(state); if (state == NORMAL) { setRestState(null); diff --git a/src/com/android/launcher3/util/ConfigMonitor.java b/src/com/android/launcher3/util/ConfigMonitor.java index 4ae84d808a..0f81520578 100644 --- a/src/com/android/launcher3/util/ConfigMonitor.java +++ b/src/com/android/launcher3/util/ConfigMonitor.java @@ -17,7 +17,6 @@ package com.android.launcher3.util; */ import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; -import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR; import android.content.BroadcastReceiver; import android.content.Context; @@ -25,11 +24,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.graphics.Point; -import android.hardware.display.DisplayManager; -import android.hardware.display.DisplayManager.DisplayListener; import android.util.Log; -import android.view.Display; -import android.view.WindowManager; import java.util.function.Consumer; @@ -37,7 +32,8 @@ import java.util.function.Consumer; * {@link BroadcastReceiver} which watches configuration changes and * notifies the callback in case changes which affect the device profile occur. */ -public class ConfigMonitor extends BroadcastReceiver implements DisplayListener { +public class ConfigMonitor extends BroadcastReceiver implements + DefaultDisplay.DisplayInfoChangeListener { private static final String TAG = "ConfigMonitor"; @@ -61,24 +57,19 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener mFontScale = config.fontScale; mDensity = config.densityDpi; - Display display = getDefaultDisplay(context); - mDisplayId = display.getDisplayId(); + DefaultDisplay display = DefaultDisplay.INSTANCE.get(context); + display.addChangeListener(this); + DefaultDisplay.Info displayInfo = display.getInfo(); + mDisplayId = displayInfo.id; - mRealSize = new Point(); - display.getRealSize(mRealSize); - - mSmallestSize = new Point(); - mLargestSize = new Point(); - display.getCurrentSizeRange(mSmallestSize, mLargestSize); + mRealSize = new Point(displayInfo.realSize); + mSmallestSize = new Point(displayInfo.smallestSize); + mLargestSize = new Point(displayInfo.largestSize); mCallback = callback; // Listen for configuration change mContext.registerReceiver(this, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED)); - - // Listen for display manager change - mContext.getSystemService(DisplayManager.class) - .registerDisplayListener(this, UI_HELPER_EXECUTOR.getHandler()); } @Override @@ -91,26 +82,19 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener } @Override - public void onDisplayAdded(int displayId) { } - - @Override - public void onDisplayRemoved(int displayId) { } - - @Override - public void onDisplayChanged(int displayId) { - if (displayId != mDisplayId) { + public void onDisplayInfoChanged(DefaultDisplay.Info info, int flags) { + if (info.id != mDisplayId) { return; } - Display display = getDefaultDisplay(mContext); - display.getRealSize(mTmpPoint1); - + mTmpPoint1.set(info.realSize.x, info.realSize.y); if (!mRealSize.equals(mTmpPoint1) && !mRealSize.equals(mTmpPoint1.y, mTmpPoint1.x)) { Log.d(TAG, String.format("Display size changed from %s to %s", mRealSize, mTmpPoint1)); notifyChange(); return; } - display.getCurrentSizeRange(mTmpPoint1, mTmpPoint2); + mTmpPoint1.set(info.smallestSize.x, info.smallestSize.y); + mTmpPoint2.set(info.largestSize.x, info.largestSize.y); if (!mSmallestSize.equals(mTmpPoint1) || !mLargestSize.equals(mTmpPoint2)) { Log.d(TAG, String.format("Available size changed from [%s, %s] to [%s, %s]", mSmallestSize, mLargestSize, mTmpPoint1, mTmpPoint2)); @@ -126,14 +110,11 @@ public class ConfigMonitor extends BroadcastReceiver implements DisplayListener } } - private Display getDefaultDisplay(Context context) { - return context.getSystemService(WindowManager.class).getDefaultDisplay(); - } - public void unregister() { try { mContext.unregisterReceiver(this); - mContext.getSystemService(DisplayManager.class).unregisterDisplayListener(this); + DefaultDisplay display = DefaultDisplay.INSTANCE.get(mContext); + display.removeChangeListener(this); } catch (Exception e) { Log.e(TAG, "Failed to unregister config monitor", e); } diff --git a/src/com/android/launcher3/util/DefaultDisplay.java b/src/com/android/launcher3/util/DefaultDisplay.java index 4080e212bc..8529d50cad 100644 --- a/src/com/android/launcher3/util/DefaultDisplay.java +++ b/src/com/android/launcher3/util/DefaultDisplay.java @@ -23,6 +23,7 @@ import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.DisplayListener; import android.os.Handler; import android.os.Message; +import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; import android.view.WindowManager; @@ -124,6 +125,8 @@ public class DefaultDisplay implements DisplayListener { public final Point smallestSize; public final Point largestSize; + public final DisplayMetrics metrics; + private Info(Context context) { Display display = context.getSystemService(WindowManager.class).getDefaultDisplay(); @@ -138,6 +141,9 @@ public class DefaultDisplay implements DisplayListener { largestSize = new Point(); display.getRealSize(realSize); display.getCurrentSizeRange(smallestSize, largestSize); + + metrics = new DisplayMetrics(); + display.getMetrics(metrics); } private boolean hasDifferentSize(Info info) { diff --git a/src/com/android/launcher3/views/BaseDragLayer.java b/src/com/android/launcher3/views/BaseDragLayer.java index c08b659313..2a4c5a7bfe 100644 --- a/src/com/android/launcher3/views/BaseDragLayer.java +++ b/src/com/android/launcher3/views/BaseDragLayer.java @@ -465,7 +465,7 @@ public abstract class BaseDragLayer } public void dump(String prefix, PrintWriter writer) { - writer.println(prefix + "DragLayer"); + writer.println(prefix + "DragLayer:"); if (mActiveController != null) { writer.println(prefix + "\tactiveController: " + mActiveController); mActiveController.dump(prefix + "\t", writer);