Loading packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +14 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.recents; import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE; import android.animation.ArgbEvaluator; Loading @@ -27,6 +28,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; import android.os.Binder; Loading Loading @@ -186,7 +188,7 @@ public class ScreenPinningRequest implements View.OnClickListener, DisplayMetrics metrics = new DisplayMetrics(); mWindowManager.getDefaultDisplay().getMetrics(metrics); float density = metrics.density; int rotation = RotationUtils.getRotation(mContext); int rotation = getRotation(mContext); inflateView(rotation); int bgColor = mContext.getColor( Loading Loading @@ -342,14 +344,23 @@ public class ScreenPinningRequest implements View.OnClickListener, protected void onConfigurationChanged() { removeAllViews(); inflateView(RotationUtils.getRotation(mContext)); inflateView(getRotation(mContext)); } private int getRotation(Context context) { Configuration config = context.getResources().getConfiguration(); if (config.smallestScreenWidthDp >= 600) { return ROTATION_NONE; } return RotationUtils.getRotation(context); } private final Runnable mUpdateLayoutRunnable = new Runnable() { @Override public void run() { if (mLayout != null && mLayout.getParent() != null) { mLayout.setLayoutParams(getRequestLayoutParams(RotationUtils.getRotation(mContext))); mLayout.setLayoutParams(getRequestLayoutParams(getRotation(mContext))); } } }; Loading packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java +14 −19 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ package com.android.systemui.util.leak; import android.content.Context; import android.content.res.Configuration; import android.view.Surface; public class RotationUtils { Loading @@ -26,30 +25,26 @@ public class RotationUtils { public static final int ROTATION_UPSIDE_DOWN = 3; public static int getRotation(Context context) { Configuration config = context.getResources().getConfiguration(); int rot = context.getDisplay().getRotation(); if (config.smallestScreenWidthDp < 600) { if (rot == Surface.ROTATION_90) { return ROTATION_LANDSCAPE; } else if (rot == Surface.ROTATION_270) { return ROTATION_SEASCAPE; } } } else { return ROTATION_NONE; } } public static int getExactRotation(Context context) { Configuration config = context.getResources().getConfiguration(); int rot = context.getDisplay().getRotation(); if (config.smallestScreenWidthDp < 600) { if (rot == Surface.ROTATION_90) { return ROTATION_LANDSCAPE; } else if (rot == Surface.ROTATION_270) { return ROTATION_SEASCAPE; } else if (rot == Surface.ROTATION_180) { return ROTATION_UPSIDE_DOWN; } } } else { return ROTATION_NONE; } } } Loading
packages/SystemUI/src/com/android/systemui/recents/ScreenPinningRequest.java +14 −3 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.recents; import static com.android.systemui.util.leak.RotationUtils.ROTATION_LANDSCAPE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_NONE; import static com.android.systemui.util.leak.RotationUtils.ROTATION_SEASCAPE; import android.animation.ArgbEvaluator; Loading @@ -27,6 +28,7 @@ import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.drawable.ColorDrawable; import android.os.Binder; Loading Loading @@ -186,7 +188,7 @@ public class ScreenPinningRequest implements View.OnClickListener, DisplayMetrics metrics = new DisplayMetrics(); mWindowManager.getDefaultDisplay().getMetrics(metrics); float density = metrics.density; int rotation = RotationUtils.getRotation(mContext); int rotation = getRotation(mContext); inflateView(rotation); int bgColor = mContext.getColor( Loading Loading @@ -342,14 +344,23 @@ public class ScreenPinningRequest implements View.OnClickListener, protected void onConfigurationChanged() { removeAllViews(); inflateView(RotationUtils.getRotation(mContext)); inflateView(getRotation(mContext)); } private int getRotation(Context context) { Configuration config = context.getResources().getConfiguration(); if (config.smallestScreenWidthDp >= 600) { return ROTATION_NONE; } return RotationUtils.getRotation(context); } private final Runnable mUpdateLayoutRunnable = new Runnable() { @Override public void run() { if (mLayout != null && mLayout.getParent() != null) { mLayout.setLayoutParams(getRequestLayoutParams(RotationUtils.getRotation(mContext))); mLayout.setLayoutParams(getRequestLayoutParams(getRotation(mContext))); } } }; Loading
packages/SystemUI/src/com/android/systemui/util/leak/RotationUtils.java +14 −19 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ package com.android.systemui.util.leak; import android.content.Context; import android.content.res.Configuration; import android.view.Surface; public class RotationUtils { Loading @@ -26,30 +25,26 @@ public class RotationUtils { public static final int ROTATION_UPSIDE_DOWN = 3; public static int getRotation(Context context) { Configuration config = context.getResources().getConfiguration(); int rot = context.getDisplay().getRotation(); if (config.smallestScreenWidthDp < 600) { if (rot == Surface.ROTATION_90) { return ROTATION_LANDSCAPE; } else if (rot == Surface.ROTATION_270) { return ROTATION_SEASCAPE; } } } else { return ROTATION_NONE; } } public static int getExactRotation(Context context) { Configuration config = context.getResources().getConfiguration(); int rot = context.getDisplay().getRotation(); if (config.smallestScreenWidthDp < 600) { if (rot == Surface.ROTATION_90) { return ROTATION_LANDSCAPE; } else if (rot == Surface.ROTATION_270) { return ROTATION_SEASCAPE; } else if (rot == Surface.ROTATION_180) { return ROTATION_UPSIDE_DOWN; } } } else { return ROTATION_NONE; } } }