| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.os; |
| 18 |
|
| 19 |
import android.annotation.NonNull; |
| 20 |
import android.annotation.SystemApi; |
| 21 |
import android.text.TextUtils; |
| 22 |
import android.util.ArrayMap; |
| 23 |
|
| 24 |
import java.util.Collections; |
| 25 |
import java.util.Map; |
| 26 |
import java.util.Set; |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
@SystemApi |
| 34 |
public final class BatterySaverPolicyConfig implements Parcelable { |
| 35 |
private final float mAdjustBrightnessFactor; |
| 36 |
private final boolean mAdvertiseIsEnabled; |
| 37 |
private final boolean mDeferFullBackup; |
| 38 |
private final boolean mDeferKeyValueBackup; |
| 39 |
@NonNull |
| 40 |
private final Map<String, String> mDeviceSpecificSettings; |
| 41 |
private final boolean mDisableAnimation; |
| 42 |
private final boolean mDisableAod; |
| 43 |
private final boolean mDisableLaunchBoost; |
| 44 |
private final boolean mDisableOptionalSensors; |
| 45 |
private final boolean mDisableVibration; |
| 46 |
private final boolean mEnableAdjustBrightness; |
| 47 |
private final boolean mEnableDataSaver; |
| 48 |
private final boolean mEnableFirewall; |
| 49 |
private final boolean mEnableNightMode; |
| 50 |
private final boolean mEnableQuickDoze; |
| 51 |
private final boolean mForceAllAppsStandby; |
| 52 |
private final boolean mForceBackgroundCheck; |
| 53 |
private final int mLocationMode; |
| 54 |
private final int mSoundTriggerMode; |
| 55 |
|
| 56 |
private BatterySaverPolicyConfig(Builder in) { |
| 57 |
mAdjustBrightnessFactor = Math.max(0, Math.min(in.mAdjustBrightnessFactor, 1f)); |
| 58 |
mAdvertiseIsEnabled = in.mAdvertiseIsEnabled; |
| 59 |
mDeferFullBackup = in.mDeferFullBackup; |
| 60 |
mDeferKeyValueBackup = in.mDeferKeyValueBackup; |
| 61 |
mDeviceSpecificSettings = Collections.unmodifiableMap( |
| 62 |
new ArrayMap<>(in.mDeviceSpecificSettings)); |
| 63 |
mDisableAnimation = in.mDisableAnimation; |
| 64 |
mDisableAod = in.mDisableAod; |
| 65 |
mDisableLaunchBoost = in.mDisableLaunchBoost; |
| 66 |
mDisableOptionalSensors = in.mDisableOptionalSensors; |
| 67 |
mDisableVibration = in.mDisableVibration; |
| 68 |
mEnableAdjustBrightness = in.mEnableAdjustBrightness; |
| 69 |
mEnableDataSaver = in.mEnableDataSaver; |
| 70 |
mEnableFirewall = in.mEnableFirewall; |
| 71 |
mEnableNightMode = in.mEnableNightMode; |
| 72 |
mEnableQuickDoze = in.mEnableQuickDoze; |
| 73 |
mForceAllAppsStandby = in.mForceAllAppsStandby; |
| 74 |
mForceBackgroundCheck = in.mForceBackgroundCheck; |
| 75 |
mLocationMode = Math.max(PowerManager.MIN_LOCATION_MODE, |
| 76 |
Math.min(in.mLocationMode, PowerManager.MAX_LOCATION_MODE)); |
| 77 |
mSoundTriggerMode = Math.max(PowerManager.MIN_SOUND_TRIGGER_MODE, |
| 78 |
Math.min(in.mSoundTriggerMode, PowerManager.MAX_SOUND_TRIGGER_MODE)); |
| 79 |
} |
| 80 |
|
| 81 |
private BatterySaverPolicyConfig(Parcel in) { |
| 82 |
mAdjustBrightnessFactor = Math.max(0, Math.min(in.readFloat(), 1f)); |
| 83 |
mAdvertiseIsEnabled = in.readBoolean(); |
| 84 |
mDeferFullBackup = in.readBoolean(); |
| 85 |
mDeferKeyValueBackup = in.readBoolean(); |
| 86 |
|
| 87 |
final int size = in.readInt(); |
| 88 |
Map<String, String> deviceSpecificSettings = new ArrayMap<>(size); |
| 89 |
for (int i = 0; i < size; ++i) { |
| 90 |
String key = TextUtils.emptyIfNull(in.readString()); |
| 91 |
String val = TextUtils.emptyIfNull(in.readString()); |
| 92 |
if (key.trim().isEmpty()) { |
| 93 |
continue; |
| 94 |
} |
| 95 |
deviceSpecificSettings.put(key, val); |
| 96 |
} |
| 97 |
mDeviceSpecificSettings = Collections.unmodifiableMap(deviceSpecificSettings); |
| 98 |
|
| 99 |
mDisableAnimation = in.readBoolean(); |
| 100 |
mDisableAod = in.readBoolean(); |
| 101 |
mDisableLaunchBoost = in.readBoolean(); |
| 102 |
mDisableOptionalSensors = in.readBoolean(); |
| 103 |
mDisableVibration = in.readBoolean(); |
| 104 |
mEnableAdjustBrightness = in.readBoolean(); |
| 105 |
mEnableDataSaver = in.readBoolean(); |
| 106 |
mEnableFirewall = in.readBoolean(); |
| 107 |
mEnableNightMode = in.readBoolean(); |
| 108 |
mEnableQuickDoze = in.readBoolean(); |
| 109 |
mForceAllAppsStandby = in.readBoolean(); |
| 110 |
mForceBackgroundCheck = in.readBoolean(); |
| 111 |
mLocationMode = Math.max(PowerManager.MIN_LOCATION_MODE, |
| 112 |
Math.min(in.readInt(), PowerManager.MAX_LOCATION_MODE)); |
| 113 |
mSoundTriggerMode = Math.max(PowerManager.MIN_SOUND_TRIGGER_MODE, |
| 114 |
Math.min(in.readInt(), PowerManager.MAX_SOUND_TRIGGER_MODE)); |
| 115 |
} |
| 116 |
|
| 117 |
public static final @android.annotation.NonNull Creator<BatterySaverPolicyConfig> CREATOR = |
| 118 |
new Creator<BatterySaverPolicyConfig>() { |
| 119 |
@Override |
| 120 |
public BatterySaverPolicyConfig createFromParcel(Parcel in) { |
| 121 |
return new BatterySaverPolicyConfig(in); |
| 122 |
} |
| 123 |
|
| 124 |
@Override |
| 125 |
public BatterySaverPolicyConfig[] newArray(int size) { |
| 126 |
return new BatterySaverPolicyConfig[size]; |
| 127 |
} |
| 128 |
}; |
| 129 |
|
| 130 |
@Override |
| 131 |
public int describeContents() { |
| 132 |
return 0; |
| 133 |
} |
| 134 |
|
| 135 |
@Override |
| 136 |
public void writeToParcel(Parcel dest, int flags) { |
| 137 |
dest.writeFloat(mAdjustBrightnessFactor); |
| 138 |
dest.writeBoolean(mAdvertiseIsEnabled); |
| 139 |
dest.writeBoolean(mDeferFullBackup); |
| 140 |
dest.writeBoolean(mDeferKeyValueBackup); |
| 141 |
|
| 142 |
final Set<Map.Entry<String, String>> entries = mDeviceSpecificSettings.entrySet(); |
| 143 |
final int size = entries.size(); |
| 144 |
dest.writeInt(size); |
| 145 |
for (Map.Entry<String, String> entry : entries) { |
| 146 |
dest.writeString(entry.getKey()); |
| 147 |
dest.writeString(entry.getValue()); |
| 148 |
} |
| 149 |
|
| 150 |
dest.writeBoolean(mDisableAnimation); |
| 151 |
dest.writeBoolean(mDisableAod); |
| 152 |
dest.writeBoolean(mDisableLaunchBoost); |
| 153 |
dest.writeBoolean(mDisableOptionalSensors); |
| 154 |
dest.writeBoolean(mDisableVibration); |
| 155 |
dest.writeBoolean(mEnableAdjustBrightness); |
| 156 |
dest.writeBoolean(mEnableDataSaver); |
| 157 |
dest.writeBoolean(mEnableFirewall); |
| 158 |
dest.writeBoolean(mEnableNightMode); |
| 159 |
dest.writeBoolean(mEnableQuickDoze); |
| 160 |
dest.writeBoolean(mForceAllAppsStandby); |
| 161 |
dest.writeBoolean(mForceBackgroundCheck); |
| 162 |
dest.writeInt(mLocationMode); |
| 163 |
dest.writeInt(mSoundTriggerMode); |
| 164 |
} |
| 165 |
|
| 166 |
@NonNull |
| 167 |
@Override |
| 168 |
public String toString() { |
| 169 |
StringBuilder sb = new StringBuilder(); |
| 170 |
for (Map.Entry<String, String> entry : mDeviceSpecificSettings.entrySet()) { |
| 171 |
sb.append(entry.getKey()).append("=").append(entry.getValue()).append(","); |
| 172 |
} |
| 173 |
return "adjust_brightness_disabled=" + !mEnableAdjustBrightness + "," |
| 174 |
+ "adjust_brightness_factor=" + mAdjustBrightnessFactor + "," |
| 175 |
+ "advertise_is_enabled=" + mAdvertiseIsEnabled + "," |
| 176 |
+ "animation_disabled=" + mDisableAnimation + "," |
| 177 |
+ "aod_disabled=" + mDisableAod + "," |
| 178 |
+ "datasaver_disabled=" + !mEnableDataSaver + "," |
| 179 |
+ "enable_night_mode=" + mEnableNightMode + "," |
| 180 |
+ "firewall_disabled=" + !mEnableFirewall + "," |
| 181 |
+ "force_all_apps_standby=" + mForceAllAppsStandby + "," |
| 182 |
+ "force_background_check=" + mForceBackgroundCheck + "," |
| 183 |
+ "fullbackup_deferred=" + mDeferFullBackup + "," |
| 184 |
+ "gps_mode=" + mLocationMode + "," |
| 185 |
+ "keyvaluebackup_deferred=" + mDeferKeyValueBackup + "," |
| 186 |
+ "launch_boost_disabled=" + mDisableLaunchBoost + "," |
| 187 |
+ "optional_sensors_disabled=" + mDisableOptionalSensors + "," |
| 188 |
+ "quick_doze_enabled=" + mEnableQuickDoze + "," |
| 189 |
+ "soundtrigger_mode=" + mSoundTriggerMode + "," |
| 190 |
+ "vibration_disabled=" + mDisableVibration + "," |
| 191 |
+ sb.toString(); |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
public float getAdjustBrightnessFactor() { |
| 199 |
return mAdjustBrightnessFactor; |
| 200 |
} |
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
public boolean getAdvertiseIsEnabled() { |
| 206 |
return mAdvertiseIsEnabled; |
| 207 |
} |
| 208 |
|
| 209 |
|
| 210 |
public boolean getDeferFullBackup() { |
| 211 |
return mDeferFullBackup; |
| 212 |
} |
| 213 |
|
| 214 |
|
| 215 |
public boolean getDeferKeyValueBackup() { |
| 216 |
return mDeferKeyValueBackup; |
| 217 |
} |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
@NonNull |
| 223 |
public Map<String, String> getDeviceSpecificSettings() { |
| 224 |
return mDeviceSpecificSettings; |
| 225 |
} |
| 226 |
|
| 227 |
|
| 228 |
public boolean getDisableAnimation() { |
| 229 |
return mDisableAnimation; |
| 230 |
} |
| 231 |
|
| 232 |
|
| 233 |
public boolean getDisableAod() { |
| 234 |
return mDisableAod; |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
public boolean getDisableLaunchBoost() { |
| 239 |
return mDisableLaunchBoost; |
| 240 |
} |
| 241 |
|
| 242 |
|
| 243 |
public boolean getDisableOptionalSensors() { |
| 244 |
return mDisableOptionalSensors; |
| 245 |
} |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
@PowerManager.SoundTriggerPowerSaveMode |
| 251 |
public int getSoundTriggerMode() { |
| 252 |
return mSoundTriggerMode; |
| 253 |
} |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
@Deprecated |
| 261 |
public boolean getDisableSoundTrigger() { |
| 262 |
return mSoundTriggerMode == PowerManager.SOUND_TRIGGER_MODE_ALL_DISABLED; |
| 263 |
} |
| 264 |
|
| 265 |
|
| 266 |
public boolean getDisableVibration() { |
| 267 |
return mDisableVibration; |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
public boolean getEnableAdjustBrightness() { |
| 272 |
return mEnableAdjustBrightness; |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
public boolean getEnableDataSaver() { |
| 277 |
return mEnableDataSaver; |
| 278 |
} |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
|
| 284 |
public boolean getEnableFirewall() { |
| 285 |
return mEnableFirewall; |
| 286 |
} |
| 287 |
|
| 288 |
|
| 289 |
public boolean getEnableNightMode() { |
| 290 |
return mEnableNightMode; |
| 291 |
} |
| 292 |
|
| 293 |
|
| 294 |
public boolean getEnableQuickDoze() { |
| 295 |
return mEnableQuickDoze; |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
public boolean getForceAllAppsStandby() { |
| 300 |
return mForceAllAppsStandby; |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
public boolean getForceBackgroundCheck() { |
| 310 |
return mForceBackgroundCheck; |
| 311 |
} |
| 312 |
|
| 313 |
|
| 314 |
public int getLocationMode() { |
| 315 |
return mLocationMode; |
| 316 |
} |
| 317 |
|
| 318 |
|
| 319 |
public static final class Builder { |
| 320 |
private float mAdjustBrightnessFactor = 1f; |
| 321 |
private boolean mAdvertiseIsEnabled = false; |
| 322 |
private boolean mDeferFullBackup = false; |
| 323 |
private boolean mDeferKeyValueBackup = false; |
| 324 |
@NonNull |
| 325 |
private final ArrayMap<String, String> mDeviceSpecificSettings = new ArrayMap<>(); |
| 326 |
private boolean mDisableAnimation = false; |
| 327 |
private boolean mDisableAod = false; |
| 328 |
private boolean mDisableLaunchBoost = false; |
| 329 |
private boolean mDisableOptionalSensors = false; |
| 330 |
private boolean mDisableVibration = false; |
| 331 |
private boolean mEnableAdjustBrightness = false; |
| 332 |
private boolean mEnableDataSaver = false; |
| 333 |
private boolean mEnableFirewall = false; |
| 334 |
private boolean mEnableNightMode = false; |
| 335 |
private boolean mEnableQuickDoze = false; |
| 336 |
private boolean mForceAllAppsStandby = false; |
| 337 |
private boolean mForceBackgroundCheck = false; |
| 338 |
private int mLocationMode = PowerManager.LOCATION_MODE_NO_CHANGE; |
| 339 |
private int mSoundTriggerMode = PowerManager.SOUND_TRIGGER_MODE_ALL_ENABLED; |
| 340 |
|
| 341 |
public Builder() { |
| 342 |
} |
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
public Builder(@NonNull BatterySaverPolicyConfig batterySaverPolicyConfig) { |
| 349 |
mAdjustBrightnessFactor = batterySaverPolicyConfig.getAdjustBrightnessFactor(); |
| 350 |
mAdvertiseIsEnabled = batterySaverPolicyConfig.getAdvertiseIsEnabled(); |
| 351 |
mDeferFullBackup = batterySaverPolicyConfig.getDeferFullBackup(); |
| 352 |
mDeferKeyValueBackup = batterySaverPolicyConfig.getDeferKeyValueBackup(); |
| 353 |
|
| 354 |
for (String key : |
| 355 |
batterySaverPolicyConfig.getDeviceSpecificSettings().keySet()) { |
| 356 |
mDeviceSpecificSettings.put(key, |
| 357 |
batterySaverPolicyConfig.getDeviceSpecificSettings().get(key)); |
| 358 |
} |
| 359 |
|
| 360 |
mDisableAnimation = batterySaverPolicyConfig.getDisableAnimation(); |
| 361 |
mDisableAod = batterySaverPolicyConfig.getDisableAod(); |
| 362 |
mDisableLaunchBoost = batterySaverPolicyConfig.getDisableLaunchBoost(); |
| 363 |
mDisableOptionalSensors = batterySaverPolicyConfig.getDisableOptionalSensors(); |
| 364 |
mDisableVibration = batterySaverPolicyConfig.getDisableVibration(); |
| 365 |
mEnableAdjustBrightness = batterySaverPolicyConfig.getEnableAdjustBrightness(); |
| 366 |
mEnableDataSaver = batterySaverPolicyConfig.getEnableDataSaver(); |
| 367 |
mEnableFirewall = batterySaverPolicyConfig.getEnableFirewall(); |
| 368 |
mEnableNightMode = batterySaverPolicyConfig.getEnableNightMode(); |
| 369 |
mEnableQuickDoze = batterySaverPolicyConfig.getEnableQuickDoze(); |
| 370 |
mForceAllAppsStandby = batterySaverPolicyConfig.getForceAllAppsStandby(); |
| 371 |
mForceBackgroundCheck = batterySaverPolicyConfig.getForceBackgroundCheck(); |
| 372 |
mLocationMode = batterySaverPolicyConfig.getLocationMode(); |
| 373 |
mSoundTriggerMode = batterySaverPolicyConfig.getSoundTriggerMode(); |
| 374 |
} |
| 375 |
|
| 376 |
|
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
@NonNull |
| 382 |
public Builder setAdjustBrightnessFactor(float adjustBrightnessFactor) { |
| 383 |
mAdjustBrightnessFactor = adjustBrightnessFactor; |
| 384 |
return this; |
| 385 |
} |
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
@NonNull |
| 392 |
public Builder setAdvertiseIsEnabled(boolean advertiseIsEnabled) { |
| 393 |
mAdvertiseIsEnabled = advertiseIsEnabled; |
| 394 |
return this; |
| 395 |
} |
| 396 |
|
| 397 |
|
| 398 |
@NonNull |
| 399 |
public Builder setDeferFullBackup(boolean deferFullBackup) { |
| 400 |
mDeferFullBackup = deferFullBackup; |
| 401 |
return this; |
| 402 |
} |
| 403 |
|
| 404 |
|
| 405 |
@NonNull |
| 406 |
public Builder setDeferKeyValueBackup(boolean deferKeyValueBackup) { |
| 407 |
mDeferKeyValueBackup = deferKeyValueBackup; |
| 408 |
return this; |
| 409 |
} |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
@NonNull |
| 420 |
public Builder addDeviceSpecificSetting(@NonNull String key, @NonNull String value) { |
| 421 |
if (key == null) { |
| 422 |
throw new IllegalArgumentException("Key cannot be null"); |
| 423 |
} |
| 424 |
key = key.trim(); |
| 425 |
if (TextUtils.isEmpty(key)) { |
| 426 |
throw new IllegalArgumentException("Key cannot be empty"); |
| 427 |
} |
| 428 |
mDeviceSpecificSettings.put(key, TextUtils.emptyIfNull(value)); |
| 429 |
return this; |
| 430 |
} |
| 431 |
|
| 432 |
|
| 433 |
@NonNull |
| 434 |
public Builder setDisableAnimation(boolean disableAnimation) { |
| 435 |
mDisableAnimation = disableAnimation; |
| 436 |
return this; |
| 437 |
} |
| 438 |
|
| 439 |
|
| 440 |
@NonNull |
| 441 |
public Builder setDisableAod(boolean disableAod) { |
| 442 |
mDisableAod = disableAod; |
| 443 |
return this; |
| 444 |
} |
| 445 |
|
| 446 |
|
| 447 |
@NonNull |
| 448 |
public Builder setDisableLaunchBoost(boolean disableLaunchBoost) { |
| 449 |
mDisableLaunchBoost = disableLaunchBoost; |
| 450 |
return this; |
| 451 |
} |
| 452 |
|
| 453 |
|
| 454 |
@NonNull |
| 455 |
public Builder setDisableOptionalSensors(boolean disableOptionalSensors) { |
| 456 |
mDisableOptionalSensors = disableOptionalSensors; |
| 457 |
return this; |
| 458 |
} |
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
@Deprecated |
| 466 |
@NonNull |
| 467 |
public Builder setDisableSoundTrigger(boolean disableSoundTrigger) { |
| 468 |
if (disableSoundTrigger) { |
| 469 |
mSoundTriggerMode = PowerManager.SOUND_TRIGGER_MODE_ALL_DISABLED; |
| 470 |
} else { |
| 471 |
mSoundTriggerMode = PowerManager.SOUND_TRIGGER_MODE_ALL_ENABLED; |
| 472 |
} |
| 473 |
return this; |
| 474 |
} |
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
@NonNull |
| 480 |
public Builder setSoundTriggerMode( |
| 481 |
@PowerManager.SoundTriggerPowerSaveMode int soundTriggerMode) { |
| 482 |
mSoundTriggerMode = soundTriggerMode; |
| 483 |
return this; |
| 484 |
} |
| 485 |
|
| 486 |
|
| 487 |
@NonNull |
| 488 |
public Builder setDisableVibration(boolean disableVibration) { |
| 489 |
mDisableVibration = disableVibration; |
| 490 |
return this; |
| 491 |
} |
| 492 |
|
| 493 |
|
| 494 |
@NonNull |
| 495 |
public Builder setEnableAdjustBrightness(boolean enableAdjustBrightness) { |
| 496 |
mEnableAdjustBrightness = enableAdjustBrightness; |
| 497 |
return this; |
| 498 |
} |
| 499 |
|
| 500 |
|
| 501 |
@NonNull |
| 502 |
public Builder setEnableDataSaver(boolean enableDataSaver) { |
| 503 |
mEnableDataSaver = enableDataSaver; |
| 504 |
return this; |
| 505 |
} |
| 506 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
@NonNull |
| 512 |
public Builder setEnableFirewall(boolean enableFirewall) { |
| 513 |
mEnableFirewall = enableFirewall; |
| 514 |
return this; |
| 515 |
} |
| 516 |
|
| 517 |
|
| 518 |
@NonNull |
| 519 |
public Builder setEnableNightMode(boolean enableNightMode) { |
| 520 |
mEnableNightMode = enableNightMode; |
| 521 |
return this; |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
@NonNull |
| 526 |
public Builder setEnableQuickDoze(boolean enableQuickDoze) { |
| 527 |
mEnableQuickDoze = enableQuickDoze; |
| 528 |
return this; |
| 529 |
} |
| 530 |
|
| 531 |
|
| 532 |
@NonNull |
| 533 |
public Builder setForceAllAppsStandby(boolean forceAllAppsStandby) { |
| 534 |
mForceAllAppsStandby = forceAllAppsStandby; |
| 535 |
return this; |
| 536 |
} |
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
@NonNull |
| 545 |
public Builder setForceBackgroundCheck(boolean forceBackgroundCheck) { |
| 546 |
mForceBackgroundCheck = forceBackgroundCheck; |
| 547 |
return this; |
| 548 |
} |
| 549 |
|
| 550 |
|
| 551 |
@NonNull |
| 552 |
public Builder setLocationMode(@PowerManager.LocationPowerSaveMode int locationMode) { |
| 553 |
mLocationMode = locationMode; |
| 554 |
return this; |
| 555 |
} |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
|
| 561 |
@NonNull |
| 562 |
public BatterySaverPolicyConfig build() { |
| 563 |
return new BatterySaverPolicyConfig(this); |
| 564 |
} |
| 565 |
} |
| 566 |
} |