Loading services/core/java/com/android/server/wm/DisplayRotation.java +0 −14 Original line number Diff line number Diff line Loading @@ -1539,20 +1539,6 @@ public class DisplayRotation { } } @Override public boolean canUseRotationResolver() { if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) return false; switch (mCurrentAppOrientation) { case ActivityInfo.SCREEN_ORIENTATION_FULL_USER: case ActivityInfo.SCREEN_ORIENTATION_USER: case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE: case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT: return true; } return false; } @Override public void onProposedRotationChanged(int rotation) { Loading services/core/java/com/android/server/wm/WindowOrientationListener.java +1 −14 Original line number Diff line number Diff line Loading @@ -275,19 +275,6 @@ public abstract class WindowOrientationListener { } } /** * Returns true if the current status of the phone is suitable for using rotation resolver * service. * * To reduce the power consumption of rotation resolver service, rotation query should run less * frequently than other low power orientation sensors. This method is used to check whether * the current status of the phone is necessary to request a suggested screen rotation from the * rotation resolver service. Note that it always returns {@code false} in the base class. It * should be overridden in the derived classes. */ public boolean canUseRotationResolver() { return false; } /** * Returns true if the rotation resolver feature is enabled by setting. It means {@link Loading Loading @@ -1155,7 +1142,7 @@ public abstract class WindowOrientationListener { } } if (isRotationResolverEnabled() && canUseRotationResolver()) { if (isRotationResolverEnabled()) { if (mRotationResolverService == null) { mRotationResolverService = LocalServices.getService( RotationResolverInternal.class); Loading services/tests/servicestests/src/com/android/server/wm/WindowOrientationListenerTest.java +0 −17 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public class WindowOrientationListenerTest { private com.android.server.wm.WindowOrientationListener mWindowOrientationListener; private int mFinalizedRotation; private boolean mRotationResolverEnabled; private boolean mCanUseRotationResolver; private SensorEvent mFakeSensorEvent; private Sensor mFakeSensor; Loading @@ -66,7 +65,6 @@ public class WindowOrientationListenerTest { public void setUp() { MockitoAnnotations.initMocks(this); mRotationResolverEnabled = true; mCanUseRotationResolver = true; mFakeRotationResolverInternal = new TestableRotationResolver(); doReturn(mMockSensorManager).when(mMockContext).getSystemService(Context.SENSOR_SERVICE); Loading @@ -88,16 +86,6 @@ public class WindowOrientationListenerTest { assertThat(mFinalizedRotation).isEqualTo(Surface.ROTATION_90); } @Test public void testOnSensorChanged_cannotUseRotationResolver_useSensorResult() { mCanUseRotationResolver = false; mWindowOrientationListener.mOrientationJudge.onSensorChanged(mFakeSensorEvent); assertThat(mFinalizedRotation).isEqualTo(Surface.ROTATION_90); } @Test public void testOnSensorChanged_normalCase() { mFakeRotationResolverInternal.mResult = Surface.ROTATION_180; Loading Loading @@ -138,11 +126,6 @@ public class WindowOrientationListenerTest { mFinalizedRotation = rotation; } @Override public boolean canUseRotationResolver() { return mCanUseRotationResolver; } @Override public boolean isRotationResolverEnabled() { return mRotationResolverEnabled; Loading Loading
services/core/java/com/android/server/wm/DisplayRotation.java +0 −14 Original line number Diff line number Diff line Loading @@ -1539,20 +1539,6 @@ public class DisplayRotation { } } @Override public boolean canUseRotationResolver() { if (mUserRotationMode == WindowManagerPolicy.USER_ROTATION_LOCKED) return false; switch (mCurrentAppOrientation) { case ActivityInfo.SCREEN_ORIENTATION_FULL_USER: case ActivityInfo.SCREEN_ORIENTATION_USER: case ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED: case ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE: case ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT: return true; } return false; } @Override public void onProposedRotationChanged(int rotation) { Loading
services/core/java/com/android/server/wm/WindowOrientationListener.java +1 −14 Original line number Diff line number Diff line Loading @@ -275,19 +275,6 @@ public abstract class WindowOrientationListener { } } /** * Returns true if the current status of the phone is suitable for using rotation resolver * service. * * To reduce the power consumption of rotation resolver service, rotation query should run less * frequently than other low power orientation sensors. This method is used to check whether * the current status of the phone is necessary to request a suggested screen rotation from the * rotation resolver service. Note that it always returns {@code false} in the base class. It * should be overridden in the derived classes. */ public boolean canUseRotationResolver() { return false; } /** * Returns true if the rotation resolver feature is enabled by setting. It means {@link Loading Loading @@ -1155,7 +1142,7 @@ public abstract class WindowOrientationListener { } } if (isRotationResolverEnabled() && canUseRotationResolver()) { if (isRotationResolverEnabled()) { if (mRotationResolverService == null) { mRotationResolverService = LocalServices.getService( RotationResolverInternal.class); Loading
services/tests/servicestests/src/com/android/server/wm/WindowOrientationListenerTest.java +0 −17 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ public class WindowOrientationListenerTest { private com.android.server.wm.WindowOrientationListener mWindowOrientationListener; private int mFinalizedRotation; private boolean mRotationResolverEnabled; private boolean mCanUseRotationResolver; private SensorEvent mFakeSensorEvent; private Sensor mFakeSensor; Loading @@ -66,7 +65,6 @@ public class WindowOrientationListenerTest { public void setUp() { MockitoAnnotations.initMocks(this); mRotationResolverEnabled = true; mCanUseRotationResolver = true; mFakeRotationResolverInternal = new TestableRotationResolver(); doReturn(mMockSensorManager).when(mMockContext).getSystemService(Context.SENSOR_SERVICE); Loading @@ -88,16 +86,6 @@ public class WindowOrientationListenerTest { assertThat(mFinalizedRotation).isEqualTo(Surface.ROTATION_90); } @Test public void testOnSensorChanged_cannotUseRotationResolver_useSensorResult() { mCanUseRotationResolver = false; mWindowOrientationListener.mOrientationJudge.onSensorChanged(mFakeSensorEvent); assertThat(mFinalizedRotation).isEqualTo(Surface.ROTATION_90); } @Test public void testOnSensorChanged_normalCase() { mFakeRotationResolverInternal.mResult = Surface.ROTATION_180; Loading Loading @@ -138,11 +126,6 @@ public class WindowOrientationListenerTest { mFinalizedRotation = rotation; } @Override public boolean canUseRotationResolver() { return mCanUseRotationResolver; } @Override public boolean isRotationResolverEnabled() { return mRotationResolverEnabled; Loading