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

fix:Add Support For Meizu Phone #434

Closed
wants to merge 1 commit into from
Closed

Conversation

olbb
Copy link

@olbb olbb commented Feb 19, 2019

Fix the error case by flyme nightMode.

Fix the error case by flyme nightMode.
issue #1
@olbb
Copy link
Author

olbb commented Feb 19, 2019

olbb#1 (comment)

@rom1v
Copy link
Collaborator

rom1v commented Feb 19, 2019

Hi,

Thank you for your report and fix.

I'm not sure this is sufficient, though:
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

If it creates an handler, it will post events that will never be consumed (the "main" thread is not an event loop).

What do you think?

@olbb
Copy link
Author

olbb commented Feb 19, 2019

/** Initialize the current thread as a looper.
   * This gives you a chance to create handlers that then reference
   * this looper, before actually starting the loop. Be sure to call
   * {@link #loop()} after calling this method, and end it by calling
   * {@link #quit()}.
   */
   public static void prepare() {
       prepare(true);
   }

Looper.prepare() is just set a Looper for the thread.
When some one create a handler in the thread, then there can use the handler's post() method to send message, or deal message within the handler's handleMessage() method.
So that both the post events and consumed are related to the handler.

@rom1v
Copy link
Collaborator

rom1v commented Feb 19, 2019

When some one create a handler in the thread, then there can use the handler's post() method to send message, or deal message within the handler's handleMessage() method.
So that both the post events and consumed are related to the handler.

But the messages/events will never be processed, since we don't (and don't want to) call Looper.loop().

@olbb
Copy link
Author

olbb commented Feb 20, 2019

If no one creates a Hander and uses it to send a message,there is no message in the queue.

What makes you say that ‘the messages/events will never be processed’?

@rom1v
Copy link
Collaborator

rom1v commented Feb 20, 2019

If no one creates a Hander and uses it to send a message,there is no message in the queue.

MzNightModeManager does (and if it creates a Handler, it probably uses it):

Surface: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
at android.os.Handler.(Handler.java:200)
at android.os.Handler.(Handler.java:114)
at com.meizu.nightmode.MzNightModeManager.(MzNightModeManager.java:158)
at com.meizu.nightmode.MzNightModeManager.getDefault(MzNightModeManager.java:313)

Btw, the javadoc (that you pasted here: #434 (comment)) says:

Be sure to call loop() after calling this method

@olbb
Copy link
Author

olbb commented Feb 20, 2019

Okay, I understand what you said.
Yes, if called Looper.loop(),the thread will entering an infinite loop, so I did not.
In fact, I just want the scrcpy to work properly, but who cares about the fucking code added by the meizu's developer.
If you feel that this is not appropriate,I'll just add the code in mine brach.

@amosbird
Copy link

amosbird commented Apr 6, 2019

This actually works for the Flyme OS. Good job @olbb

@rom1v
Copy link
Collaborator

rom1v commented Nov 9, 2019

@olbb I finally applied the fix (not merged yet) to fix #921. Even if it's not very correct to prepare the looper without looping, it just makes more devices work. 👍

I call prepareMainLooper() instead, and moved it out of the loop (and changed the commit message, but I kept the authorship, since it's semantically the same fix): 9da4c93

@olbb
Copy link
Author

olbb commented Nov 11, 2019

I'm glad this can help you.

@Stanislavoloshchuk
Copy link

Stanislavoloshchuk commented Jun 10, 2020

Hello everybody. Already about 7 hours trying to fix the problem "Scrcpy mirror window not coming to run" on Ubuntu 20.04 with my Meizu M6Note. I still keep reading how to solve it and saw some grateful messages but cannot find solution procedure. It seems to be problems with Meizu DarkMode and it should be fixed with replacement of scrcpy-server.jar in the directory scrcpy 1.14 (my current version) Could anyone advice where to find this directory and finally fix it please?
log.txt
scrcpy.txt

@rom1v
Copy link
Collaborator

rom1v commented Jun 10, 2020

@Stanislavoloshchuk The issue with MzNightModeManager (#240) is fixed, so your problem is probably a different one (unless there is a regression).

Your log.txt does not contain anything related to scrcpy :(

Just in case, could you test scrcpy v1.13, please?

@Stanislavoloshchuk
Copy link

@Stanislavoloshchuk The issue with MzNightModeManager (#240) is fixed, so your problem is probably a different one (unless there is a regression).

Your log.txt does not contain anything related to scrcpy :(

Just in case, could you test scrcpy v1.13, please?

Hello! Thanks for reply but could you kindly advice how to roll down to v1.13, please?
Thanks a lot!

@rom1v
Copy link
Collaborator

rom1v commented Jun 11, 2020

@Stanislavoloshchuk On Windows, just take the v1.13 release.

On other systems, take the prebuilt-server and build: https://github.com/Genymobile/scrcpy/blob/4e9e712312c9726824d28bed4fc85721e3a2b203/BUILD.md#prebuilt-server

@ilceramista
Copy link

Hello everybody. Already about 7 hours trying to fix the problem "Scrcpy mirror window not coming to run" on Ubuntu 20.04 with my Meizu M6Note. I still keep reading how to solve it and saw some grateful messages but cannot find solution procedure. It seems to be problems with Meizu DarkMode and it should be fixed with replacement of scrcpy-server.jar in the directory scrcpy 1.14 (my current version) Could anyone advice where to find this directory and finally fix it please?
log.txt
scrcpy.txt

the thread seem to be closed and i'm not an expert of github or forum generally, but i can told you my meizu m6-note work well under lubuntu 20.04 64bit with scrcpy version 1.12.1!! but just to inform, the meizu won't show a window in my old notebook bodhilinux 32.bit ubuntu 18.04 based and scrcpy version 1.16. Xiaomi mi 9t work well in both system..
thanks a lot for this piece of software, i can use ppowerful devices with damaged screen.. hope it can be useful ..regards

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

Successfully merging this pull request may close these issues.

5 participants