markusfisch / ShaderEditor

Android app to create GLSL shaders and use them as live wallpaper
https://play.google.com/store/apps/details?id=de.markusfisch.android.shadereditor
MIT License
923 stars 137 forks source link

App crashes after plugging in charger #66

Open lajonss opened 7 years ago

lajonss commented 7 years ago

Gear: Samsung GT-i5510 Galaxy, Cyanogenmod 7 (Android 2.3.7) Shader Editor version: 2.8.1 Logcat:

W/ActivityManager( 1717): Permission Denial: Accessing service ComponentInfo{de.markusfisch.android.shadereditor/de.markusfisch.android.shadereditor.service.ShaderWallpaperService} from pid=1717, uid=1000 requires android.permission.BIND_WALLPAPER
E/AndroidRuntime( 2557): java.lang.RuntimeException: Unable to start receiver de.markusfisch.android.shadereditor.receiver.BatteryLevelReceiver: java.lang.SecurityException: Not allowed to start service Intent { cmp=de.markusfisch.android.shadereditor/.service.ShaderWallpaperService (has extras) } without permission android.permission.BIND_WALLPAPER
E/AndroidRuntime( 2557): Caused by: java.lang.SecurityException: Not allowed to start service Intent { cmp=de.markusfisch.android.shadereditor/.service.ShaderWallpaperService (has extras) } without permission android.permission.BIND_WALLPAPER
E/AndroidRuntime( 2557):    at de.markusfisch.android.shadereditor.receiver.BatteryLevelReceiver.a(Unknown Source)
E/AndroidRuntime( 2557):    at de.markusfisch.android.shadereditor.receiver.BatteryLevelReceiver.onReceive(Unknown Source)
I/WindowManager( 1717): WIN DEATH: Window{407f62a0 de.markusfisch.android.shadereditor/de.markusfisch.android.shadereditor.activity.MainActivity paused=false}
I/ActivityManager( 1717): Process de.markusfisch.android.shadereditor (pid 2557) has died.
W/ActivityManager( 1717): Scheduling restart of crashed service de.markusfisch.android.shadereditor/.service.ShaderWallpaperService in 5000ms
W/WallpaperService( 1717): Wallpaper service gone: ComponentInfo{de.markusfisch.android.shadereditor/de.markusfisch.android.shadereditor.service.ShaderWallpaperService}
I/WindowManager( 1717): WIN DEATH: Window{407f0fd8 de.markusfisch.android.shadereditor.service.ShaderWallpaperService paused=false}

Used wallpaper:

#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif

uniform vec2 resolution;
uniform float battery;
uniform float time;
uniform vec3 gravity;

void main(void) {
  vec2 uv = gl_FragCoord.xy / resolution.xy - 0.5;
  const float pi = 3.14;
  const float pih = 1.57;
  float grot = gravity.y / length(gravity.xy) * pih;
  float a = gravity.x > 0.0 ? grot : pi - grot;
  float b = battery;
  vec2 uvr = vec2(
    uv.x * cos(a) - uv.y * sin(a),
    uv.x * sin(a) + uv.y * cos(a)
  );
  float t = time;
  float c = ((uvr.y+ 0.5)/b + 1.0 - 1.0/b + sin(t) *uvr.x*0.2);
  float cs = abs(sin(t)) * c;
  float cr = (1.0 - 2.0 * b) * cs;
  float cg = b * cs;
  gl_FragColor = vec4(cr, cg, 0.0, 1.0);
}

This app is amazing by the way :)

markusfisch commented 7 years ago

That's odd - it's a SecurityException because the service is missing the android.permission.BIND_WALLPAPER permission ... but it's specified in the app's Manifest. Can it be because of some permission setting in Cyanogen maybe?

lech commented 4 years ago

I've been witnessing a similar behavior lately. I thought it was Android simply unloading itself, but suspect it could be triggering a crash when charging on my Pixel 3, stock Android at the most current version. This ran fine until the more recent Feb/Mar/Apr updates but now whenever I charge there's a 50/50 chance that this will cause the application to crash and I'll come back to find my phone fully charged but with the stock wallpaper set but no error notifications.

If there's an easy way for me to get logs to help trace this, let me know.

markusfisch commented 4 years ago

I've got a Pixel 3a with the same problem 😔 Unfortunately, I haven't found out what is causing the issue but it seems to be a system bug: https://issuetracker.google.com/issues/153361057

lech commented 4 years ago

I've browsed through the comments on that bug report, and coincidentally I also have the Google One app installed which can let me try a few things. However I have noticed that while running the Wave Live Wallpaper or just using a static image that this doesn't happen to me.

Shader Editor seems to be the only live wallpaper app I have which is triggering this for me at the moment, I suspect if Google One is trying to back something up in use, it might be causing SE to silently crash and Android gracefully resets the wallpaper without giving any notification. I thought this was first triggered by slow charging, but fast charging has the same effect.

I've just updated to the May 5th, 2020 update while writing this so I'll see if that fixes it and try a few other things and report back.

markusfisch commented 4 years ago

That's interesting 🤔 Unfortunately, I don't see any crashes in the Google Play Console that would give me a lead on this. Hm. I'll try to find out if there's something I can do about it.

lech commented 4 years ago

Alright, it's been a week since I've been testing and I suspect the May 5th update might have addressed this. I'm not seeing it reset now. How strange.

markusfisch commented 4 years ago

Good to know! Thanks for reporting! Let's hope it stays that way.

lech commented 4 years ago

You're going to dislike this, but I plugged my phone in this afternoon, checked on it this evening and it looks like this is persisting. I got a week's worth of live wallpaper though, so it's not resetting daily which is nice. I'll keep you posted.

lech commented 4 years ago

OK, so oddly enough on my Pixel 3 XL under Android Q there's two places which needed update attention. In addition to the previous which made things happy.

Settings > System > ~Advanced / System Update

However, there's also this to consider:

Settings > Security > Security update and Settings > Security > Google Play system update

It seems like if those last two aren't relatively current (May 5 or May 1, 2020, respectively) or in need of attention (yellow or red), this behavior may persist. However, I recall after I last posted I found one of those needed attention and since I updated that, everything seems peachy, again.