I want to detect memory leaks in my Android application. Some leaks could be detected while rotating the phone physically so that the activities are constantly recreated.
I'm looking of some sort of physical device that could turn the phone 90 degrees every X seconds. I could build something using lego Mindstorm (that would actually be very cool), but I'm looking for something cheaper.
I also thought of using a clock, but I couldn't find one that has a clock second hand strong enough. Futhermore if the phone rotate 360 degrees after some time the USB cable would become too twisted. I think a device that goes back and forth between horizontal and vertical would be perfect.
My dream testing machine would also allow me to plug a USB cable so that I can run the Monkey tool while constantly rotating the phone.
Why don't you just force the orientation change or destroy and recreate the views every X seconds? I think it's more reliable than a mechanical approach. I can also recommend you this : http://developer.android.com/guide/developing/tools/monkey.html
You need to trigger configuration change somehow. This might be orientation change, hardware keyboard is opened or hidden, or any other change listed here: android:configChanges
.
And there is one way to change configuration without using physical approach. You can use "Car Mode" or "Night Mode". Both only work in Android 8+ and can be turned on/off using UiModeManager
.
So you can write your custom Service that will periodically call UiModeManager.enableCarMode(0)
and UiModeManager.disableCarMode(0);
, which in turn will force configuration changes in your Activity under test.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With