Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2ff8e8d authored by Rajeev Kumar's avatar Rajeev Kumar
Browse files

Stop rotation sensor for locked rotation in low RAM

The rotation sensor causes significant power and CPU consumption, and if the rotation is
locked, we don't need its values anyway.

Test: Manual
Bug: 111711710
Change-Id: I0c55dafdc1f703960f3d2423b7975013dded7eb4
parent 32e02cc6
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ORIENTATION;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;

import android.app.ActivityManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -732,7 +733,10 @@ public class DisplayRotation {
            boolean shouldUpdateOrientationListener = false;

            // Configure rotation suggestions.
            final int showRotationSuggestions = Settings.Secure.getIntForUser(resolver,
            final int showRotationSuggestions =
                    ActivityManager.isLowRamDeviceStatic()
                            ? Settings.Secure.SHOW_ROTATION_SUGGESTIONS_DISABLED
                            : Settings.Secure.getIntForUser(resolver,
                            Settings.Secure.SHOW_ROTATION_SUGGESTIONS,
                            Settings.Secure.SHOW_ROTATION_SUGGESTIONS_DEFAULT,
                            UserHandle.USER_CURRENT);