355 Commits

Author SHA1 Message Date
Adam Lesinski
95c42974f7 Private flags are masked in correct variable
Newly added private flags were being masked in the public flag variable
as opposed to the correct privateFlags variable.

bug:11033280
bug:11043194
Change-Id: Idda3a70a083457f3f1b7d4b46d231f4a7e704cf0
2013-10-02 16:18:55 -07:00
destradaa
7f02eb2c84 Ensure access to the map of geofence callbacks is synchronized in all cases
Fix Java reference leak in the JNI layer

Bug: 10624887
Change-Id: I656973653d82c73a7ba2b51f22989ffed144c5df
2013-09-20 15:19:00 -07:00
Alex Ray
c333a3f7c6 Merge "consumer_ir: add length to get carrier freqs" into klp-dev 2013-09-12 01:55:27 +00:00
Ruben Brunk
91019c9ef3 Merge "Remove dependency on JNIHelp header side effects." into klp-dev 2013-09-12 00:01:28 +00:00
Alex Ray
5022f275e3 consumer_ir: add length to get carrier freqs
Change-Id: I2c1ac27e46c0bcfdfadef227a2fa79bdcf7085d4
2013-09-11 16:21:25 -07:00
destradaa
f8a910fbd5 Merge "Fix exceptions in the Flp Hal layer: - JNI exception accessing a geofence method with wrong signature - FlpHardwareProvider exception when the monitoring status contains no location information" into klp-dev 2013-09-11 21:15:34 +00:00
destradaa
839904eed8 Fix exceptions in the Flp Hal layer:
- JNI exception accessing a geofence method with wrong signature
- FlpHardwareProvider exception when the monitoring status contains no location information

Bug: 10691492
Change-Id: I1959712912af712dc9dc344f20afd1112da46efc
2013-09-11 12:42:51 -07:00
Erik Gilling
51e95df8f2 Add consumer IR framework
Change-Id: I786c00db0cce61ef75e4edc24e90f2cdcba6dbfb
2013-09-11 09:52:47 -07:00
Ruben Brunk
87eac99a21 Remove dependency on JNIHelp header side effects.
Bug: 10680559
Change-Id: I47870d6c48906e0a420c52b7bc5945ffe29c68a2
2013-09-10 20:47:43 -07:00
Jeff Brown
bd181bb832 Propagate input ANR reason to activity manager log.
Make it a little easier to diagnose input dispatch timeouts by
providing the detailed reason as the ANR annotation in the log.

Bug: 10689184
Change-Id: Ie18fd9ad066b0673d1f57c030e027ad0085f4650
2013-09-10 16:44:24 -07:00
destradaa
b75cb3aeb4 Fix leaks of JNI objects in the local reference table
Change-Id: I769502f8b13e0025707abdf98c24f2cac0604602
2013-08-23 17:26:16 -07:00
destradaa
264705a3f6 Fixes to FlpHal JNI layer.
Change-Id: I6bc7cab7b8a042be89097f786b42d8b9ae0425ea
2013-08-21 14:03:50 -07:00
destradaa
0682809ad0 Add support in the platform for Flp Geofencing.
Change-Id: I0fb0e276d3a06322697bb5d46323779aca1f78c5
2013-08-13 16:00:04 -07:00
destradaa
1af4b0280a Add FlpHal layer to support Location Batching.
Change-Id: Ia3a57d869dfb3f067a1b95fa66d54f311ddcfdc3
2013-08-08 15:27:38 -07:00
Todd Poynor
26faecc85e BatteryService use IBatteryProperties interfaces, drop JNI
IBatteryPropertiesListener binder interface to deliver notifications of
changed battery/power status from healthd system health daemon.  healthd
watches uevents from power_supply.

Change-Id: I1ab38622baf28356a6627fe2354b77e2ef99d838
2013-07-30 00:02:04 +00:00
Jeff Brown
ef69117979 Remove dead code in system server initialization.
System server always forks from Zygote so we no longer need
the system_server executable which was probably broken anyhow.
This makes the initialization sequence slightly more intelligible.

Likewise, we don't need the GrimReaper anymore because init
will automatically take care of restarting the system when the
service manager dies.

Change-Id: I02c88d9392f7c8133d9cde9d0d978da89ed80452
2013-07-15 15:08:39 -07:00
Jeff Brown
9d3b1a424c Move input library code to frameworks/native.
No longer compile libandroidfw as a static library on the device
since it already exists as a shared library.  Keeping the static
library would force us to provide a static library version of
libinput for the device as well which doesn't make sense.

Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
2013-07-01 20:11:42 -07:00
Nick Kralevich
dbcf2d7482 PowerManagerService: Don't reboot directly.
Instead of calling the reboot system call ourselves, send
a message to init asking it to reboot the system. Init is in
a better position to make sure the system is cleanly shutdown.

Get rid of CAP_SYS_BOOT from system_server.

Bug: 8646621
Change-Id: I200722412844ad8d99e35a442021c6263c3ebc05
2013-05-08 13:42:10 -07:00
Romain Guy
3b748a44c6 Pack preloaded framework assets in a texture atlas
When the Android runtime starts, the system preloads a series of assets
in the Zygote process. These assets are shared across all processes.
Unfortunately, each one of these assets is later uploaded in its own
OpenGL texture, once per process. This wastes memory and generates
unnecessary OpenGL state changes.

This CL introduces an asset server that provides an atlas to all processes.

Note: bitmaps used by skia shaders are *not* sampled from the atlas.
It's an uncommon use case and would require extra texture transforms
in the GL shaders.

WHAT IS THE ASSETS ATLAS

The "assets atlas" is a single, shareable graphic buffer that contains
all the system's preloaded bitmap drawables (this includes 9-patches.)
The atlas is made of two distinct objects: the graphic buffer that
contains the actual pixels and the map which indicates where each
preloaded bitmap can be found in the atlas (essentially a pair of
x and y coordinates.)

HOW IS THE ASSETS ATLAS GENERATED

Because we need to support a wide variety of devices and because it
is easy to change the list of preloaded drawables, the atlas is
generated at runtime, during the startup phase of the system process.

There are several steps that lead to the atlas generation:

1. If the device is booting for the first time, or if the device was
updated, we need to find the best atlas configuration. To do so,
the atlas service tries a number of width, height and algorithm
variations that allows us to pack as many assets as possible while
using as little memory as possible. Once a best configuration is found,
it gets written to disk in /data/system/framework_atlas

2. Given a best configuration (algorithm variant, dimensions and
number of bitmaps that can be packed in the atlas), the atlas service
packs all the preloaded bitmaps into a single graphic buffer object.

3. The packing is done using Skia in a temporary native bitmap. The
Skia bitmap is then copied into the graphic buffer using OpenGL ES
to benefit from texture swizzling.

HOW PROCESSES USE THE ATLAS

Whenever a process' hardware renderer initializes its EGL context,
it queries the atlas service for the graphic buffer and the map.

It is important to remember that both the context and the map will
be valid for the lifetime of the hardware renderer (if the system
process goes down, all apps get killed as well.)

Every time the hardware renderer needs to render a bitmap, it first
checks whether the bitmap can be found in the assets atlas. When
the bitmap is part of the atlas, texture coordinates are remapped
appropriately before rendering.

Change-Id: I8eaecf53e7f6a33d90da3d0047c5ceec89ea3af0
2013-05-02 13:32:09 -07:00
Todd Poynor
b2bb9f6232 BatteryService: Fix compile warning
Add unhandled enum constant in switch.

Change-Id: I3c7635d9cf1fa1e57b139b9b66103bf660afe3a4
2013-04-22 18:16:17 -07:00
Todd Poynor
a6017bc4bf BatteryService: Fix detection of missing sysfs attributes
Recent conversion from char* to String8 broke these.

Change-Id: I4528c3e4b90614cddbc173ee996c7fc1febb2cf5
2013-04-22 18:16:16 -07:00
Jaikumar Ganesh
8ce470dd4b GPS Hardware geofencing.
Add support for doing geofencing in hardware.

Change-Id: I6d5015190e8d84e1f4beb1010ed977a71c1622d0
2013-04-10 15:25:07 -07:00
Ying Wang
d685894212 Add liblog
Bug: 8580410
Change-Id: I746aa8258866508c3a725d0773faf4518096548f
2013-04-09 21:54:12 -07:00
Mathias Agopian
b1d90c8f60 fix JNI use of incStrong/decStrong
Change-Id: Ia11b404dea483dc19bbc30f4d7bcff516655e180
2013-03-06 17:48:20 -08:00
Todd Poynor
afae9d248a Merge "BatteryService: Treat USB charging ports and charging accessories as AC" 2013-01-30 23:20:18 +00:00
Todd Poynor
b86d026a7f Merge "BatteryService: Allow power supplies to switch type between AC and USB" 2013-01-30 23:19:40 +00:00
Todd Poynor
78d8fe4bd6 BatteryService: Treat USB charging ports and charging accessories as AC
Change-Id: If98330b09a1fc44992bb96195804d434a4e20470
2013-01-30 14:24:12 -08:00
Todd Poynor
701bfb1034 BatteryService: Allow power supplies to switch type between AC and USB
Accomodate power_supply drivers that switch between MAINS and USB type
according to the current power source.  Re-read the type attribute when the
power supply is online.

Switch to String8 type for strings stored locally.

Change-Id: Iacce49bf3ad85f35a7295a54df43aff7f94f3100
2013-01-30 11:24:56 -08:00
Jeff Brown
864693461b Optimize Looper JNI code.
Use static native methods.

Release the native looper objects as soon as the Looper quits
instead of waiting until the GC finalizer to take care of it.

Change-Id: I02783e48782a8f972ec2138862f700ade33d8e78
2013-01-28 14:25:53 -08:00
Magnus Eriksson
160c1ca117 Fix logging typos in GpsLocationProvider
Change-Id: Ibf12947f3758defee990fbf685323334b8d1eeda
Signed-off-by: Magnus Eriksson <eriksson.mag@gmail.com>
2012-12-21 21:07:28 +01:00
Kenny Root
58ed5d748c am 768d9e1a: Merge "Correct executable bit for source files"
* commit '768d9e1a72ceee7d4a5f608776b87b62d6ce4a04':
  Correct executable bit for source files
2012-11-07 11:52:12 -08:00
Kenny Root
3a084af2e9 Correct executable bit for source files
Many media files and source code files were marked as executable in Git.
Remove those.

Also a shell script and python script were not marked as executable.

Change-Id: Ieb51bafb46c895a21d2e83696f5a901ba752b2c5
2012-11-07 10:27:31 -08:00
Jeff Brown
0a19d001c4 Fix a segfault when there is no power module.
This can happen in the emulator.

Bug: 7315152
Change-Id: I4a3f547127419fcd4dc4fc1c6f7ee869706cf12e
2012-10-09 14:47:05 -07:00
Jeff Brown
9e316a1a2a Blank or unblank all displays as need.
Ensures that both the internal display and HDMI are blanked
or unblanked in tandem.

Bug: 7309812
Change-Id: Ie8b96d393e8bb20d23c92f3320142d9f7cf42aff
2012-10-08 19:23:15 -07:00
Andy McFadden
94ffe8739e Merge "Pass display arg to blank/unblank" into jb-mr1-dev 2012-09-28 13:06:45 -07:00
Jeff Brown
bcc046af4e Bundle correlated switch changes atomically.
This is a prerequisite for headset jack detection on Manta.

Bug: 6548391
Change-Id: I549a194344511c0cee578b00f6a9ab5fdbdfb99c
2012-09-27 21:42:57 -07:00
Andy McFadden
1081eed9b7 Pass display arg to blank/unblank
blank() and unblank() now take a display argument.  For now,
just pass the default display in.

Bug: 7240511

Change-Id: I7747732471c9116cb6b3686bd95d5f32a63279a6
2012-09-27 16:03:01 -07:00
Jeff Brown
80cd819a04 Use more reasonable warning thresholds for power on/off.
To encourage vendors to make power on/off as efficient
and responsive as possible, we log some warnings whenever it
is too slow.  The previous thresholds were a little
unreasonable mainly because we wanted to understand
how long the process tends to take even when it's fast.

Raise the warning limit while still being aggressive about
timings.  Ideally we want the screen to turn on/off within
no more than a few frames.

Bug: 7167820
Change-Id: Id28dbf8c91cefa7ae7544b72887104af7aabccff
2012-09-25 16:59:58 -07:00
Jeff Brown
83d616a9c7 Make input system aware of multiple displays.
The input system needs to know about the window that has
focus, even if it is on a secondary display.  So now we
send it the list of all windows and indicate which display
they are on.  We filter the list of windows as necessary
when delivering touch events.

To keep things simple, monitor input channels and input
filters are not supported except on the main display.
We also do not pass the display id to applications; it is
only used inside the input system for now.

Properly scale touch coordinates based on the viewport.
This will be needed to ensure that touch works on external
display as well as when the internal display is being used
to simulate a different resolution.

Change-Id: I1815579a52fcc852c519b5391fc7ab8767c2dc59
2012-09-10 15:48:47 -07:00
Jeff Brown
d728bf514f Make display manager tell input system about viewports.
The window manager is no longer responsible for telling the
input system about the display viewport.

Change-Id: I932882bae55decef55f25093bb2a7ebac1620bb1
2012-09-08 18:12:57 -07:00
Jeff Brown
64a55af0ac Add plumbing for new surface flinger display API.
Cleaned up the implementation of Surface and SurfaceSession
to use more consistent naming and structure.

Added JNI for all of the new surface flinger display API calls.

Enforced the requirement that all Surfaces created by
the window manager be named.

Updated the display manager service to use the new methods.

Change-Id: I2a658f1bfd0437e1c6f9d22df8d4ffcce7284ca2
2012-08-27 14:34:54 -07:00
Jeff Brown
0b722fe9ce Use new surface flinger API.
Change-Id: Ic888577408a59a36481a48010e19c5e77c24e211
2012-08-27 14:34:53 -07:00
Scott Anderson
5ad9fc2182 BatteryService: Fix comment to match code
Change-Id: Ib4e30e7808ff3a2a8a49c000eac719a3a4273fdd
Signed-off-by: Scott Anderson <saa@android.com>
2012-08-21 13:11:26 -07:00
Jeff Brown
256237c99f Merge "Plumb the switch code into Dalvik." into jb-mr1-dev 2012-08-20 20:26:11 -07:00
Jeff Brown
5338428ddb Plumb the switch code into Dalvik.
Bug: 6548391
Change-Id: If0e918669ba27ca0e6561930d4abc427c34de42d
2012-08-20 20:16:01 -07:00
Brian Muramatsu
37a37f445c add wireless charger support
bug: 6879638

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

Change-Id: I22dc3c40f50573c98643e7b5cbcb237d0216530d
2012-08-20 10:04:12 -07:00
Jeff Brown
9630704ed3 Power manager rewrite.
The major goal of this rewrite is to make it easier to implement
power management policies correctly.  According, the new
implementation primarily uses state-based rather than event-based
triggers for applying changes to the current power state.

For example, when an application requests that the proximity
sensor be used to manage the screen state (by way of a wake lock),
the power manager makes note of the fact that the set of
wake locks changed.  Then it executes a common update function
that recalculates the entire state, first looking at wake locks,
then considering user activity, and eventually determining whether
the screen should be turned on or off.  At this point it may
make a request to a component called the DisplayPowerController
to asynchronously update the display's powe state.  Likewise,
DisplayPowerController makes note of the updated power request
and schedules its own update function to figure out what needs
to be changed.

The big benefit of this approach is that it's easy to mutate
multiple properties of the power state simultaneously then
apply their joint effects together all at once.  Transitions
between states are detected and resolved by the update in
a consistent manner.

The new power manager service has is implemented as a set of
loosely coupled components.  For the most part, information
only flows one way through these components (by issuing a
request to that component) although some components support
sending a message back to indicate when the work has been
completed.  For example, the DisplayPowerController posts
a callback runnable asynchronously to tell the PowerManagerService
when the display is ready.  An important feature of this
approach is that each component neatly encapsulates its
state and maintains its own invariants.  Moreover, we do
not need to worry about deadlocks or awkward mutual exclusion
semantics because most of the requests are asynchronous.

The benefits of this design are especially apparent in
the implementation of the screen on / off and brightness
control animations which are able to take advantage of
framework features like properties, ObjectAnimator
and Choreographer.

The screen on / off animation is now the responsibility
of the power manager (instead of surface flinger).  This change
makes it much easier to ensure that the animation is properly
coordinated with other power state changes and eliminates
the cause of race conditions in the older implementation.

The because of the userActivity() function has been changed
so that it never wakes the device from sleep.  This change
removes ambiguity around forcing or disabling user activity
for various purposes.  To wake the device, use wakeUp().
To put it to sleep, use goToSleep().  Simple.

The power manager service interface and API has been significantly
simplified and consolidated.  Also fixed some inconsistencies
related to how the minimum and maximum screen brightness setting
was presented in brightness control widgets and enforced behind
the scenes.

At present the following features are implemented:

- Wake locks.
- User activity.
- Wake up / go to sleep.
- Power state broadcasts.
- Battery stats and event log notifications.
- Dreams.
- Proximity screen off.
- Animated screen on / off transitions.
- Auto-dimming.
- Auto-brightness control for the screen backlight with
  different timeouts for ramping up versus ramping down.
- Auto-on when plugged or unplugged.
- Stay on when plugged.
- Device administration maximum user activity timeout.
- Application controlled brightness via window manager.

The following features are not yet implemented:

- Reduced user activity timeout for the key guard.
- Reduced user activity timeout for the phone application.
- Coordinating screen on barriers with the window manager.
- Preventing auto-rotation during power state changes.
- Auto-brightness adjustment setting (feature was disabled
  in previous version of the power manager service pending
  an improved UI design so leaving it out for now).
- Interpolated brightness control (a proposed new scheme
  for more compactly specifying auto-brightness levels
  in config.xml).
- Button / keyboard backlight control.
- Change window manager to associated WorkSource with
  KEEP_SCREEN_ON_FLAG wake lock instead of talking
  directly to the battery stats service.
- Optionally support animating screen brightness when
  turning on/off instead of playing electron beam animation
  (config_animateScreenLights).

Change-Id: I1d7a52e98f0449f76d70bf421f6a7f245957d1d7
2012-08-15 03:06:24 -07:00
Mathias Agopian
187019c51f Merge "screen-off animation won't be handled by SF anymore" into jb-mr1-dev 2012-08-02 21:49:25 -07:00
Mathias Agopian
893a0e71a7 screen-off animation won't be handled by SF anymore
Change-Id: I66ad02b07b1148c1610e9c29ba80450d49c22806
2012-08-02 21:29:54 -07:00
Dianne Hackborn
908aecc3a6 Start moving away from DisplayMetrics.DENSITY_DEVICE.
This puts in most of the infrastructure needed to allow us to
switch between different densities at run time.  The main remaining
uses of the global are to initialize the Bitmap object (not sure
what to do about that since it doesn't have anything passed in
the constructor to get this information from), and being able to
load drawables if we need a different density than what was preloaded
by zygote.

Change-Id: Ifdbfd6b7a5c59e6aa22e63b95b78d96af3d96848
2012-08-01 10:54:39 -07:00