History log of /frameworks/base/core/java/android/os/BatteryManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
928167e04475d45413bef579b6b03c6c3eca591f 12-Apr-2018 Michael Wright <michaelwr@google.com> Add API to compute charge time remaining.

This is so unbundled applications (e.g. dreams) can present a charge
time indicator that is in sync with the rest of the system.

Bug: 77919650
Test: manual
Change-Id: I7d62dea4fd49eb173b4f052a0fc36f4e7ce5b6bb
/frameworks/base/core/java/android/os/BatteryManager.java
70e7543066523da04931a52d8c6d8346ce87d376 02-Mar-2018 Fyodor Kupolov <fkupolov@google.com> Added ACTION_BATTERY_LEVEL_CHANGED

Sent when the current battery level changes.

It has EXTRA_EVENTS that carries a list of Bundle instances representing
individual battery level changes with associated extras from
ACTION_BATTERY_CHANGED

Each event has EXTRA_EVENT_TIMESTAMP representing time when it occured.

Test: manual
Bug: 74020080
Change-Id: I993005950299c5298c9111ca51cc7717e1f029de
/frameworks/base/core/java/android/os/BatteryManager.java
ac32c9acc3d3a09f98c6cc5d4a054daa3aa681ec 31-Jan-2018 Beverly <beverlyt@google.com> Wireless charging on aod and lockscreen

- wireless charging animation plays on aod + lockscreen
- timing changes on animation based on design spec
- charging feedback only given if phone is not just booted

Test: manual
Bug: 67598445
Change-Id: I009ff6016141bcdfe9f0392bb9a1c220ea88dfe5
/frameworks/base/core/java/android/os/BatteryManager.java
1a1b0464cb43903ed540f4c43fd423b16e398c04 12-Jan-2018 Bookatz <bookatz@google.com> Statsd and frameworks reference proto enums

For frameworks constants that don't have intrinsic meaning (i.e. their actual
value and order don't matter), so that it is unlikely that their values
will be changed:
This cl introduces proto enums representing some constants found in
the Android codebase, and connects the two.

By using the Proto enum as the source-of-truth, it means that Java and
proto can be kept in sync. Otherwise, when the Java frameworks code
changes, it silently breaks the protos from working properly, since the enums
are wrong. By having the Java code reference the proto enums, it ensures
that everything is in sync. The values of the constants are unchanged.
But future changes to these constants will need to be done in the proto
file, which the Java file merely references.

The protos are necessary for incidentd and statsd and, in the future,
possibly dumpsys. In this way, the logging mechanism is much less likely
to get broken when new constants are added, and we can be ensured that
the logging accurately reflects the underlying codebase.

Bug: 69478930
Test: cts-tradefed run cts-dev -m CtsStatsdHostTestCases
Test: cts-tradefed run cts-dev -m CtsIncidentHostTestCases
Change-Id: If79032c34b2799db1e3e70cb47b1312fd72092b9
/frameworks/base/core/java/android/os/BatteryManager.java
74ed6ecdc4b97c4d9a06603045b49196d5aad040 22-Nov-2017 Dianne Hackborn <hackbod@google.com> Fix issue #67019445: Detect BATTERY_LOW/OKAY

Add a new extra that indicates the battery is low.

Test: BatteryConstraintTest updated
Change-Id: I9ff92e15974ea092283a840cd01c860d6586c9b5
/frameworks/base/core/java/android/os/BatteryManager.java
b0f1352be15c0f669bd538fffee121ac2ec902a7 31-Oct-2017 Yifan Hong <elsk@google.com> Fix BatteryManager.getIntProperty returns 0 as invalid value.

Long.MIN_VALUE cast to Integer.MIN_VALUE always returns 0.

Change-Id: Ief7a1fd12a356c83a4ef3f28139c330034507dfa
Fixes: 37090343
Test: BatteryManagerTest
/frameworks/base/core/java/android/os/BatteryManager.java
d86b8fea43ebb6e5c31691b44d8ceb0d8d3c9072 03-Jun-2017 Jeff Sharkey <jsharkey@android.com> Annotate @SystemApi with required permissions.

Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.

Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.

This is purely a docs change; no logic changes are being made.

Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
/frameworks/base/core/java/android/os/BatteryManager.java
30a50a02f0db53befce0046ff3472ce2de3820f6 28-Feb-2017 TreeHugger Robot <treehugger-gerrit@google.com> Merge "BatteryManager: rename BATTERY_PROPERTY_BATTERY_STATUS"
2e88d4b6fe21eacb223b862d342d5b3099f6ca7e 28-Feb-2017 Jin Qian <jinqian@google.com> BatteryManager: rename BATTERY_PROPERTY_BATTERY_STATUS

To BATTERY_PROPERTY_STATUS

Test: build
Bug: 35813122
Change-Id: Ia8308def79b79706dbdc3e47f93afa56661a47aa
/frameworks/base/core/java/android/os/BatteryManager.java
a06ec6a9435f9555142e700f54cf20278bc1982f 13-Feb-2017 Dianne Hackborn <hackbod@google.com> Add new job scheduler constraints for "battery not low".

Clean up the implementation of boolean constraints so that
they are in a single flags value that gets propagated all of
the way from JobInfo.Builder in to the JobStatus. Much simpler
and easier to add new constraints!

Also introduce some shell commands to make it easier to write
tests against the job scheduler (and other things tied to power).
One of the big things here is that there is a new sequence number
that propagates with battery updates, which we can look for in
the job scheduler to determine when a change the test has made
to battery state has actually gotten applied, to allow it to
safely and minimally wait until executing the condition being
tested.

Test: New BatteryConstraintTest suite added.

Change-Id: I11076d90b80ec25ee604c29b6a6dc2337fd867ce
/frameworks/base/core/java/android/os/BatteryManager.java
edf0a3715da497784d810d0b07e4827d54a887ac 03-Feb-2017 Jin Qian <jinqian@google.com> BatteryManager: Add battery status to getProperty

Bug: 34198239
Change-Id: I65cef6864b1074445342e18f49c7cecd0706b938
/frameworks/base/core/java/android/os/BatteryManager.java
a21c42769f5d144f3e9fe8884cc3b84cbb869fd2 10-Nov-2016 Sandeep Patil <sspatil@google.com> health: import android.hardware.health@1.0 constants into BatteryManager

Test: make
Bug: b/32724915

Change-Id: I7ca7507b7be54442dc3250b02db3e4f7e95f0685
Signed-off-by: Sandeep Patil <sspatil@google.com>
/frameworks/base/core/java/android/os/BatteryManager.java
49ca529a850e60482ddcc8c0762105b4aa10f35f 10-May-2016 Jeff Sharkey <jsharkey@android.com> Avoid caching services with missing binders.

When fetching system services early during boot, if the underlying
binder interface hasn't been published yet, we end up caching a
manager class that is broken for the remainder of the process
lifetime, and innocent downstream callers end up using the broken
cached manager.

Fix this by using an explicit exception to quickly abort manager
creation when the underlying binder is missing. The exception is
only used to skip the remainder of the manager creation, and it
doesn't actually crash the process.

Bug: 28634953
Change-Id: I0cb62261e6d6833660704b93a11185aa11a2ac97
/frameworks/base/core/java/android/os/BatteryManager.java
6361e22feae7cdb0968f1056c7834e2825eeae31 07-Apr-2016 Ruchi Kandoi <kandoiruchi@google.com> batteryService: Add Charge Counter.

Bug: 27174034
Change-Id: Ib8bc8f617288c0ad543c67e0fa609c5a0c87b5fd
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
/frameworks/base/core/java/android/os/BatteryManager.java
c53962d4ede82a03b62f0c8bb86bd0da090a15eb 02-Mar-2016 Jeff Sharkey <jsharkey@android.com> When system server goes down, crash apps more.

Apps making calls into the system server may end up persisting
internal state or making security decisions based on the perceived
success or failure of a call, or the default values returned.

The reality is that if the system process just died, init will be
along shortly to kill all running apps, so we should have no problem
rethrowing the RemoteException as a RuntimeException.

Bug: 27364859
Change-Id: Ife0bcb079636c88d54c44d17eb580409fd79028b
/frameworks/base/core/java/android/os/BatteryManager.java
f92fcfe36ad841cba4774e7f2129e8dab7ac784a 27-Oct-2015 Badhri Jagan Sridharan <Badhri@google.com> BatteryService: Add Max charging voltage

Bug: 25229483
Change-Id: Ibeba97eb145c3d59a763bd8632ab7fcc43118e4b
/frameworks/base/core/java/android/os/BatteryManager.java
7b04311d88e377c67b4c663091b6b1c63c932c52 10-Jul-2015 Adrian Roos <roosa@google.com> Show charging speed on Keyguard

Bug: 8099739
Change-Id: I2e5c21dd7ec028ce47fb03ab71e74f7fccaa9e36
/frameworks/base/core/java/android/os/BatteryManager.java
4870e9d5eba59fb257a87f97f1adf0b734cf48d3 09-Apr-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode and other power stuff.

Add idle mode support to the alarm manager. Introduce
a new concept of flags associated with alarms to tell
the alarm manager how to treat the alarm -- they allow
everything from the alarm that will bring us out of idle
mode, to alarms that are allowed when idle or should
also bring us out of idle. The standalone boolean is
now also a flag.

(Note there is currently no protection from user space
setting the flags however it wants; I will be working
on that in a follow-up change.)

When in idle mode, the alarm manager pushes all alarms
that shouldn't execute during that time over to a
separate list that is not executed until out of idle.
To help with this, I reworked a bit how Alarm objects
are managed, so that when rebatching or moving between
lists we don't have to allocated new objects but can
just use the same existing instance.

Also tweaked the sync manager to deal with idle mode,
which currently just means doing the same thing as when
low on storage -- turning off sync.

Add new ACTION_CHARGING and ACTION_DISCHARGING broadcasts
that apps can listen for to know when the device is actively
charging and discharging. These are better than the old
POWER_CONNECTED and POWER_DISCONNECTED ones because we only
report charging when we actually see that there is enough
power being provided to charge the battery (and will report
discharging if there is not enough power).

The job controller uses these new actions for scheduling
jobs that want to run while plugged in. Removed the
"stable charging" stuff while doing so, since the new
charging state serves as an even better signal for that.

Introduced two new process states: FOREGROUND_SERVICE and
TOP_SLEEPING. This will allow us to treat foreground services
specially (such as still allowing network access to them for
background music playback) while not mixing them together with
whatever happens to be the top activity while the device is
asleep.

Also some other small cleanup here and there.

Change-Id: I7a9808b578bad6f50deb8e1baf919298512a0d3a
/frameworks/base/core/java/android/os/BatteryManager.java
6e53931f49f49245deef8622eb8e7dc6ccf04536 25-Feb-2015 Jeff Brown <jeffbrown@google.com> Add Context.getSystemService(Class<?>).

Added an overload of getSystemService() that takes a class instead of a
service name to eliminate the extra cast and provide more type safety.

Cleaned up docs.

Removed the default constructor of BatteryManager which should not have
existed.

Change-Id: I9da46b20641fc83ecd3342560e5b94cb721f289c
/frameworks/base/core/java/android/os/BatteryManager.java
5fde3ff375e6cec3c11ddef7a4650d5f5f4942d1 05-Jun-2014 Todd Poynor <toddpoynor@google.com> BatteryManager: battery property query API update

Move battery property value accessors to BatteryManager.

Hide BatteryProperty class.

Bug: 15191190
Change-Id: Ic021e6e28a8bc30c145ccc31b3a3446ba82d2004
/frameworks/base/core/java/android/os/BatteryManager.java
540f4d6db34905b38ee1095ef35fe98d3fa38a9e 09-May-2014 Todd Poynor <toddpoynor@google.com> BatteryManager: Add property ENERGY_COUNTER and long data type properties

Change-Id: Ie7f9b19c5cd47a48bb33af03d51acddaa14b0243
/frameworks/base/core/java/android/os/BatteryManager.java
e35872da97ac6bd07d2d9ac5af8a7c18ad290718 10-Dec-2013 Todd Poynor <toddpoynor@google.com> BatteryManager: Add API and service for battery property retrieval

Add service "batterymanager" and method getProperty to retrieve
battery properties. This is a public API.

Make BatteryProperty public. Cleanups for public-facing API.

Change-Id: I3637d131aabe4811dff40661728d5353eaf854c4
/frameworks/base/core/java/android/os/BatteryManager.java
a4d8204e3068b9d8d6908d4cf3440e81967867a3 03-Oct-2012 Jeff Brown <jeffbrown@google.com> Fix some synchronization issues in BatteryService.

Some of the BatteryService state was being locked
sometimes and it wasn't at all consistent.

Bug: 7158734
Change-Id: I46e75f66fde92c5a577a80a6bd99c9573066f3c1
/frameworks/base/core/java/android/os/BatteryManager.java
37a37f445cbcd64376af153dd79ea2a123d9405d 15-Aug-2012 Brian Muramatsu <btmura@google.com> add wireless charger support

bug: 6879638

- add new enum value BATTERY_PLUGGED_WIRELESS
- check for sys online file with contents "Wireless"

Change-Id: I22dc3c40f50573c98643e7b5cbcb237d0216530d
/frameworks/base/core/java/android/os/BatteryManager.java
4ca7f1e2811dc889e526de6c3d30bac8501c23d2 28-Oct-2010 Joe Onorato <joeo@google.com> Implement reminder power dialog and invalid charger dialog.

Bug: 2510318
Bug: 2974431
Change-Id: I92eb419eeffb657e5572a35a490735a96b303d6b
/frameworks/base/core/java/android/os/BatteryManager.java
02241ab2929c34aa48acdf4befcc9cacd86c1a6f 12-Oct-2010 Jean-Baptiste Queru <jbq@google.com> am 89fbcd72: resolved conflicts for merge of c2894474 to gingerbread-plus-aosp

Merge commit '89fbcd72fbe6ef26ea2703f8e338fd198c958ecc'

* commit '89fbcd72fbe6ef26ea2703f8e338fd198c958ecc':
Support showing "Cold" battery health.
9239612870d08fbf79b3c53f11bd5d7cb4beb875 20-Sep-2010 Imre Sunyi <imre.sunyi@sonyericsson.com> Support showing "Cold" battery health.

The Linux kernel supports reporting "cold" battery health to sysfs.
Android framework has not implemented this and it defaults to "unknown"
This adds handling the cold battery health.

Change-Id: Idcc156aae6aabce73391081143f79d052edf332e
/frameworks/base/core/java/android/os/BatteryManager.java
deff9c85ec5c9884d731817e43058589d6fd4631 04-Sep-2010 Mike Lockwood <lockwood@android.com> Add extra to ACTION_BATTERY_CHANGED to indicate an invalid charger is attached.

Change-Id: I24a24a49d2e3ddee8fbce590ef75ea323b3be97b
Signed-off-by: Mike Lockwood <lockwood@android.com>
/frameworks/base/core/java/android/os/BatteryManager.java
edd9316ca9b3b24d54e8a2468927da7e813098fc 19-Sep-2009 Dianne Hackborn <hackbod@google.com> Add better APIs for the battery status, and other cleanup.

Also add new configs for keeping screen on while docked, which will
be used elsewhere.

Change-Id: Ifaa1118f14fd850ac809895f9a5c9e8c413259b8
/frameworks/base/core/java/android/os/BatteryManager.java
9066cfe9886ac131c34d59ed0e2d287b0e3c0087 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/BatteryManager.java
d83a98f4ce9cfa908f5c54bbd70f03eec07e7553 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
/frameworks/base/core/java/android/os/BatteryManager.java
f013e1afd1e68af5e3b868c26a653bbfb39538f8 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
/frameworks/base/core/java/android/os/BatteryManager.java
54b6cfa9a9e5b861a9930af873580d6dc20f773c 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution
/frameworks/base/core/java/android/os/BatteryManager.java