Energy-Aware Computation in Mobile Devices