/** * Helper method to start the hardware profiling service. * * @throws ProfilingException */ private void startBatteryService() throws ProfilingException { mCoordinator.reportProgress("Start Battery Proc service..."); mCoordinator.startLogReading(); String command = "am startservice -a 'org.qualitune.jouleunit.android.battery.BatteryService'"; mCoordinator.executeAdbCommand(command); }
/* * (non-Javadoc) * * @see org.qualitune.jouleunit.AbstractJouleProfiler#startProfiling() */ @Override public EnergyProfile startProfiling() { try { startBatteryService(); } catch (ProfilingException e1) { mCoordinator.reportError("Error during start of profiling service: " + e1.getMessage()); return null; } mProcessor = new BatteryLogLineProcessor(this); mCoordinator.startLogReading(); mCoordinator.logOutputReceiver.addLogLineProcessor(mProcessor); return super.startProfiling(); }