1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.systemui.statusbar.policy; 18 19import com.android.systemui.DemoMode; 20 21import java.io.FileDescriptor; 22import java.io.PrintWriter; 23 24public interface BatteryController extends DemoMode { 25 /** 26 * Prints the current state of the {@link BatteryController} to the given {@link PrintWriter}. 27 */ 28 void dump(FileDescriptor fd, PrintWriter pw, String[] args); 29 30 /** 31 * Sets if the current device is in power save mode. 32 */ 33 void setPowerSaveMode(boolean powerSave); 34 35 /** 36 * Returns {@code true} if the device is currently in power save mode. 37 */ 38 boolean isPowerSave(); 39 40 void addStateChangedCallback(BatteryStateChangeCallback cb); 41 void removeStateChangedCallback(BatteryStateChangeCallback cb); 42 43 /** 44 * A listener that will be notified whenever a change in battery level or power save mode 45 * has occurred. 46 */ 47 interface BatteryStateChangeCallback { 48 void onBatteryLevelChanged(int level, boolean pluggedIn, boolean charging); 49 void onPowerSaveChanged(boolean isPowerSave); 50 } 51} 52