Energy-aware adaptation for mobile applications