OnePlus and the OPlusHansManager

Problem:
It seems that recent OnePlus devices eg. OnePlus8 have an app called OPlusHansManager which may cause problems with the uiautomator2.server e.g.
01-16 10:09:47.715 2287 3572 I OplusHansManager : uid=10315, pkg=io.appium.uiautomator2.server can transition from M to F

*01-16 10:09:47.715 2287 3572 I OplusHansManager : uid=10315, pkg=io.appium.uiautomator2.server F enter(), M stay=10 *
*01-16 10:09:47.719 2287 3572 I OplusHansManager : freeze uid: 10315 io.appium.uiautomator2.server pids: [8158] scene: LcdOn *
*01-16 10:09:48.621 2287 3601 I OplusHansManager : unfreeze uid: 10315 io.appium.uiautomator2.server pids: [8158] reason: AsyncBinder scene: LcdOn *
*01-16 10:09:48.627 2287 3572 I OplusHansManager : uid=10315, pkg=io.appium.uiautomator2.server, transition from F to Middle, reason=AsyncBinder *
01-16 10:09:48.627 2287 3572 I OplusHansManager : uid=10315, pkg=io.appium.uiautomator2.server F exit(), F stay=0, reason=AsyncBinder

So in this instance the OPlusHansManager freezer the automationServer causing ranom delays within the tests, eg. locating an element may take 30s instead of 500ms.

Solution/Workaround :
I found by going to Settings>Apps>
The searching for io.appium.uiautomator2.server
=> BatteryUsage
=> Enable “Allow background activity”

1 Like