Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unholy light vs Pie -- battery usage / possible issue? #102

Open
lbdroid opened this issue Mar 26, 2022 · 1 comment
Open

Unholy light vs Pie -- battery usage / possible issue? #102

lbdroid opened this issue Mar 26, 2022 · 1 comment

Comments

@lbdroid
Copy link

lbdroid commented Mar 26, 2022

Pixel 6 Pro running GrapheneOS 2022032110 (AOSP 12.1)

I'm trying to come up with a reasonable mode for when the battery is off. I note that "unholy light" claims under 1% battery usage per hour, whereas "pie" claims 3.5% per hour. The two modes appear to be very similar, except for size and position, but to me it doesn't make sense that unholy light would use less power since it activates a substantially larger portion of the screen.

Or maybe it shouldn't? What I'm seeing with unholy light is a huge circle in the middle of the screen with a diameter of over an inch. Its a bit much for my tastes, and doesn't seem to be configurable.

What is the reason why unholy light would use less power than pie?

@lbdroid
Copy link
Author

lbdroid commented Mar 26, 2022

Ah, I see. Something to do with the region of the screen not being able to be used without keeping the CPU awake.

Some additional customizability would be very welcome for unholy light mode.
-- the ability to adjust its size,
-- the ability to add a "blink" mode. Obviously fading it in and out would be bad for battery life since it would have to keep the CPU awake, but it currently already wakes up every few seconds to change size and rotate. This could be extended by having it invert on/off each update cycle. This would be especially useful with the ability to adjust the cycle time.

I toned it down a little using this;

diff --git a/app/src/main/java/eu/chainfire/holeylight/animation/SpritePlayer.java b/app/src/main/java/eu/chainfire/holeylight/animation/SpritePlayer.java
index 9645a4c..85f27e2 100644
--- a/app/src/main/java/eu/chainfire/holeylight/animation/SpritePlayer.java
+++ b/app/src/main/java/eu/chainfire/holeylight/animation/SpritePlayer.java
@@ -266,15 +266,19 @@ public class SpritePlayer extends RelativeLayout {
                 paintTsp.setColorFilter(null);
                 paintTsp.setXfermode(null);
 
-                float left = radiusDecrease;
-                float top = radiusDecrease;
-                float width = this.width - (radiusDecrease * 2f);
-                float height = this.height - (radiusDecrease * 2f);
+                radiusDecrease /= 4;
+
+                float width = this.width/4 - (radiusDecrease * 2f);
+                float height = this.height/4 - (radiusDecrease * 2f);
+
+                float left = this.width/2f + radiusDecrease - width/2;
+                float top = this.height/2f + radiusDecrease - height/2;
+
                 float right = left + width;
                 float bottom = top + height;
                 float cx = left + (width / 2f);
                 float cy = top + (height / 2f);
-                float radius = (width / 2f) - (8f * dpToPx);
+                float radius = (width / 2f) - (2f * dpToPx);
 
                 float anglePerColor = 360f / colors.length;
 
@@ -325,8 +329,8 @@ public class SpritePlayer extends RelativeLayout {
                                 y += Math.sin(Math.toRadians(startAngle + 270 + (anglePerColor * i))) * radius/2;
                             }
 
-                            float w = 24 * dpToPx;
-                            float h = 24 * dpToPx;
+                            float w = 12 * dpToPx - radiusDecrease;
+                            float h = 12 * dpToPx - radiusDecrease;
                             if (drawableIcons == 1) {
                                 w *= 2f;
                                 h *= 2f;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant