nkming2 / power-menu

Android app that provides an alternative power menu
Other
26 stars 13 forks source link

Screenshot loaded as null on some device #18

Closed nkming2 closed 7 years ago

nkming2 commented 7 years ago

Screenshot loaded as null on some device, not sure why...

Stacktrace:

java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:300)
    at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
    at java.util.concurrent.FutureTask.run(FutureTask.java:242)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.graphics.Bitmap.getWidth()' on a null object reference
    at com.nkming.powermenu.ScreenshotHandler$_notifyScreenshot$1._getThumbnail(ScreenshotHandler.kt:188)
    at com.nkming.powermenu.ScreenshotHandler$_notifyScreenshot$1.doInBackground(ScreenshotHandler.kt:108)
    at com.nkming.powermenu.ScreenshotHandler$_notifyScreenshot$1.doInBackground(ScreenshotHandler.kt:103)
    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    ... 4 more
nkming2 commented 7 years ago

screencap erred with Unable to get handle for display 0

nkming2 commented 7 years ago

Possible workaround: https://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_SYSRQ

mirko77 commented 7 years ago

I just installed the app and it fails to take a screenshot on my Moto G5, Android 7.

Is this issue related?

nkming2 commented 7 years ago

Possible. Sadly I'm not too sure what's causing this issue. One thing clear is that it's to some extend related to the root solution used. For example on the same N5, I could reproduce it with SuperSU before but no longer with the latest Magisk

mirko77 commented 7 years ago

@nkming2 I rooted my phone with Magisk and I have this issue...well, I guess. It says "Failed to take a screenshot" but I have not looked at the logs yet.

nkming2 commented 7 years ago

I've just published a beta on the Play Store which may be able to workaround this issue. Can you help trying that out to see if it works? To join beta, scroll to the bottom of the app page. Thanks :)

nkming2 commented 7 years ago

Related: b4fba00f70d87ac81cc228d0ed0f12a486ff0b79

mirko77 commented 7 years ago

I confirm the issue is solved on the new beta, I'm able to get the screenshot correctly!

There is only a small delay, 1 sec or so before it gets taken, but I can leave with that! Many thanks ;)

On 8 Oct 2017 8:27 am, "Ming" notifications@github.com wrote:

I've just published a beta on the Play Store which may be able to workaround this issue. Can you help trying that out to see if it works? To join beta, scroll to the bottom of the app page. Thanks :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nkming2/power-menu/issues/18#issuecomment-334988585, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLRmRHe_m9dX4cCA_YJ8jJvpF5DG-WJks5sqHlggaJpZM4Ll2Ok .