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

FPS text only shows for a few seconds (then disappears) in Android 7.1 #9

Open
arshcaria opened this issue Jul 27, 2017 · 3 comments
Open
Milestone

Comments

@arshcaria
Copy link

Google changed the behavior of LayoutParams.TYPE_TOAST in Android 7.1.
https://android.googlesource.com/platform/frameworks/base/+/dc24f93

So on 7.1 devices the FPS text cannot not stay on the screen.

@Leon406
Copy link

Leon406 commented Nov 25, 2017

You can add version check as follow,and it will wrok well.

    if(  Build.VERSION.SDK_INT <21) {
      params.type = WindowManager.LayoutParams.TYPE_PRIORITY_PHONE;
    }else if( Build.VERSION.SDK_INT <24) {
      params.type = WindowManager.LayoutParams.TYPE_TOAST;
    }else {
      params.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
    }

@Fengcoder
Copy link

catch exception when loading tinker:java.lang.RuntimeException: Unable to create application com.tencent.radio.RadioApplication: android.view.WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@8ca0794 has already been added
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5406)
at android.app.ActivityThread.-wrap2(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- window android.view.ViewRootImpl$W@8ca0794 has already been added
at android.view.ViewRootImpl.setView(ViewRootImpl.java:691)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:342)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
at jp.wasabeef.takt.Takt$Program.play(Takt.java:113)
at com.tencent.radio.RadioApplicationDelegate.initTakt(RadioApplicationDelegate.java:122)
at com.tencent.radio.RadioApplicationDelegate.onCreate(RadioApplicationDelegate.java:111)
at com.tencent.tinker.loader.app.TinkerApplication.onCreate(TinkerApplication.java:173)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1024)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5403)
at android.app.ActivityThread.-wrap2(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1545) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

@Fengcoder
Copy link

Fengcoder commented Dec 6, 2017

7.1.1 直接crash了

@wasabeef wasabeef added this to the 2.1.0 milestone Sep 15, 2020
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

4 participants