add native SoundTrigger modes in battery saver
Control over the SoundTrigger service behavior in battery saver mode is
expanded to from a boolean to multiple modes. Modes include enabled,
disabled, and privileged. Adding the privedged mode allows for the
SoundTrigger service to selectively control clients which are deemed
esential to the Android system.
Bug: 172294448
Test: atest libpowermanager_test
Test: build and verify backward compatibility with SoundTrigger system
service behavior
Change-Id: I087a5817c832e194fc8ba670d5c90506d548544e
diff --git a/services/powermanager/include/android/BatterySaverPolicyConfig.h b/services/powermanager/include/android/BatterySaverPolicyConfig.h
index 728c8a0..3a0c9d0 100644
--- a/services/powermanager/include/android/BatterySaverPolicyConfig.h
+++ b/services/powermanager/include/android/BatterySaverPolicyConfig.h
@@ -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
@@ -40,7 +41,6 @@
bool disableAod = false,
bool disableLaunchBoost = false,
bool disableOptionalSensors = false,
- bool disableSoundTrigger = false,
bool disableVibration = false,
bool enableAdjustBrightness = false,
bool enableDataSaver = false,
@@ -49,7 +49,8 @@
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),
@@ -59,7 +60,6 @@
mDisableAod(disableAod),
mDisableLaunchBoost(disableLaunchBoost),
mDisableOptionalSensors(disableOptionalSensors),
- mDisableSoundTrigger(disableSoundTrigger),
mDisableVibration(disableVibration),
mEnableAdjustBrightness(enableAdjustBrightness),
mEnableDataSaver(enableDataSaver),
@@ -68,7 +68,8 @@
mEnableQuickDoze(enableQuickDoze),
mForceAllAppsStandby(forceAllAppsStandby),
mForceBackgroundCheck(forceBackgroundCheck),
- mLocationMode(locationMode) {
+ mLocationMode(locationMode),
+ mSoundTriggerMode(soundTriggerMode) {
}
status_t readFromParcel(const android::Parcel* parcel) override;
@@ -83,7 +84,6 @@
mDisableAod == bsp.mDisableAod &&
mDisableLaunchBoost == bsp.mDisableLaunchBoost &&
mDisableOptionalSensors == bsp.mDisableOptionalSensors &&
- mDisableSoundTrigger == bsp.mDisableSoundTrigger &&
mDisableVibration == bsp.mDisableVibration &&
mEnableAdjustBrightness == bsp.mEnableAdjustBrightness &&
mEnableDataSaver == bsp.mEnableDataSaver &&
@@ -92,7 +92,8 @@
mEnableQuickDoze == bsp.mEnableQuickDoze &&
mForceAllAppsStandby == bsp.mForceAllAppsStandby &&
mForceBackgroundCheck == bsp.mForceBackgroundCheck &&
- mLocationMode == bsp.mLocationMode;
+ mLocationMode == bsp.mLocationMode &&
+ mSoundTriggerMode == bsp.mSoundTriggerMode;
}
private:
@@ -116,8 +117,6 @@
bool mDisableLaunchBoost;
/** Disable optional sensors */
bool mDisableOptionalSensors;
- /** Disable sound trigger */
- bool mDisableSoundTrigger;
/** Disable vibration */
bool mDisableVibration;
/** Enable adjust brightness */
@@ -136,6 +135,8 @@
bool mForceBackgroundCheck;
/** Location mode */
LocationMode mLocationMode;
+ /** SoundTrigger mode */
+ SoundTriggerMode mSoundTriggerMode;
};
} // namespace android::os