private static Intent getLogIntent(String msg, boolean flush) { Intent intent = new Intent(SwitchLog.ACTION_ADD_TO_LOG); intent.putExtra(SwitchLog.EXTRA_LOG_ENTRY, msg); if (flush) { intent.putExtra(SwitchLog.EXTRA_FLUSH_LOG, flush); } PowerProfiles powerProfiles = PowerProfiles.getInstance(); if (powerProfiles != null) { intent.putExtra(DB.SwitchLogDB.NAME_TRIGGER, powerProfiles.getCurrentTriggerName()); intent.putExtra(DB.SwitchLogDB.NAME_PROFILE, powerProfiles.getCurrentProfileName()); intent.putExtra(DB.SwitchLogDB.NAME_VIRTGOV, powerProfiles.getCurrentVirtGovName()); intent.putExtra(DB.SwitchLogDB.NAME_AC, powerProfiles.isAcPower() ? 1 : 0); intent.putExtra(DB.SwitchLogDB.NAME_BATTERY, powerProfiles.getBatteryLevel()); intent.putExtra(DB.SwitchLogDB.NAME_CALL, powerProfiles.isCallInProgress() ? 1 : 0); intent.putExtra(DB.SwitchLogDB.NAME_HOT, powerProfiles.isBatteryHot() ? 1 : 0); intent.putExtra(DB.SwitchLogDB.NAME_LOCKED, powerProfiles.isScreenOff() ? 1 : 0); } return intent; }