Commit Graph

131 Commits

Author SHA1 Message Date
Mathias Agopian
8c3c51bb33 Fix a bug in sp<> and wp<> which could cause memory corruptions
when assigning a smart pointer to another one, we need to make
sure to read all the data we need from the right-hand-side
reference (the assignee) before we decRef the assigned.

This bug would cause linked-list of smart-pointers to fail
miserably.

Change-Id: Ibb554c15fddf909f7737c632b7c80322e80ea93f
2010-06-24 21:49:02 -07:00
Jeff Brown
f4a4ec2063 Even more native input dispatch work in progress.
Added more tests.
Fixed a regression in Vector.
Fixed bugs in pointer tracking.
Fixed a starvation issue in PollLoop when setting or removing callbacks.
Fixed a couple of policy nits.

Modified the internal representation of MotionEvent to be more
efficient and more consistent.

Added code to skip/cancel virtual key processing when there are multiple
pointers down.  This helps to better disambiguate virtual key presses
from stray touches (such as cheek presses).

Change-Id: I2a7d2cce0195afb9125b23378baa94fd2fc6671c
2010-06-17 13:27:16 -07:00
Jeff Brown
66d9df50da Fix include paths.
Change-Id: Ifda45688f9f02710a74d5d7a7d902bacf1441e2e
2010-06-13 19:35:19 -07:00
Jeff Brown
e839a589bf Native input dispatch rewrite work in progress.
The old dispatch mechanism has been left in place and continues to
be used by default for now.  To enable native input dispatch,
edit the ENABLE_NATIVE_DISPATCH constant in WindowManagerPolicy.

Includes part of the new input event NDK API.  Some details TBD.

To wire up input dispatch, as the ViewRoot adds a window to the
window session it receives an InputChannel object as an output
argument.  The InputChannel encapsulates the file descriptors for a
shared memory region and two pipe end-points.  The ViewRoot then
provides the InputChannel to the InputQueue.  Behind the
scenes, InputQueue simply attaches handlers to the native PollLoop object
that underlies the MessageQueue.  This way MessageQueue doesn't need
to know anything about input dispatch per-se, it just exposes (in native
code) a PollLoop that other components can use to monitor file descriptor
state changes.

There can be zero or more targets for any given input event.  Each
input target is specified by its input channel and some parameters
including flags, an X/Y coordinate offset, and the dispatch timeout.
An input target can request either synchronous dispatch (for foreground apps)
or asynchronous dispatch (fire-and-forget for wallpapers and "outside"
targets).  Currently, finding the appropriate input targets for an event
requires a call back into the WindowManagerServer from native code.
In the future this will be refactored to avoid most of these callbacks
except as required to handle pending focus transitions.

End-to-end event dispatch mostly works!

To do: event injection, rate limiting, ANRs, testing, optimization, etc.

Change-Id: I8c36b2b9e0a2d27392040ecda0f51b636456de25
2010-06-13 17:42:16 -07:00
Mathias Agopian
b8510b98b5 Fix a typo in Singleton<>
it could cause the sLock field to be emitted several times
in different compilation unit. it also prevented to
have 2 Singleton<> in the same file.
2010-05-28 15:13:30 -07:00
Mathias Agopian
dcf01e6644 added RWLock C++ wrapper
Change-Id: Ia736bf7f6e2c49915a9ab5669551cf89dafa7961
2010-05-19 15:12:59 -07:00
Kenny Root
d4066a4ac5 ZipUtilsRO rewrite based on Dalvik Zip rewrite
Change the way zip archives are handled.  This is necessary to deal with
very large (~1GB) APK files, for which our current approach of mapping
the entire file falls over.

We now do the classic scavenger hunt for the End Of Central Directory
magic on a buffer of data read from the file, instead of a memory-mapped
section.  We use what we find to create a map that covers the Central
Directory only.

If the caller is interested in unpacking the file contents, we have to
do an additional file read to discover the size of the Local File Header
section so we can skip past it.

This is based on Change I745fb15abb in the dalvik tree. Both
implementations share a common ancestry, but the cost of unifying them
outweighs the benefits of wrapping C calls.

Change-Id: Iddacb50fe913917c2845708a530872d65fdbe620
2010-05-12 05:07:48 -07:00
Dianne Hackborn
c93a781c24 New xlarge screen size.
Not complete, only for experimentation at this point.

This includes a reworking of how screen size configurations are matched,
so that if you are on a larger screen we can select configurations for
smaller screens if there aren't any exactly matching the current screen.

The screen size at which we switch to xlarge has been arbitrarily
chosen; the compatibility behavior has not yet been defined.

Change-Id: I1a33b3818eeb51a68fb72397568c39ab040a07f5
2010-04-28 16:51:52 -07:00
Mathias Agopian
26d244281a libutils Condition are now PRIVATE by default
Condition must be initialized with SHARED for the old behavior, where
they can be used accross processes.

Updated the two places android that require SHARED conditions.

PRIVATE conditions (and mutexes) use more efficient syscalls.

Change-Id: I9a281a4b88206e92ac559c66554e886b9c62db3a
2010-03-19 16:16:43 -07:00
Dianne Hackborn
82fecb01df Add ability for some manifest attributes to reference resources.
This loosens our restriction on many manifest attributes requiring
literal string values, to allow various ones to use values from
resources.  This is only allowed if the resource value does not change
from configuration changes, and the restriction is still in place
for attributes that are core to security (requesting permissions) or
market operation (used libraries and features etc).

Change-Id: I4da02f6a5196cb6a7dbcff9ac25403904c42c2c8
2010-03-09 17:18:05 -08:00
Dianne Hackborn
2856c5b19a Refactor car mode.
Extract all UI behavior from dock observer and ACTION_DOCK_EVENT.

Also introduce a desk type to go along with the car type all through
the resource system, since we now need to have corresponding high-level
broadcasts for desk dock mode.  As part of that I also reworked some
of the logic for switching modes to all funnel through a single
update() call that looks all of the current state to decide what to
do next, and fixed various locking issues.

In addition I found there were bugs in the configuration change
handling causing us to only switch into the car mode config and
then never get out of it.  Unfortunately now that we are actually
changing the configuration for each mode change, the transitions
between them are really crummy as we restart all kinds of
activities. :(
2010-03-05 10:57:47 -08:00
Dianne Hackborn
8eca036d24 Fix issue #2448075: aapt doesn't fix up activity-alias android:targetActivity links
And related:

- The aapt tool now sets a resource configurations sdk level to match any configs
  that have been set (for example if you specify density your sdk level will be
  at least 4).
- New option to modify the targetPackage attribute of instrumentation.
- Clean up of aapt options help.
- Fix of UI type values to leave 0 for "unspecified".
- Make the UI mode config APIs public.
2010-03-01 20:42:14 -08:00
Kenny Root
9e333ab42c Use UTF-8 strings to avoid duplicate caching, part 1
StringBlock instances containing UTF-8 strings use a cache to convert
into UTF-16, but using that cache and then using a JNI call to NewString
causes the UTF-8 string as well as two copies of the UTF-16 string to
be held in memory. Getting the UTF-8 string directly from the StringPool
eliminates one copy of the UTF-16 string being held in memory.

This is part 1. Part 2 will include ResXMLParser optimizations.

Change-Id: Ibd4509a485db746d59cd4b9501f544877139276c
2010-02-23 10:02:20 -08:00
Mathias Agopian
98e71ddaed remove a dependency of GraphicBuffer (libui) on Parcel (libbinder).
Add a Flattenable interface to libutils which can be used to flatten
an object into bytestream + filedescriptor stream.
Parcel is modified to handle Flattenable. And GraphicBuffer implements
Flattenable.

Except for the overlay classes libui is now independent of libbinder.
2010-02-21 23:27:25 -08:00
Kenny Root
0d88e7a8d7 Totally remove Unicode.cpp and rely on ICU
Unicode.cpp used a packed data table for character data that essentially
duplicated ICU's functionality.

Change-Id: Ia68fe4ac94e89dc68d9a3f45f33f6e648a5500b7
2010-02-12 14:37:42 -08:00
Kenny Root
196e320734 Excise code from Unicode.cpp that was dead
Remove some utility functions for discovering character data
that ICU probably took over a while ago.

Change-Id: I97abe4de2f51eb2bf48679941258bc501184c3dc
2010-02-12 13:01:16 -08:00
Tobias Haamel
70fa84f6ab Introduce special UI modes for night and car usage.
The device mode is now called ui mode. Furthermore is the order of
precedence for the resources now in such a way that the ui mode needs
to be specified after the orientation and before the density.

The ui mode can be set, like it is done for the locale, as follows:

IActivityManager am = ActivityManagerNative.getDefault();
Configuration config = am.getConfiguration();
config.uiMode = Configuration.UI_MODE_TYPE_CAR | Configuration.UI_MODE_NIGHT_ANY;
am.updateConfiguration(config);

To allow users to disable the car mode and set the night mode the IUiModeManager
interface is used.

The automatic night mode switching will be added in a separate change.
2010-02-11 21:25:58 +01:00
Kenny Root
ccb5b89029 Add string resource type inspection
Allows "aapt dump --values resource" to print out whether a string in a
ResStringPool is in UTF-8 or UTF-16 encoding.

Change-Id: I6478884a70a3b46fee862dece6cb33454fc34843
2009-12-10 14:22:08 -08:00
Android (Google) Code Review
eb318fd88d Merge change I129483f8 into eclair-mr2
* changes:
  Optional use of UTF-8 strings in resource bundles
2009-12-08 13:41:38 -08:00
Dianne Hackborn
8c6cedc9bc Propagate background scheduling class across processes.
This is a very simply implementation: upon receiving an IPC, if the handling
thread is at a background priority (the driver will have taken care of
propagating this from the calling thread), then stick it in to the background
scheduling group.  Plus an API to turn this off for the process, which is
used by the system process.

This also pulls some of the code for managing scheduling classes out of
the Process JNI wrappers and in to some convenience methods in thread.h.
2009-12-07 19:11:14 -08:00
Kenny Root
92f5984d2c Optional use of UTF-8 strings in resource bundles
Allows the use of UTF-8 for packing resources instead of the
default of UTF-16 for Java. When strings are extracted from the
ResStringPool, they are converted to UTF-16 and the result is
cached for subsequent calls.

When using aapt to package, add in the "-8" switch to pack the
resources using UTF-8. This will result in the value, key, and
type strings as well as the compiled XML string values taking
significantly less space in the final application package in
most scenarios.

Change-Id: I129483f8b3d3b1c5869dced05cb525e494a6c83a
2009-12-07 15:14:15 -08:00
Dianne Hackborn
c2a04c3f2d Fix issue #2226370: Resource versions match with equality
Also fixed turned-around increment of version number for resources. :(

Change-Id: I604137272da984bcd69cee4f174e6b7f2c786e46
2009-11-01 21:16:59 -08:00
Dianne Hackborn
b5df6d801c Implement issue #1780928: Need support hiding nav keys.
This implements support for devices whose hardware can hide
their navigation keys.  It works much like the existing keyboardHidden
configuration, and for compatibility uses the same configuration
change bit.

Also add FLAG_TURN_ON_SCREEN for windows, which has the system
cause the screen to be turned on when the window is displayed.
Great fun when used with FLAG_SHOW_WHEN_LOCKED!

Change-Id: I0b867f19af85cfd8786a14cea194b34f7bdd9b7a
2009-09-15 22:50:40 -07:00
San Mehat
c101e04abb process: Switch to common cutils sched_policy api
Signed-off-by: San Mehat <san@google.com>
2009-09-12 10:48:03 -07:00
San Mehat
9410f98e78 Process: Add support for using scheduler policies instead of cgroups.
Preference is given to cgroups if available.

Signed-off-by: San Mehat <san@google.com>
2009-09-10 15:09:38 -07:00
Mathias Agopian
4de4ebf6a2 use broadcast() instead of signal() when signaling the condition-variable Thread::RequestExitAndWait() is waiting for
we could have several thread waiting on the condition and they all need to wake-up.
also added a debug "mTid" field in the class, which contains the tid of the thread (as opposed to pthread_t), this
is useful when debugging under gdb for instance.
2009-09-09 02:45:26 -07:00
Mathias Agopian
cbb288bfe8 fix [2068105] implement queueBuffer/lockBuffer/dequeueBuffer properly
Rewrote SurfaceFlinger's buffer management from the ground-up.
The design now support an arbitrary number of buffers per surface, however the current implementation is limited to four. Currently only 2 buffers are used in practice.

The main new feature is to be able to dequeue all buffers at once (very important when there are only two). 

A client can dequeue all buffers until there are none available, it can lock all buffers except the last one that is used for composition. The client will block then, until a new buffer is enqueued.

The current implementation requires that buffers are locked in the same order they are dequeued and enqueued in the same order they are locked. Only one buffer can be locked at a time.

eg. Allowed sequence:   DQ, DQ, LOCK, Q, LOCK, Q
eg. Forbidden sequence: DQ, DQ, LOCK, LOCK, Q, Q
2009-09-07 16:32:45 -07:00
Andreas Huber
84a6d041e2 Support for marshalling pointers / intptr_t in Parcel.
Some refactoring to eliminate code duplication in Parcel implementation.
2009-08-17 15:31:25 -07:00
Dianne Hackborn
878d647b5b am b8546001: Merge change 20878 into donut
Merge commit 'b8546001701405a76dad7e6235046e592296fac2'

* commit 'b8546001701405a76dad7e6235046e592296fac2':
  Fix issue #2048263: More debugging information
2009-08-12 12:36:12 -07:00
Dianne Hackborn
e868513287 Fix issue #2048263: More debugging information
We now hopefully do better about generating the anr reports, and include
information about the malloc loaded assets in meminfo.
2009-08-11 18:56:41 -07:00
Android (Google) Code Review
ff1dcc2cf9 am 25dff70f: Merge change 9039 into donut
Merge commit '25dff70f153529b87f5ad4a92f4de21e8950b1de'

* commit '25dff70f153529b87f5ad4a92f4de21e8950b1de':
  Fix #2018814: System cannot correctly render assets with "wrap_content" attribute in QVGA
2009-07-30 16:05:27 -07:00
Dianne Hackborn
3945ae5065 Fix #2018814: System cannot correctly render assets with "wrap_content" attribute in QVGA
It turns out we were not returning the density for anything retrieved from a
TypedArray...  which basically means any bitmap references from a layout or style...!!!

This is now fixed.

Also fiddle with the density compatibility mode to turn on smoothing in certain situations,
helping the look of things when they need to scale and we couldn't do the scaling at
load time.
2009-07-29 19:44:01 -07:00
Android (Google) Code Review
351b6f926e am 9fc20b0e: Merge change 8126 into donut
Merge commit '9fc20b0e381b5fe00b7049ef357c839cd05a33bf'

* commit '9fc20b0e381b5fe00b7049ef357c839cd05a33bf':
  First pass at reworking screen density/size APIs.
2009-07-21 19:03:53 -07:00
Dianne Hackborn
60cde60e89 First pass at reworking screen density/size APIs.
This changes the names of the directories in aapt, to what you see
in the list of DpiTest resources.  Also adds a new "long" configuration
for wide screens, which the platform sets appropriate, and introduces
a new kind of resizeability for not large but significantly larger
than normal screens which may have compatibility issues.
2009-07-21 18:28:42 -07:00
Android (Google) Code Review
89fbf84539 am aad0fcc9: Merge change 7783 into donut
Merge commit 'aad0fcc9619eb72c18a6afff48ebc9d4011f0f54'

* commit 'aad0fcc9619eb72c18a6afff48ebc9d4011f0f54':
  Add "nodpi" density, and expose a bunch of density-related APIs.
2009-07-19 20:28:49 -07:00
Dianne Hackborn
b3e8103538 Add "nodpi" density, and expose a bunch of density-related APIs.
Also update the DpiTest app to use nodpi images, and try to have a mode
where it turns off compatibility though it's not quite working.
2009-07-17 16:59:08 -07:00
Mathias Agopian
eb9fd685f8 add a ctor to Mutex to specify the type, which can be shared. This is used by sf and af an soon will allow some optimization in the kernel for non shared mutexes 2009-07-13 22:06:36 -07:00
Mathias Agopian
ec0f1f6720 implement Mutex and Condition with pthread instead of calling futex directly.
internally pthread uses futex. the implementation consists of simple inlines
there are no implementation files anymore.
2009-07-13 15:14:23 -07:00
Android (Google) Code Review
1b85080b2a am 8a715b4b: Merge change 5510 into donut
Merge commit '8a715b4b791db4390d12e0ded02280592634a424'

* commit '8a715b4b791db4390d12e0ded02280592634a424':
  Add useful functions to String8, which enables users to convert between UTF-8 and UTF-32
2009-07-09 12:48:56 -07:00
Daisuke Miyakawa
9f220247f6 Add useful functions to String8, which enables users to convert between UTF-8 and UTF-32
It will be used in SQL functions in external/sqlite/android.
See https://android-git.corp.google.com/g/Gerrit#change,5511 for example.

Related internal bug id: 1707173
2009-07-09 09:06:13 +09:00
Andy McFadden
f460f19510 Fix sim build.
Looks like older gcc (4.1.x) doesn't properly handle templated
fanciness.  Apparently that's what we have on the build server.
2009-07-07 10:01:12 -07:00
Mathias Agopian
0f7f88db27 Merge commit 'goog/master' into merge_master 2009-07-06 14:16:55 -07:00
Android (Google) Code Review
1a16ea88ed am 991eec03: Merge change 6252 into donut
Merge commit '991eec03a73f8803d0f8c80b418480ea25293cfb'

* commit '991eec03a73f8803d0f8c80b418480ea25293cfb':
  Don't re-parse the framework resources all the time.
2009-07-06 14:10:36 -07:00
Dianne Hackborn
0f253efba5 Don't re-parse the framework resources all the time.
A small optimization to the resource code, to not re-parse the framework
resources every time we build a new AssetManager.  Instead, you can now
construct a ResTable from a previously created one...  of course, like the
existing code for using the data in-place, you can't delete the original
ResTable until you have deleted the one that has been constructed from it.
2009-07-06 11:12:37 -07:00
Android (Google) Code Review
47a1a39ce9 am 6e1647a2: Merge change 5829 into donut
Merge commit '6e1647a212317f4ee8bcc23948b6621a59172954'

* commit '6e1647a212317f4ee8bcc23948b6621a59172954':
  Fix issue #1673793: Theme styles don't apply.
2009-07-01 22:43:58 -07:00
Mathias Agopian
84d1f7a098 Merge commit 'goog/master' into merge_master 2009-07-01 18:33:18 -07:00
Dianne Hackborn
e356292467 Fix issue #1673793: Theme styles don't apply.
It turns out this was not a problem in the resource code at all.  Rather,
the system process has a cache of pre-loaded attributes it uses to avoid
continually reloading things as it needs them.  Well it turns out this
cache wasn't flushed after a package was uninstalled or a configuration
changed, so you could re-install an app where you change its style resources
so its theme now points to one that is inconsistent in the cache.

This is mostly a problem for developers, where they continually install
new versions of an app where resources have changed.  This could possibly
show up when updating an app on a normal phone, although the problem would
eventually correct itself since this cache uses weak references.

Anyway, the cache is now reworked to be flushed appropriately.

This change also includes an update to aapt to be able to dump the
contents of bags in resources.
2009-06-30 13:27:30 -07:00
Android (Google) Code Review
b9c8a73496 am 72eb0aca: Merge change 5483 into donut
Merge commit '72eb0acad5cffc57ce5006f6deab29ee259e461e'

* commit '72eb0acad5cffc57ce5006f6deab29ee259e461e':
  Expand support for different screen sizes.
2009-06-29 16:37:17 -07:00
Dianne Hackborn
21342c5c19 Expand support for different screen sizes.
Applications can now declare that they support small, normal, or
large screens.  Resource selection can also be done based on these
sizes.  By default, pre-Donut apps are false for small and large,
and Donut or later apps are assumed to support all sizes.  In either
case they can use <supports-screens> in their manifest to declare
what they actually support.
2009-06-26 13:37:05 -07:00
Android (Google) Code Review
694fcc5d1d am c44989d6: Merge change 5350 into donut
Merge commit 'c44989d6c7bcc761fb37f54fd37aac2070ba8e5e'

* commit 'c44989d6c7bcc761fb37f54fd37aac2070ba8e5e':
  move ui/Time.cpp to core/jni, since this is the only place it is used
2009-06-25 15:11:09 -07:00