Open Hagb opened 1 year ago
Can you provide a pull request? I will merge this then.
Can you provide a pull request? I will merge this then.
Yes. But I doubt whether this workaround is reliable enough
It does work on my device, but I don't know whether the hardcoded threshold (500 ms in my code) is good, which may depend on the performance and status of device.
Too large threshold leads to obvious delay when the size is actually changed, while too small threshold make XServer restart when the device is unlocked. (At first, I tried 200 ms, but sometimes it doesn't work for the threshold was not large enough.)
I consider adding an option for custom threshold in the menu.
It would be better to find a way that doesn't depend on the performance of device. (But I failed to find that.)
In some configuration, the phone hides the navigation bar in unlocking GUI, and shows the navigation again after unlocked.
If XServer is in foreground, it will trigger the
ScreenView.onSizeChanged
event twice. (My device is OnePlus 6 with LineageOS 19.1, in which unlocking by fingerprint triggers it, but unlocking by pattern doesn't trigger it because the navigation bar recovers in the pattern interface. Unlocking by swiping may also trigger the event.)https://github.com/nwrkbiz/android-xserver/blob/51e907880d4295ee3c381a593c738ca365c066fb/library/src/main/java/au/com/darkside/xserver/ScreenView.java#L655
The first one is triggered by hiding the navigation (size is expanded), and the second one is triggered by the recovering the navigation (size is reduced). There are all triggered after the phone was unlocked, and the second is triggered a very short time after the first one is triggered.
It causes the XServer to "restart".
One possible workaround is to delay the "restart", and stop the "restart" after the size recovers the original value in a short time:
Also related to #26.