Home | History | Annotate | Download | only in app
      1 /*
      2  * Copyright (C) 2008 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 
     17 package com.android.internal.app;
     18 
     19 import com.android.internal.os.BatteryStatsImpl;
     20 
     21 import android.os.ParcelFileDescriptor;
     22 import android.os.WorkSource;
     23 import android.telephony.DataConnectionRealTimeInfo;
     24 import android.telephony.SignalStrength;
     25 
     26 interface IBatteryStats {
     27     // These first methods are also called by native code, so must
     28     // be kept in sync with frameworks/native/include/binder/IBatteryStats.h
     29     void noteStartSensor(int uid, int sensor);
     30     void noteStopSensor(int uid, int sensor);
     31     void noteStartVideo(int uid);
     32     void noteStopVideo(int uid);
     33     void noteStartAudio(int uid);
     34     void noteStopAudio(int uid);
     35     void noteResetVideo();
     36     void noteResetAudio();
     37 
     38     // Remaining methods are only used in Java.
     39     byte[] getStatistics();
     40 
     41     ParcelFileDescriptor getStatisticsStream();
     42 
     43     // Return the computed amount of time remaining on battery, in milliseconds.
     44     // Returns -1 if nothing could be computed.
     45     long computeBatteryTimeRemaining();
     46 
     47     // Return the computed amount of time remaining to fully charge, in milliseconds.
     48     // Returns -1 if nothing could be computed.
     49     long computeChargeTimeRemaining();
     50 
     51     void noteEvent(int code, String name, int uid);
     52 
     53     void noteSyncStart(String name, int uid);
     54     void noteSyncFinish(String name, int uid);
     55     void noteJobStart(String name, int uid);
     56     void noteJobFinish(String name, int uid);
     57 
     58     void noteStartWakelock(int uid, int pid, String name, String historyName,
     59             int type, boolean unimportantForLogging);
     60     void noteStopWakelock(int uid, int pid, String name, String historyName, int type);
     61 
     62     void noteStartWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
     63             int type, boolean unimportantForLogging);
     64     void noteChangeWakelockFromSource(in WorkSource ws, int pid, String name, String histyoryName,
     65             int type, in WorkSource newWs, int newPid, String newName,
     66             String newHistoryName, int newType, boolean newUnimportantForLogging);
     67     void noteStopWakelockFromSource(in WorkSource ws, int pid, String name, String historyName,
     68             int type);
     69 
     70     void noteVibratorOn(int uid, long durationMillis);
     71     void noteVibratorOff(int uid);
     72     void noteFlashlightOn();
     73     void noteFlashlightOff();
     74     void noteStartGps(int uid);
     75     void noteStopGps(int uid);
     76     void noteScreenState(int state);
     77     void noteScreenBrightness(int brightness);
     78     void noteUserActivity(int uid, int event);
     79     void noteInteractive(boolean interactive);
     80     void noteConnectivityChanged(int type, String extra);
     81     void noteMobileRadioPowerState(int powerState, long timestampNs);
     82     void notePhoneOn();
     83     void notePhoneOff();
     84     void notePhoneSignalStrength(in SignalStrength signalStrength);
     85     void notePhoneDataConnectionState(int dataType, boolean hasData);
     86     void notePhoneState(int phoneState);
     87     void noteWifiOn();
     88     void noteWifiOff();
     89     void noteWifiRunning(in WorkSource ws);
     90     void noteWifiRunningChanged(in WorkSource oldWs, in WorkSource newWs);
     91     void noteWifiStopped(in WorkSource ws);
     92     void noteWifiState(int wifiState, String accessPoint);
     93     void noteWifiSupplicantStateChanged(int supplState, boolean failedAuth);
     94     void noteWifiRssiChanged(int newRssi);
     95     void noteBluetoothOn();
     96     void noteBluetoothOff();
     97     void noteBluetoothState(int bluetoothState);
     98     void noteFullWifiLockAcquired(int uid);
     99     void noteFullWifiLockReleased(int uid);
    100     void noteWifiScanStarted(int uid);
    101     void noteWifiScanStopped(int uid);
    102     void noteWifiMulticastEnabled(int uid);
    103     void noteWifiMulticastDisabled(int uid);
    104     void noteFullWifiLockAcquiredFromSource(in WorkSource ws);
    105     void noteFullWifiLockReleasedFromSource(in WorkSource ws);
    106     void noteWifiScanStartedFromSource(in WorkSource ws);
    107     void noteWifiScanStoppedFromSource(in WorkSource ws);
    108     void noteWifiBatchedScanStartedFromSource(in WorkSource ws, int csph);
    109     void noteWifiBatchedScanStoppedFromSource(in WorkSource ws);
    110     void noteWifiMulticastEnabledFromSource(in WorkSource ws);
    111     void noteWifiMulticastDisabledFromSource(in WorkSource ws);
    112     void noteNetworkInterfaceType(String iface, int type);
    113     void noteNetworkStatsEnabled();
    114     void setBatteryState(int status, int health, int plugType, int level, int temp, int volt);
    115     long getAwakeTimeBattery();
    116     long getAwakeTimePlugged();
    117 }
    118