android_core widgets take a large portion of tablet CPU
I am using a Samsung Galaxy Tab 8.9 to develop on. I am using the following android_core components:
- CameraControlLayer
- LaserScanLayer
- PosePublisherLayer
- RobotLayer
- RosImageView
- VirtualJoystickView
Even when not connected to the robot and therefore not receiving LiDAR and video I get almost a 40% CPU utilization (as seen by top in adb shell) when moving the Joystick around. This by itself isn't a problem but when connected this causes the app to jump above 100% and become incredibly laggy. I tried removing all other layers and Views, just leaving the Joystick and I still got the same utilization. I ran traceview and the majority of the calls seem to be originating in the measure/OnMeasure method calls of the VirtualJoystickView ( and sub components). I tried the following:
overriding onMeasure in VirtualJoystickView but either had no change to the CPU or the view wouldn't show up at all. I'm sure I was doing something wrong but due to time constraints I had to abandon it. I think part of the problem is that the VirtualJoystickView which inherits from RelativeLayout only has one child (a relativeLayout) where I would expect it to have all of the different components of VirtualJoystickView (the thumb divets, etc). Especially, given this line in VirtualJoystickView.initVirtualJoystick,
that I think means take the root RelativeLayout in the xml file and this object becomes the root in it's place.LayoutInflater.from(context).inflate(R.layout.virtual_joystick, this, true);
I tried removing the different components of the Layout to see if less components resulted in less CPU utilization. This didn't show any drop until there was no moving component. In other words, just the grey ring.
I was wondering if there was any profiling done on the android_core layers and views to measure the CPU utilization?
Also, what device(s) were these components tested on?