Add fixed_rotation_transform to home settings

This sets the feature flag on launcher side
and also updates the setting in Settings.Global
Launcher DOES NOT listen to the Settings.Global
change from adb anymore. This should take
preference over setting it from command line.

Also fix a related swipe to home animation bug
that happened w/ merge conflict.

Fixes: 150260456
Test: Set and unset, visually verified behavior.
Tested w/ autorotate on and off.
Checked Settings.Global value correctly updated
via "adb shell settings get global
fixed_rotation_transform"
TODO: Update tests to reflect this new
default-on fixed rotation behavior.

Change-Id: Id95f006eb1e92a59e24b05567298fd21b1409b13
This commit is contained in:
Vinit Nayak 2020-03-04 12:05:28 -08:00
parent 31ff98e144
commit b9ec9319c5
13 changed files with 162 additions and 91 deletions

View File

@ -46,7 +46,9 @@
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<!-- TODO(b/150802536): Enabled only for ENABLE_FIXED_ROTATION_TRANSFORM feature flag -->
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
<!--
Permissions required for read/write access to the workspace data. These permission name
should not conflict with that defined in other apps, as such an app should embed its package

View File

@ -26,6 +26,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application
android:backupAgent="com.android.launcher3.LauncherBackupAgent"
android:fullBackupOnly="true"

View File

@ -482,10 +482,6 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
public void onUpdate(RectF currentRect, float progress) {
homeAnim.setPlayFraction(progress);
mTransformParams.setProgress(
Utilities.mapRange(progress, startTransformProgress, endTransformProgress))
.setCurrentRect(currentRect)
.setTargetAlpha(getWindowAlpha(progress));
rotatedRect.set(currentRect);
if (isFloatingIconView) {
RotationHelper.mapRectFromNormalOrientation(rotatedRect,
@ -493,6 +489,10 @@ public abstract class BaseSwipeUpHandler<T extends BaseDraggingActivity, Q exten
mTransformParams.setCornerRadius(endRadius * progress + startRadius
* (1f - progress));
}
mTransformParams.setProgress(
Utilities.mapRange(progress, startTransformProgress, endTransformProgress))
.setCurrentRect(rotatedRect)
.setTargetAlpha(getWindowAlpha(progress));
mAppWindowAnimationHelper.applyTransform(mTransformParams);
if (isFloatingIconView) {

View File

@ -502,8 +502,10 @@ public class TouchInteractionService extends Service implements PluginListener<O
? newBaseConsumer(previousGestureState, newGestureState, event)
: mResetGestureInputConsumer;
// TODO(b/149880412): 2 button landscape mode is wrecked. Fixit!
if (mDeviceState.isFullyGesturalNavMode()) {
if (mDeviceState.isGesturalNavMode()) {
handleOrientationSetup(base);
}
if (mDeviceState.isFullyGesturalNavMode()) {
if (mDeviceState.canTriggerAssistantAction(event)) {
base = new AssistantInputConsumer(this, newGestureState, base, mInputMonitorCompat);
}
@ -548,7 +550,7 @@ public class TouchInteractionService extends Service implements PluginListener<O
}
private void handleOrientationSetup(InputConsumer baseInputConsumer) {
if (!PagedView.sFlagForcedRotation) {
if (!FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get()) {
return;
}
mDeviceState.enableMultipleRegions(baseInputConsumer instanceof OtherActivityInputConsumer);

View File

@ -42,13 +42,13 @@ import com.android.launcher3.Hotseat;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.StateListener;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.views.ScrimView;
@ -287,7 +287,7 @@ public class LauncherRecentsView extends RecentsView<Launcher> implements StateL
@Override
protected boolean supportsVerticalLandscape() {
return PagedView.sFlagForcedRotation;
return FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get();
}
@Override

View File

@ -1520,7 +1520,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
@Override
public void setLayoutRotation(int touchRotation, int displayRotation) {
if (!sFlagForcedRotation) {
if (!FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get()) {
return;
}
@ -1972,7 +1972,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
public Consumer<MotionEvent> getEventDispatcher(RotationMode navBarRotationMode) {
float degreesRotated;
if (navBarRotationMode == RotationMode.NORMAL) {
degreesRotated = RotationHelper.getDegreesFromRotation(mLayoutRotation);
degreesRotated = mOrientationState.areMultipleLayoutOrientationsDisabled() ? 0 :
RotationHelper.getDegreesFromRotation(mLayoutRotation);
} else {
degreesRotated = -navBarRotationMode.surfaceRotation;
}
@ -1984,6 +1985,13 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
// undo that transformation since PagedView also accommodates for the transformation via
// PagedOrientationHandler
return e -> {
if (navBarRotationMode != RotationMode.NORMAL
&& !mOrientationState.areMultipleLayoutOrientationsDisabled()) {
RotationHelper.transformEventForNavBar(e, true);
super.onTouchEvent(e);
RotationHelper.transformEventForNavBar(e, false);
return;
}
RotationHelper.transformEvent(-degreesRotated, e, true);
super.onTouchEvent(e);
RotationHelper.transformEvent(-degreesRotated, e, false);

View File

@ -75,8 +75,12 @@ class OrientationTouchTransformer {
mContractInfo = contractInfo;
}
void setNavigationMode(SysUINavigationMode.Mode newMode) {
void setNavigationMode(SysUINavigationMode.Mode newMode, DefaultDisplay.Info info) {
if (mMode == newMode) {
return;
}
this.mMode = newMode;
resetSwipeRegions(info);
}
/**
@ -120,7 +124,9 @@ class OrientationTouchTransformer {
mQuickStepStartingRotation = -1;
resetSwipeRegions(info);
} else {
if (mQuickStepStartingRotation < 0) {
if (mLastRectTouched != null) {
// mLastRectTouched can be null if gesture type is changed (ex. from settings)
// but nav bar hasn't been interacted with yet.
mQuickStepStartingRotation = mLastRectTouched.mRotation;
}
}
@ -138,10 +144,8 @@ class OrientationTouchTransformer {
}
mCurrentRotation = region.rotation;
OrientationRectF regionToKeep = mSwipeTouchRegions.get(mCurrentRotation);
mSwipeTouchRegions.clear();
mSwipeTouchRegions.put(mCurrentRotation,
regionToKeep != null ? regionToKeep : createRegionForDisplay(region));
mSwipeTouchRegions.put(mCurrentRotation, createRegionForDisplay(region));
}
private OrientationRectF createRegionForDisplay(DefaultDisplay.Info display) {

View File

@ -47,9 +47,9 @@ import android.view.MotionEvent;
import androidx.annotation.BinderThread;
import com.android.launcher3.PagedView;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.util.DefaultDisplay;
import com.android.quickstep.SysUINavigationMode.NavigationModeChangeListener;
@ -100,13 +100,23 @@ public class RecentsAnimationDeviceState implements
}
};
private TaskStackChangeListener mFrozenTaskListener = new TaskStackChangeListener() {
@Override
public void onRecentTaskListFrozenChanged(boolean frozen) {
if (frozen) {
return;
}
mOrientationTouchTransformer.enableMultipleRegions(false, mDefaultDisplay.getInfo());
}
};
private OrientationTouchTransformer mOrientationTouchTransformer;
private Region mExclusionRegion;
private SystemGestureExclusionListenerCompat mExclusionListener;
private final List<ComponentName> mGestureBlockedActivities;
private TaskStackChangeListener mFrozenTaskListener;
private Runnable mOnDestroyFrozenTaskRunnable;
public RecentsAnimationDeviceState(Context context) {
final ContentResolver resolver = context.getContentResolver();
@ -136,7 +146,9 @@ public class RecentsAnimationDeviceState implements
};
runOnDestroy(mExclusionListener::unregister);
setupOrientationSwipeHandler(context);
Resources resources = mContext.getResources();
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
() -> QuickStepContract.getWindowCornerRadius(resources));
// Register for navigation mode changes
onNavigationModeChanged(mSysUiNavMode.addModeChangeListener(this));
@ -159,24 +171,20 @@ public class RecentsAnimationDeviceState implements
}
}
private void setupOrientationSwipeHandler(Context context) {
final Resources resources = context.getResources();
mOrientationTouchTransformer = new OrientationTouchTransformer(resources, mMode,
() -> QuickStepContract.getWindowCornerRadius(resources));
if (!PagedView.sFlagForcedRotation) {
private void setupOrientationSwipeHandler() {
if (!FeatureFlags.ENABLE_FIXED_ROTATION_TRANSFORM.get()) {
return;
}
mFrozenTaskListener = new TaskStackChangeListener() {
@Override
public void onRecentTaskListFrozenChanged(boolean frozen) {
mOrientationTouchTransformer.enableMultipleRegions(frozen, mDefaultDisplay.getInfo());
}
};
ActivityManagerWrapper.getInstance().registerTaskStackListener(mFrozenTaskListener);
runOnDestroy(() -> ActivityManagerWrapper.getInstance()
.unregisterTaskStackListener(mFrozenTaskListener));
mOnDestroyFrozenTaskRunnable = () -> ActivityManagerWrapper.getInstance()
.unregisterTaskStackListener(mFrozenTaskListener);
runOnDestroy(mOnDestroyFrozenTaskRunnable);
}
private void destroyOrientationSwipeHandlerCallback() {
ActivityManagerWrapper.getInstance().unregisterTaskStackListener(mFrozenTaskListener);
mOnDestroyActions.remove(mOnDestroyFrozenTaskRunnable);
}
private void runOnDestroy(Runnable action) {
@ -216,11 +224,17 @@ public class RecentsAnimationDeviceState implements
} else {
mExclusionListener.unregister();
}
mNavBarPosition = new NavBarPosition(newMode, mDefaultDisplay.getInfo());
mOrientationTouchTransformer.setNavigationMode(newMode, mDefaultDisplay.getInfo());
if (!mMode.hasGestures && newMode.hasGestures) {
setupOrientationSwipeHandler();
} else if (mMode.hasGestures && !newMode.hasGestures){
destroyOrientationSwipeHandlerCallback();
}
mMode = newMode;
mNavBarPosition = new NavBarPosition(mMode, mDefaultDisplay.getInfo());
mOrientationTouchTransformer.setNavigationMode(mMode);
}
@Override

View File

@ -72,8 +72,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
private static final String TAG = "PagedView";
private static final boolean DEBUG = false;
public static boolean sFlagForcedRotation = false;
public static final int INVALID_PAGE = -1;
protected static final ComputePageScrollsLogic SIMPLE_SCROLL_LOGIC = (v) -> v.getVisibility() != GONE;
@ -199,8 +197,6 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
if (Utilities.ATLEAST_OREO) {
setDefaultFocusHighlightEnabled(false);
}
sFlagForcedRotation = Utilities.isForcedRotation(context);
}
protected void setDefaultInterpolator(Interpolator interpolator) {

View File

@ -17,7 +17,6 @@
package com.android.launcher3;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_ICON_BADGED;
import static com.android.launcher3.states.RotationHelper.FIXED_ROTATION_TRANSFORM_SETTING_NAME;
import android.animation.ValueAnimator;
import android.annotation.TargetApi;
@ -61,6 +60,7 @@ import android.view.View;
import android.view.ViewConfiguration;
import android.view.animation.Interpolator;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.FolderAdaptiveIcon;
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.graphics.TintedDrawableSpan;
@ -128,11 +128,6 @@ public final class Utilities {
Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
public static boolean isForcedRotation(Context context) {
return Settings.Global.getInt(context.getContentResolver(),
FIXED_ROTATION_TRANSFORM_SETTING_NAME, 0) != 0;
}
// An intent extra to indicate the horizontal scroll of the wallpaper.
public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET";
public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR";
@ -481,6 +476,15 @@ public final class Utilities {
LauncherFiles.DEVICE_PREFERENCES_KEY, Context.MODE_PRIVATE);
}
/**
* @return {@link SharedPreferences} that backs {@link FeatureFlags}
*/
public static SharedPreferences getFeatureFlagsPrefs(Context context) {
// Use application context for shared preferences, so that we use a single cached instance
return context.getApplicationContext().getSharedPreferences(
FeatureFlags.FLAGS_PREF_NAME, Context.MODE_PRIVATE);
}
public static boolean areAnimationsEnabled(Context context) {
return ATLEAST_OREO
? ValueAnimator.areAnimatorsEnabled()

View File

@ -36,6 +36,8 @@ public final class FeatureFlags {
private static final List<DebugFlag> sDebugFlags = new ArrayList<>();
public static final String FLAGS_PREF_NAME = "featureFlags";
public static final String FLAG_ENABLE_FIXED_ROTATION_TRANSFORM =
"ENABLE_FIXED_ROTATION_TRANSFORM";
private FeatureFlags() { }
@ -153,6 +155,10 @@ public final class FeatureFlags {
"ALWAYS_USE_HARDWARE_OPTIMIZATION_FOR_FOLDER_ANIMATIONS", false,
"Always use hardware optimization for folder animations.");
public static final BooleanFlag ENABLE_FIXED_ROTATION_TRANSFORM = getDebugFlag(
FLAG_ENABLE_FIXED_ROTATION_TRANSFORM, true,
"Launch/close apps without rotation animation. Fix Launcher to portrait");
public static void initialize(Context context) {
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {

View File

@ -50,7 +50,16 @@ public final class PagedViewOrientedState {
*/
private boolean mDisableMultipleOrientations;
/**
* Sets the appropriate {@link PagedOrientationHandler} for {@link #mOrientationHandler}
* @param touchRotation The rotation the nav bar region that is touched is in
* @param displayRotation Rotation of the display/device
*/
public void update(int touchRotation, int displayRotation) {
if (mDisableMultipleOrientations) {
return;
}
mDisplayRotation = displayRotation;
mTouchRotation = touchRotation;
if (mTouchRotation == Surface.ROTATION_90) {
@ -62,20 +71,13 @@ public final class PagedViewOrientedState {
}
}
/**
* @return {@code true} if the area where the user touched the nav bar is the expected
* location for the given display rotation. Ex. bottom of phone in portrait, or left side of
* phone in landscape, right side in seascape, etc.
* False otherwise
*/
public boolean isTouchRegionNaturalForDisplay() {
return mTouchRotation == mDisplayRotation;
}
public boolean areMultipleLayoutOrientationsDisabled() {
return mDisableMultipleOrientations;
}
/**
* Setting this preference will render future calls to {@link #update(int, int)} as a no-op.
*/
public void disableMultipleOrientations(boolean disable) {
mDisableMultipleOrientations = disable;
if (disable) {

View File

@ -21,13 +21,13 @@ import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
import static android.util.DisplayMetrics.DENSITY_DEVICE_STABLE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.config.FeatureFlags.FLAG_ENABLE_FIXED_ROTATION_TRANSFORM;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import android.content.ContentResolver;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.RectF;
@ -72,26 +72,13 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
return originalSmallestWidth >= 600;
}
private final ContentObserver mContentObserver =
new ContentObserver(MAIN_EXECUTOR.getHandler()) {
@Override
public void onChange(boolean selfChange) {
boolean forcedRotation = Utilities.isForcedRotation(mLauncher);
PagedView.sFlagForcedRotation = forcedRotation;
updateForcedRotation();
for (ForcedRotationChangedListener listener : mForcedRotationChangedListeners) {
listener.onForcedRotationChanged(forcedRotation);
}
}
};
public static final int REQUEST_NONE = 0;
public static final int REQUEST_ROTATE = 1;
public static final int REQUEST_LOCK = 2;
private final Launcher mLauncher;
private final SharedPreferences mPrefs;
private final SharedPreferences mSharedPrefs;
private final SharedPreferences mFeatureFlagsPrefs;
private boolean mIgnoreAutoRotateSettings;
private boolean mAutoRotateEnabled;
@ -125,24 +112,42 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
// On large devices we do not handle auto-rotate differently.
mIgnoreAutoRotateSettings = mLauncher.getResources().getBoolean(R.bool.allow_rotation);
updateForcedRotation();
if (!mIgnoreAutoRotateSettings) {
mPrefs = Utilities.getPrefs(mLauncher);
mPrefs.registerOnSharedPreferenceChangeListener(this);
mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
mSharedPrefs = Utilities.getPrefs(mLauncher);
mSharedPrefs.registerOnSharedPreferenceChangeListener(this);
mAutoRotateEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue());
} else {
mPrefs = null;
mSharedPrefs = null;
}
// TODO(b/150260456) Add this in home settings as well
mContentResolver = launcher.getContentResolver();
mContentResolver.registerContentObserver(Settings.Global.getUriFor(
FIXED_ROTATION_TRANSFORM_SETTING_NAME), false, mContentObserver);
mFeatureFlagsPrefs = Utilities.getFeatureFlagsPrefs(mLauncher);
mFeatureFlagsPrefs.registerOnSharedPreferenceChangeListener(this);
updateForcedRotation(true);
}
private void updateForcedRotation() {
mForcedRotation = !getAllowRotationDefaultValue() && Utilities.isForcedRotation(mLauncher);
/**
* @param setValueFromPrefs If true, then {@link #mForcedRotation} will get set to the value
* from the home developer settings. Otherwise it will not.
* This is primarily to allow tests to set their own conditions.
*/
private void updateForcedRotation(boolean setValueFromPrefs) {
boolean isForcedRotation = mFeatureFlagsPrefs
.getBoolean(FLAG_ENABLE_FIXED_ROTATION_TRANSFORM, true)
&& !getAllowRotationDefaultValue();
if (mForcedRotation == isForcedRotation) {
return;
}
if (setValueFromPrefs) {
mForcedRotation = isForcedRotation;
}
UI_HELPER_EXECUTOR.execute(
() -> Settings.Global.putInt(mContentResolver, FIXED_ROTATION_TRANSFORM_SETTING_NAME,
mForcedRotation ? 1 : 0));
for (ForcedRotationChangedListener listener : mForcedRotationChangedListeners) {
listener.onForcedRotationChanged(mForcedRotation);
}
}
/**
@ -181,8 +186,13 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String s) {
if (FLAG_ENABLE_FIXED_ROTATION_TRANSFORM.equals(s)) {
updateForcedRotation(true);
return;
}
boolean wasRotationEnabled = mAutoRotateEnabled;
mAutoRotateEnabled = mPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
mAutoRotateEnabled = mSharedPrefs.getBoolean(ALLOW_ROTATION_PREFERENCE_KEY,
getAllowRotationDefaultValue());
if (mAutoRotateEnabled != wasRotationEnabled) {
@ -218,6 +228,10 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
public void forceAllowRotationForTesting(boolean allowRotation) {
mIgnoreAutoRotateSettings =
allowRotation || mLauncher.getResources().getBoolean(R.bool.allow_rotation);
// TODO(b/150214193) Tests currently expect launcher to be able to be rotated
// Modify tests for this new behavior
mForcedRotation = !allowRotation;
updateForcedRotation(false);
notifyChange();
}
@ -232,13 +246,11 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
public void destroy() {
if (!mDestroyed) {
mDestroyed = true;
if (mPrefs != null) {
mPrefs.unregisterOnSharedPreferenceChangeListener(this);
}
if (mContentResolver != null) {
mContentResolver.unregisterContentObserver(mContentObserver);
if (mSharedPrefs != null) {
mSharedPrefs.unregisterOnSharedPreferenceChangeListener(this);
}
mForcedRotationChangedListeners.clear();
mFeatureFlagsPrefs.unregisterOnSharedPreferenceChangeListener(this);
}
}
@ -293,7 +305,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
return degrees;
}
public static int getRotationFromDegrees(int degrees) {
public static int getRotationFromDegrees(float degrees) {
int threshold = 70;
if (degrees >= (360 - threshold) || degrees < (threshold)) {
return Surface.ROTATION_0;
@ -317,12 +329,31 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
return delta;
}
/**
* For landscape, since the navbar is already in a vertical position, we don't have to do any
* rotations as the change in Y coordinate is what is read. We only flip the sign of the
* y coordinate to make it match existing behavior of swipe to the top to go previous
*/
public static void transformEventForNavBar(MotionEvent ev, boolean inverse) {
// TODO(b/151269990): Use a temp matrix
Matrix m = new Matrix();
m.setScale(1, -1);
if (inverse) {
Matrix inv = new Matrix();
m.invert(inv);
ev.transform(inv);
} else {
ev.transform(m);
}
}
/**
* Creates a matrix to transform the given motion event specified by degrees.
* If {@param inverse} is {@code true}, the inverse of that matrix will be applied
*/
public static void transformEvent(float degrees, MotionEvent ev, boolean inverse) {
Matrix transform = new Matrix();
// TODO(b/151269990): Use a temp matrix
transform.setRotate(degrees);
if (inverse) {
Matrix inv = new Matrix();
@ -344,6 +375,7 @@ public class RotationHelper implements OnSharedPreferenceChangeListener {
*/
public static Matrix getRotationMatrix(int screenWidth, int screenHeight, int displayRotation) {
Matrix m = new Matrix();
// TODO(b/151269990): Use a temp matrix
switch (displayRotation) {
case Surface.ROTATION_0:
return m;