SuperToasts icon indicating copy to clipboard operation
SuperToasts copied to clipboard

I've got an error from android Kitkat 4.4.4

Open irsalshabirin opened this issue 9 years ago • 14 comments

in some device i've got an error like this :

Fatal Exception: android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@43093158 -- permission denied for this window type
       at android.view.ViewRootImpl.setView(ViewRootImpl.java:587)
       at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:263)
       at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
       at com.github.johnpersano.supertoasts.library.Toaster.displaySuperToast(Toaster.java:186)
       at com.github.johnpersano.supertoasts.library.Toaster.handleMessage(Toaster.java:136)
       at android.os.Handler.dispatchMessage(Handler.java:102)
.....

please help me, thankss

irsalshabirin avatar Sep 01 '16 08:09 irsalshabirin

Same here...

Farasy avatar Sep 01 '16 08:09 Farasy

i got it on a XiaoMi MI MAX running 6.0.1 Can't tell where and how exactly it happened. The stack trace I got is exactly as above.

torinnguyen avatar Sep 02 '16 01:09 torinnguyen

Xiaomi Mi4i, Android 5.0.2, MIUI 8 - the same error

android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@142544eb -- permission denied for this window type at android.view.ViewRootImpl.setView(ViewRootImpl.java:714) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at com.github.johnpersano.supertoasts.library.Toaster.displaySuperToast(Toaster.java:186) at com.github.johnpersano.supertoasts.library.Toaster.handleMessage(Toaster.java:136) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5546) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:163)

mike-stetsenko avatar Sep 08 '16 05:09 mike-stetsenko

May this helps:

http://stackoverflow.com/questions/7569937/unable-to-add-window-android-view-viewrootw44da9bc0-permission-denied-for-t

Farasy avatar Sep 08 '16 09:09 Farasy

True. MI devices plagued with this issue after a recent update.

the-jedi-droid avatar Sep 09 '16 15:09 the-jedi-droid

It appears as though 6.0 now requires permission android.permission.SYSTEM_ALERT_WINDOW to add a view to the WindowManager. I'll investigate this further. I'm not sure what will happen to the SuperToast class then, I can't expect developers to add that permission for a simple toast message.

ghost avatar Sep 09 '16 21:09 ghost

Something new on this?

Could reproduce this error on Xiami Redmi 3 with Miui 8 but none of my other Android 5 / 6 devices.

Farasy avatar Sep 14 '16 17:09 Farasy

Got the same issue with 1.3.4.1 with Xiaomi devices Redmi Note 3 (hennessy) running Android 5.0 and Mi 4c (libra) running Android 5.1.

Here is the stack:

android.view.WindowManager$BadTokenException: Unable to add window android.view.ViewRootImpl$W@2ffb4010 -- permission denied for this window type at android.view.ViewRootImpl.setView(ViewRootImpl.java:714) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:282) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69) at com.github.johnpersano.supertoasts.ManagerSuperToast.displaySuperToast(ManagerSuperToast.java:189) at com.github.johnpersano.supertoasts.ManagerSuperToast.handleMessage(ManagerSuperToast.java:146) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:194) at android.app.ActivityThread.main(ActivityThread.java:5546) at java.lang.reflect.Method.invoke(Method.java) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:967) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

alexeyvasilyev avatar Sep 18 '16 21:09 alexeyvasilyev

Got the same issue also. Devices affected are:

OnePlus A3000 Xiaomi Redmi Note 3 Xiaomi Redmi Note 2 Xiaomi HM NOTE 1LTE

Any update on this?

lockeb avatar Oct 15 '16 12:10 lockeb

running into this too on several different xiaomi devices!

evil question, but is the way supertoasts work different from the default android toasts? why does it need the overlay flag?

is there something in the code that can be made an option, so that it doesn't need the flag?

Pe-te avatar Oct 17 '16 18:10 Pe-te

Hello guys, I just want to inform, that one of my user just wrote me, that this issue seems to be solved in new version MIUI 8.1 (currently in 'dev' state). So let's wait on final version of MIUI rom.

menion avatar Nov 17 '16 09:11 menion

Hey guys, I also get the question in my xiaomi phone, this maybe helps you. https://www.liaohuqiu.net/cn/posts/android-windows-manager/

sucese avatar Mar 22 '17 06:03 sucese

Same weird issue... capture d ecran 2017-06-10 a 11 41 00

PhilippeBoisney avatar Jun 10 '17 09:06 PhilippeBoisney

As this issue happens only with Xiaomi devices, I've created a temporary quick fix to avoid crashes:

private void showSafely(SuperToast superToast){
        if (!android.os.Build.MANUFACTURER.toLowerCase().contains("xiaomi")){ 
           superToast.show(); 
        }
 }

PhilippeBoisney avatar Jun 15 '17 06:06 PhilippeBoisney