Loading services/powermanager/BatterySaverPolicyConfig.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ status_t BatterySaverPolicyConfig::readFromParcel(const android::Parcel *parcel) ?: parcel->readBool(&mDisableAod) ?: parcel->readBool(&mDisableLaunchBoost) ?: parcel->readBool(&mDisableOptionalSensors) ?: parcel->readBool(&mDisableSoundTrigger) ?: parcel->readBool(&mDisableVibration) ?: parcel->readBool(&mEnableAdjustBrightness) ?: parcel->readBool(&mEnableDataSaver) Loading @@ -64,7 +63,8 @@ status_t BatterySaverPolicyConfig::readFromParcel(const android::Parcel *parcel) ?: parcel->readBool(&mEnableQuickDoze) ?: parcel->readBool(&mForceAllAppsStandby) ?: parcel->readBool(&mForceBackgroundCheck) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)); ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mSoundTriggerMode)); } status_t BatterySaverPolicyConfig::writeDeviceSpecificSettings(android::Parcel *parcel) const { Loading Loading @@ -97,7 +97,6 @@ status_t BatterySaverPolicyConfig::writeToParcel(android::Parcel *parcel) const ?: parcel->writeBool(mDisableAod) ?: parcel->writeBool(mDisableLaunchBoost) ?: parcel->writeBool(mDisableOptionalSensors) ?: parcel->writeBool(mDisableSoundTrigger) ?: parcel->writeBool(mDisableVibration) ?: parcel->writeBool(mEnableAdjustBrightness) ?: parcel->writeBool(mEnableDataSaver) Loading @@ -106,7 +105,8 @@ status_t BatterySaverPolicyConfig::writeToParcel(android::Parcel *parcel) const ?: parcel->writeBool(mEnableQuickDoze) ?: parcel->writeBool(mForceAllAppsStandby) ?: parcel->writeBool(mForceBackgroundCheck) ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)); ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)) ?: parcel->writeInt32(static_cast<int32_t>(mSoundTriggerMode)); } } // namespace android::os services/powermanager/PowerSaveState.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ status_t PowerSaveState::readFromParcel(const android::Parcel *parcel) { return parcel->readBool(&mBatterySaverEnabled) ?: parcel->readBool(&mGlobalBatterySaverEnabled) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mSoundTriggerMode)) ?: parcel->readFloat(&mBrightnessFactor); } Loading @@ -43,6 +44,7 @@ status_t PowerSaveState::writeToParcel(android::Parcel *parcel) const { return parcel->writeBool(mBatterySaverEnabled) ?: parcel->writeBool(mGlobalBatterySaverEnabled) ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)) ?: parcel->writeInt32(static_cast<int32_t>(mSoundTriggerMode)) ?: parcel->writeFloat(mBrightnessFactor); } Loading services/powermanager/include/android/BatterySaverPolicyConfig.h +9 −8 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android::os { enum class LocationMode : int32_t; enum class SoundTriggerMode : int32_t; /** * BatterySaverPolicyConfig is a structure of configs to set Battery Saver policy flags. * This file needs to be kept in sync with Loading @@ -40,7 +41,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { bool disableAod = false, bool disableLaunchBoost = false, bool disableOptionalSensors = false, bool disableSoundTrigger = false, bool disableVibration = false, bool enableAdjustBrightness = false, bool enableDataSaver = false, Loading @@ -49,7 +49,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { bool enableQuickDoze = false, bool forceAllAppsStandby = false, bool forceBackgroundCheck = false, LocationMode locationMode = static_cast<LocationMode>(0)) LocationMode locationMode = static_cast<LocationMode>(0), SoundTriggerMode soundTriggerMode = static_cast<SoundTriggerMode>(0)) : mAdjustBrightnessFactor(adjustBrightnessFactor), mAdvertiseIsEnabled(advertiseIsEnabled), mDeferFullBackup(deferFullBackup), Loading @@ -59,7 +60,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mDisableAod(disableAod), mDisableLaunchBoost(disableLaunchBoost), mDisableOptionalSensors(disableOptionalSensors), mDisableSoundTrigger(disableSoundTrigger), mDisableVibration(disableVibration), mEnableAdjustBrightness(enableAdjustBrightness), mEnableDataSaver(enableDataSaver), Loading @@ -68,7 +68,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mEnableQuickDoze(enableQuickDoze), mForceAllAppsStandby(forceAllAppsStandby), mForceBackgroundCheck(forceBackgroundCheck), mLocationMode(locationMode) { mLocationMode(locationMode), mSoundTriggerMode(soundTriggerMode) { } status_t readFromParcel(const android::Parcel* parcel) override; Loading @@ -83,7 +84,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mDisableAod == bsp.mDisableAod && mDisableLaunchBoost == bsp.mDisableLaunchBoost && mDisableOptionalSensors == bsp.mDisableOptionalSensors && mDisableSoundTrigger == bsp.mDisableSoundTrigger && mDisableVibration == bsp.mDisableVibration && mEnableAdjustBrightness == bsp.mEnableAdjustBrightness && mEnableDataSaver == bsp.mEnableDataSaver && Loading @@ -92,7 +92,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mEnableQuickDoze == bsp.mEnableQuickDoze && mForceAllAppsStandby == bsp.mForceAllAppsStandby && mForceBackgroundCheck == bsp.mForceBackgroundCheck && mLocationMode == bsp.mLocationMode; mLocationMode == bsp.mLocationMode && mSoundTriggerMode == bsp.mSoundTriggerMode; } private: Loading @@ -116,8 +117,6 @@ private: bool mDisableLaunchBoost; /** Disable optional sensors */ bool mDisableOptionalSensors; /** Disable sound trigger */ bool mDisableSoundTrigger; /** Disable vibration */ bool mDisableVibration; /** Enable adjust brightness */ Loading @@ -136,6 +135,8 @@ private: bool mForceBackgroundCheck; /** Location mode */ LocationMode mLocationMode; /** SoundTrigger mode */ SoundTriggerMode mSoundTriggerMode; }; } // namespace android::os Loading services/powermanager/include/android/PowerSaveState.h +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android::os { enum class LocationMode : int32_t; enum class SoundTriggerMode : int32_t; /** * PowerSaveState is a structure to encapsulate PowerSaveState status. * This file needs to be kept in sync with frameworks/base/core/java/android/os/PowerSaveState.java Loading @@ -33,16 +34,19 @@ struct PowerSaveState : public android::Parcelable { PowerSaveState(bool batterySaverEnabled = false, bool globalBatterySaverEnabled = false, LocationMode locationMode = static_cast<LocationMode>(0), SoundTriggerMode soundTriggerMode = static_cast<SoundTriggerMode>(0), float brightnessFactor = 0.5f) : mBatterySaverEnabled(batterySaverEnabled), mGlobalBatterySaverEnabled(globalBatterySaverEnabled), mLocationMode(locationMode), mSoundTriggerMode(soundTriggerMode), mBrightnessFactor(brightnessFactor) { } bool getBatterySaverEnabled() const { return mBatterySaverEnabled; } bool getGlobalBatterySaverEnabled() const { return mGlobalBatterySaverEnabled; } LocationMode getLocationMode() const { return mLocationMode; } SoundTriggerMode getSoundTriggerMode() const { return mSoundTriggerMode; } float getBrightnessFactor() const { return mBrightnessFactor; } bool operator == (const PowerSaveState &ps) const { return mBatterySaverEnabled == ps.mBatterySaverEnabled && Loading @@ -61,6 +65,8 @@ private: bool mGlobalBatterySaverEnabled; /** Location mode */ LocationMode mLocationMode; /** SoundTrigger mode */ SoundTriggerMode mSoundTriggerMode; /** Screen brightness factor. */ float mBrightnessFactor; }; Loading services/powermanager/include/android/SoundTriggerMode.h 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_OS_SOUNDTRIGGER_MODE_H #define ANDROID_OS_SOUNDTRIGGER_MODE_H namespace android::os { enum class SoundTriggerMode : int32_t { ALL_ENABLED = IPowerManager::SOUND_TRIGGER_MODE_ALL_ENABLED, CRITICAL_ONLY = IPowerManager::SOUND_TRIGGER_MODE_CRITICAL_ONLY, ALL_DISABLED = IPowerManager::SOUND_TRIGGER_MODE_ALL_DISABLED, MIN = IPowerManager::SOUND_TRIGGER_MODE_ALL_ENABLED, MAX = IPowerManager::SOUND_TRIGGER_MODE_ALL_DISABLED, }; } // namespace android::os #endif /* ANDROID_OS_SOUNDTRIGGER_MODE_H */ Loading
services/powermanager/BatterySaverPolicyConfig.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,6 @@ status_t BatterySaverPolicyConfig::readFromParcel(const android::Parcel *parcel) ?: parcel->readBool(&mDisableAod) ?: parcel->readBool(&mDisableLaunchBoost) ?: parcel->readBool(&mDisableOptionalSensors) ?: parcel->readBool(&mDisableSoundTrigger) ?: parcel->readBool(&mDisableVibration) ?: parcel->readBool(&mEnableAdjustBrightness) ?: parcel->readBool(&mEnableDataSaver) Loading @@ -64,7 +63,8 @@ status_t BatterySaverPolicyConfig::readFromParcel(const android::Parcel *parcel) ?: parcel->readBool(&mEnableQuickDoze) ?: parcel->readBool(&mForceAllAppsStandby) ?: parcel->readBool(&mForceBackgroundCheck) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)); ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mSoundTriggerMode)); } status_t BatterySaverPolicyConfig::writeDeviceSpecificSettings(android::Parcel *parcel) const { Loading Loading @@ -97,7 +97,6 @@ status_t BatterySaverPolicyConfig::writeToParcel(android::Parcel *parcel) const ?: parcel->writeBool(mDisableAod) ?: parcel->writeBool(mDisableLaunchBoost) ?: parcel->writeBool(mDisableOptionalSensors) ?: parcel->writeBool(mDisableSoundTrigger) ?: parcel->writeBool(mDisableVibration) ?: parcel->writeBool(mEnableAdjustBrightness) ?: parcel->writeBool(mEnableDataSaver) Loading @@ -106,7 +105,8 @@ status_t BatterySaverPolicyConfig::writeToParcel(android::Parcel *parcel) const ?: parcel->writeBool(mEnableQuickDoze) ?: parcel->writeBool(mForceAllAppsStandby) ?: parcel->writeBool(mForceBackgroundCheck) ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)); ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)) ?: parcel->writeInt32(static_cast<int32_t>(mSoundTriggerMode)); } } // namespace android::os
services/powermanager/PowerSaveState.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ status_t PowerSaveState::readFromParcel(const android::Parcel *parcel) { return parcel->readBool(&mBatterySaverEnabled) ?: parcel->readBool(&mGlobalBatterySaverEnabled) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mLocationMode)) ?: parcel->readInt32(reinterpret_cast<int32_t *>(&mSoundTriggerMode)) ?: parcel->readFloat(&mBrightnessFactor); } Loading @@ -43,6 +44,7 @@ status_t PowerSaveState::writeToParcel(android::Parcel *parcel) const { return parcel->writeBool(mBatterySaverEnabled) ?: parcel->writeBool(mGlobalBatterySaverEnabled) ?: parcel->writeInt32(static_cast<int32_t>(mLocationMode)) ?: parcel->writeInt32(static_cast<int32_t>(mSoundTriggerMode)) ?: parcel->writeFloat(mBrightnessFactor); } Loading
services/powermanager/include/android/BatterySaverPolicyConfig.h +9 −8 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android::os { enum class LocationMode : int32_t; enum class SoundTriggerMode : int32_t; /** * BatterySaverPolicyConfig is a structure of configs to set Battery Saver policy flags. * This file needs to be kept in sync with Loading @@ -40,7 +41,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { bool disableAod = false, bool disableLaunchBoost = false, bool disableOptionalSensors = false, bool disableSoundTrigger = false, bool disableVibration = false, bool enableAdjustBrightness = false, bool enableDataSaver = false, Loading @@ -49,7 +49,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { bool enableQuickDoze = false, bool forceAllAppsStandby = false, bool forceBackgroundCheck = false, LocationMode locationMode = static_cast<LocationMode>(0)) LocationMode locationMode = static_cast<LocationMode>(0), SoundTriggerMode soundTriggerMode = static_cast<SoundTriggerMode>(0)) : mAdjustBrightnessFactor(adjustBrightnessFactor), mAdvertiseIsEnabled(advertiseIsEnabled), mDeferFullBackup(deferFullBackup), Loading @@ -59,7 +60,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mDisableAod(disableAod), mDisableLaunchBoost(disableLaunchBoost), mDisableOptionalSensors(disableOptionalSensors), mDisableSoundTrigger(disableSoundTrigger), mDisableVibration(disableVibration), mEnableAdjustBrightness(enableAdjustBrightness), mEnableDataSaver(enableDataSaver), Loading @@ -68,7 +68,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mEnableQuickDoze(enableQuickDoze), mForceAllAppsStandby(forceAllAppsStandby), mForceBackgroundCheck(forceBackgroundCheck), mLocationMode(locationMode) { mLocationMode(locationMode), mSoundTriggerMode(soundTriggerMode) { } status_t readFromParcel(const android::Parcel* parcel) override; Loading @@ -83,7 +84,6 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mDisableAod == bsp.mDisableAod && mDisableLaunchBoost == bsp.mDisableLaunchBoost && mDisableOptionalSensors == bsp.mDisableOptionalSensors && mDisableSoundTrigger == bsp.mDisableSoundTrigger && mDisableVibration == bsp.mDisableVibration && mEnableAdjustBrightness == bsp.mEnableAdjustBrightness && mEnableDataSaver == bsp.mEnableDataSaver && Loading @@ -92,7 +92,8 @@ struct BatterySaverPolicyConfig : public android::Parcelable { mEnableQuickDoze == bsp.mEnableQuickDoze && mForceAllAppsStandby == bsp.mForceAllAppsStandby && mForceBackgroundCheck == bsp.mForceBackgroundCheck && mLocationMode == bsp.mLocationMode; mLocationMode == bsp.mLocationMode && mSoundTriggerMode == bsp.mSoundTriggerMode; } private: Loading @@ -116,8 +117,6 @@ private: bool mDisableLaunchBoost; /** Disable optional sensors */ bool mDisableOptionalSensors; /** Disable sound trigger */ bool mDisableSoundTrigger; /** Disable vibration */ bool mDisableVibration; /** Enable adjust brightness */ Loading @@ -136,6 +135,8 @@ private: bool mForceBackgroundCheck; /** Location mode */ LocationMode mLocationMode; /** SoundTrigger mode */ SoundTriggerMode mSoundTriggerMode; }; } // namespace android::os Loading
services/powermanager/include/android/PowerSaveState.h +6 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ namespace android::os { enum class LocationMode : int32_t; enum class SoundTriggerMode : int32_t; /** * PowerSaveState is a structure to encapsulate PowerSaveState status. * This file needs to be kept in sync with frameworks/base/core/java/android/os/PowerSaveState.java Loading @@ -33,16 +34,19 @@ struct PowerSaveState : public android::Parcelable { PowerSaveState(bool batterySaverEnabled = false, bool globalBatterySaverEnabled = false, LocationMode locationMode = static_cast<LocationMode>(0), SoundTriggerMode soundTriggerMode = static_cast<SoundTriggerMode>(0), float brightnessFactor = 0.5f) : mBatterySaverEnabled(batterySaverEnabled), mGlobalBatterySaverEnabled(globalBatterySaverEnabled), mLocationMode(locationMode), mSoundTriggerMode(soundTriggerMode), mBrightnessFactor(brightnessFactor) { } bool getBatterySaverEnabled() const { return mBatterySaverEnabled; } bool getGlobalBatterySaverEnabled() const { return mGlobalBatterySaverEnabled; } LocationMode getLocationMode() const { return mLocationMode; } SoundTriggerMode getSoundTriggerMode() const { return mSoundTriggerMode; } float getBrightnessFactor() const { return mBrightnessFactor; } bool operator == (const PowerSaveState &ps) const { return mBatterySaverEnabled == ps.mBatterySaverEnabled && Loading @@ -61,6 +65,8 @@ private: bool mGlobalBatterySaverEnabled; /** Location mode */ LocationMode mLocationMode; /** SoundTrigger mode */ SoundTriggerMode mSoundTriggerMode; /** Screen brightness factor. */ float mBrightnessFactor; }; Loading
services/powermanager/include/android/SoundTriggerMode.h 0 → 100644 +32 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ANDROID_OS_SOUNDTRIGGER_MODE_H #define ANDROID_OS_SOUNDTRIGGER_MODE_H namespace android::os { enum class SoundTriggerMode : int32_t { ALL_ENABLED = IPowerManager::SOUND_TRIGGER_MODE_ALL_ENABLED, CRITICAL_ONLY = IPowerManager::SOUND_TRIGGER_MODE_CRITICAL_ONLY, ALL_DISABLED = IPowerManager::SOUND_TRIGGER_MODE_ALL_DISABLED, MIN = IPowerManager::SOUND_TRIGGER_MODE_ALL_ENABLED, MAX = IPowerManager::SOUND_TRIGGER_MODE_ALL_DISABLED, }; } // namespace android::os #endif /* ANDROID_OS_SOUNDTRIGGER_MODE_H */