Loading core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4617,4 +4617,9 @@ If omitted, image editing will not be offered via Chooser. This name is in the ComponentName flattened format (package/class) [DO NOT TRANSLATE] --> <string name="config_systemImageEditor" translatable="false"></string> <!-- Whether to force WindowOrientationListener to keep listening to its sensor, even when dreaming. This allows the AoD to rotate on devices without a wake device_orientation sensor. Note that this flag should only be enabled for development/testing use. --> <bool name="config_forceOrientationListenerEnabledWhileDreaming">false</bool> </resources> core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4148,4 +4148,6 @@ <java-symbol type="bool" name="config_attachNavBarToAppDuringTransition" /> <java-symbol type="bool" name="config_enableBackSound" /> <java-symbol type="bool" name="config_forceOrientationListenerEnabledWhileDreaming" /> </resources> services/core/java/com/android/server/policy/WindowOrientationListener.java +15 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public abstract class WindowOrientationListener { private Sensor mSensor; private OrientationJudge mOrientationJudge; private int mCurrentRotation = -1; private final Context mContext; private final Object mLock = new Object(); Loading @@ -88,6 +89,7 @@ public abstract class WindowOrientationListener { * This constructor is private since no one uses it. */ private WindowOrientationListener(Context context, Handler handler, int rate) { mContext = context; mHandler = handler; mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); mRate = rate; Loading Loading @@ -284,6 +286,19 @@ public abstract class WindowOrientationListener { } } /** * Returns whether this WindowOrientationListener can remain enabled while the device is dozing. * If this returns true, it implies that the underlying sensor can still run while the AP is * asleep, and that the underlying sensor will wake the AP on an event. */ public boolean shouldStayEnabledWhileDreaming() { if (mContext.getResources().getBoolean( com.android.internal.R.bool.config_forceOrientationListenerEnabledWhileDreaming)) { return true; } return mSensor.getType() == Sensor.TYPE_DEVICE_ORIENTATION && mSensor.isWakeUpSensor(); } abstract class OrientationJudge implements SensorEventListener { // Number of nanoseconds per millisecond. protected static final long NANOS_PER_MS = 1000000; Loading services/core/java/com/android/server/wm/DisplayRotation.java +8 −2 Original line number Diff line number Diff line Loading @@ -955,10 +955,16 @@ public class DisplayRotation { keyguardDrawComplete, windowManagerDrawComplete); boolean disable = true; // If the orientation listener uses a wake sensor, keep the orientation listener on if the // screen is on (regardless of wake state). This allows the AoD to rotate. // // Note: We postpone the rotating of the screen until the keyguard as well as the // window manager have reported a draw complete or the keyguard is going away in dismiss // mode. if (screenOnEarly && awake && ((keyguardDrawComplete && windowManagerDrawComplete))) { if (screenOnEarly && (awake || mOrientationListener.shouldStayEnabledWhileDreaming()) && ((keyguardDrawComplete && windowManagerDrawComplete))) { if (needSensorRunning()) { disable = false; // Enable listener if not already enabled. Loading @@ -974,7 +980,7 @@ public class DisplayRotation { } } // Check if sensors need to be disabled. if (disable && mOrientationListener.mEnabled) { if (disable) { mOrientationListener.disable(); } } Loading Loading
core/res/res/values/config.xml +5 −0 Original line number Diff line number Diff line Loading @@ -4617,4 +4617,9 @@ If omitted, image editing will not be offered via Chooser. This name is in the ComponentName flattened format (package/class) [DO NOT TRANSLATE] --> <string name="config_systemImageEditor" translatable="false"></string> <!-- Whether to force WindowOrientationListener to keep listening to its sensor, even when dreaming. This allows the AoD to rotate on devices without a wake device_orientation sensor. Note that this flag should only be enabled for development/testing use. --> <bool name="config_forceOrientationListenerEnabledWhileDreaming">false</bool> </resources>
core/res/res/values/symbols.xml +2 −0 Original line number Diff line number Diff line Loading @@ -4148,4 +4148,6 @@ <java-symbol type="bool" name="config_attachNavBarToAppDuringTransition" /> <java-symbol type="bool" name="config_enableBackSound" /> <java-symbol type="bool" name="config_forceOrientationListenerEnabledWhileDreaming" /> </resources>
services/core/java/com/android/server/policy/WindowOrientationListener.java +15 −0 Original line number Diff line number Diff line Loading @@ -62,6 +62,7 @@ public abstract class WindowOrientationListener { private Sensor mSensor; private OrientationJudge mOrientationJudge; private int mCurrentRotation = -1; private final Context mContext; private final Object mLock = new Object(); Loading @@ -88,6 +89,7 @@ public abstract class WindowOrientationListener { * This constructor is private since no one uses it. */ private WindowOrientationListener(Context context, Handler handler, int rate) { mContext = context; mHandler = handler; mSensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE); mRate = rate; Loading Loading @@ -284,6 +286,19 @@ public abstract class WindowOrientationListener { } } /** * Returns whether this WindowOrientationListener can remain enabled while the device is dozing. * If this returns true, it implies that the underlying sensor can still run while the AP is * asleep, and that the underlying sensor will wake the AP on an event. */ public boolean shouldStayEnabledWhileDreaming() { if (mContext.getResources().getBoolean( com.android.internal.R.bool.config_forceOrientationListenerEnabledWhileDreaming)) { return true; } return mSensor.getType() == Sensor.TYPE_DEVICE_ORIENTATION && mSensor.isWakeUpSensor(); } abstract class OrientationJudge implements SensorEventListener { // Number of nanoseconds per millisecond. protected static final long NANOS_PER_MS = 1000000; Loading
services/core/java/com/android/server/wm/DisplayRotation.java +8 −2 Original line number Diff line number Diff line Loading @@ -955,10 +955,16 @@ public class DisplayRotation { keyguardDrawComplete, windowManagerDrawComplete); boolean disable = true; // If the orientation listener uses a wake sensor, keep the orientation listener on if the // screen is on (regardless of wake state). This allows the AoD to rotate. // // Note: We postpone the rotating of the screen until the keyguard as well as the // window manager have reported a draw complete or the keyguard is going away in dismiss // mode. if (screenOnEarly && awake && ((keyguardDrawComplete && windowManagerDrawComplete))) { if (screenOnEarly && (awake || mOrientationListener.shouldStayEnabledWhileDreaming()) && ((keyguardDrawComplete && windowManagerDrawComplete))) { if (needSensorRunning()) { disable = false; // Enable listener if not already enabled. Loading @@ -974,7 +980,7 @@ public class DisplayRotation { } } // Check if sensors need to be disabled. if (disable && mOrientationListener.mEnabled) { if (disable) { mOrientationListener.disable(); } } Loading