Commit Graph

49409 Commits

Author SHA1 Message Date
Arve Hjønnevåg
07fd0f195d Binder: Fix some valgrind errors.
When using 64 bit binder pointers, only initializing the 32 bit
handle, in a stack allocated struct, will pass uninitialized stack
data to the kernel and other processes.

Change-Id: I3432d9d36bb251d8ddb0a863661aeb80aabb3d92
2014-02-18 21:14:41 -08:00
Arve Hjønnevåg
87b30d0447 Binder: Don't cast directly from a pointer to binder_uintptr_t
When using the 64 bit binder interface from a 32 bit process the
pointer may get sign extended and cause the kernel to fail to read
from it.

Change-Id: I90fcf53880e2aa92e230a9723f9b3f7696170e32
2014-02-18 21:14:39 -08:00
Arve Hjønnevåg
11cfdccfd3 Binder: Disable attemptIncStrongHandle
The driver does not support BC_ATTEMPT_ACQUIRE and will return an error.
IPCThreadState does not handle driver errors, and will resend the failed
command blocking all other commands.

Change-Id: I643986037341821b27b62dc82df933844f4842b8
2014-02-14 20:18:13 -08:00
Dianne Hackborn
7d86b45472 Merge "frameworks/native: move idmap to frameworks/base" 2014-02-14 01:45:28 +00:00
Nick Kralevich
2044ac43e5 Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API." 2014-02-12 23:09:45 +00:00
Colin Cross
07a4728150 frameworks/native: move idmap to frameworks/base
idmap depends on libandroidfw, so it should go in frameworks/base.

Change-Id: Ieee30ba9d8170d3118acc89f0617981228a6974b
2014-02-11 18:04:03 -08:00
Dianne Hackborn
6c14f0ad82 Merge "Runtime resource overlay, iteration 2" 2014-02-11 21:27:36 +00:00
Dianne Hackborn
340aa8cbd4 Merge "New command line tool 'idmap'" 2014-02-11 20:29:56 +00:00
Stephen Smalley
26288202e7 Convert all selinux_android_restorecon and _setfilecon calls to new API.
libselinux selinux_android_restorecon API is changing to the more
general interface with flags and dropping the older variants.

Also get rid of the old, no longer used selinux_android_setfilecon API
and rename selinux_android_setfilecon2 to it as it is the only API in use.

Change-Id: I1e71ec398ccdc24cac4ec76f1b858d0f680f4925
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-02-07 09:36:11 -05:00
Colin Cross
74be0f7be3 Merge "binder: fix all warnings" 2014-02-06 02:06:42 +00:00
Colin Cross
6f4f3ab36c binder: fix all warnings
Fix warnings related to casting pointers to ints, using %d or %ld to
print size_t/ssize_t, and unused parameters.

Change-Id: I7a13ba83d402952989c1f795cd9e880a95b98d9e
2014-02-05 17:51:10 -08:00
Andrew Hsieh
055dac1b54 Merge "Fixed apparent copy/paste mistake Bug: 11634373" 2014-02-05 07:16:31 +00:00
David Friedman
8769436bba Fixed apparent copy/paste mistake
Bug: 11634373

Change-Id: I9b0ac4d3b4a9a2999b2013abd39465a062ec51ea
2014-02-05 11:19:04 +08:00
Siva Velusamy
fd6a3ff4b4 Merge "GLES_trace: fix compile errors on 64 bit architectures" 2014-02-04 19:14:07 +00:00
Arve Hjønnevåg
4e7fd95061 Merge "Use 64 bit binder interface if TARGET_USES_64_BIT_BINDER _or_ TARGET_IS_64_BIT is set." 2014-02-04 00:48:12 +00:00
Arve Hjønnevåg
f3ad11cf3c Use 64 bit binder interface if TARGET_USES_64_BIT_BINDER _or_ TARGET_IS_64_BIT is set.
Change-Id: I46a29939fa29ec9421ab6dff3285502f69a31745
2014-02-03 14:48:36 -08:00
Arve Hjønnevåg
58242fc298 Merge changes Ib0e5a037,I1bd7c38e,Icfc67c2a,I96c64312,I59528054, ...
* changes:
  ServiceManager: Implement PING_TRANSACTION
  ServiceManager: Use 32/64 bit types from new binder header
  Binder: Use 64 bit pointers in 32 processes if selected by the target
  Add BINDER_IPC_32BIT to CFLAGS unless TARGET_USES_64_BIT_BINDER is true
  Binder: Make binder portable
  ServiceManager: Fix the binder interface
  ServiceManager: Store handles in uint32_t instead of void *
  ServiceManager: Generic Fixes
  ServiceManager: Add extra error handling
  ServiceManager: Fix Android.mk
  ServiceManager: Make use of kernel exported structures
2014-02-03 21:12:57 +00:00
Mårten Kongstad
63568b1430 Runtime resource overlay, iteration 2
Support any number of overlay packages. Support any target package.

UPDATED PACKAGE MATCHING
------------------------
In Runtime resource overlay, iteration 1, only a single overlay package
was considered. Package matching was based on file paths:
/vendor/overlay/system/framework-res.apk corresponded to
/system/framework-res.apk. Introduce a more flexible matching scheme
where any package is an overlay package if its manifest includes

    <overlay targetPackage="com.target.package"/>

For security reasons, an overlay package must fulfill certain criteria
to take effect: see below.

THE IDMAP TOOL AND IDMAP FILES
------------------------------
Idmap files are created by the 'idmap' binary; idmap files must be
present when loading packages. For the Android system, Zygote calls
'idmap' as part of the resource pre-loading. For application packages,
'idmap' is invoked via 'installd' during package installation (similar
to 'dexopt').

UPDATED FLOW
------------
The following is an outline of the start-up sequences for the Android
system and Android apps. Steps marked with '+' are introduced by this
commit.

Zygote initialization
   Initial AssetManager object created
+    idmap --scan creates idmaps for overlays targeting 'android', \
           stores list of overlays in /data/resource-cache/overlays.list
   AssetManager caches framework-res.apk
+  AssetManager caches overlay packages listed in overlays.list

Android boot
   New AssetManager's ResTable acquired
     AssetManager re-uses cached framework-res.apk
+    AssetManager re-uses cached 'android' overlays (if any)

App boot
   ActivityThread prepares AssetManager to load app.apk
+  ActivityThread prepares AssetManager to load app overlays (if any)
   New AssetManager's ResTable acquired as per Android boot

SECURITY
--------
Overlay packages are required to be pre-loaded (in /vendor/overlay).
These packages are trusted by definition. A future iteration of runtime
resource overlay may add support for downloaded overlays, which would
likely require target and overlay signatures match for the overlay to
be trusted.

LOOKUP PRIORITY
---------------
During resource lookup, packages are sequentially queried to provide a
best match, given the constraints of the current configuration. If any
package provide a better match than what has been found so far, it
replaces the previous match. The target package is always queried last.

When loading a package with more than one overlay, the order in which
the overlays are added become significant if several packages overlay
the same resource.

Had downloaded overlays been supported, the install time could have been
used to determine the load order. Regardless, for pre-installed
overlays, the install time is randomly determined by the order in which
the Package Manager locates the packages during initial boot. To support
a well-defined order, pre-installed overlay packages are expected to
define an additional 'priority' attribute in their <overlay> tags:

    <overlay targetPackage="com.target.package" priority="1234"/>

Pre-installed overlays are loaded in order of their priority attributes,
sorted in ascending order.

Assigning the same priority to several overlays targeting the same base
package leads to undefined behaviour. It is the responsibility of the
vendor to avoid this.

The following example shows the ResTable and PackageGroups after loading
an application and two overlays. The resource lookup framework will
query the packages in the order C, B, A.

        +------+------+-     -+------+------+
        | 0x01 |      |  ...  |      | 0x7f |
        +------+------+-     -+------+------+
            |                           |
        "android"                Target package A
                                        |
                       Pre-installed overlay B (priority 1)
                                        |
                       Pre-installed overlay C (priority 2)

Change-Id: If49c963149369b1957f7d2303b3dd27f669ed24e
2014-02-03 16:16:40 +01:00
Mårten Kongstad
5ee3dafa98 New command line tool 'idmap'
Introduce a new tool 'idmap' to handle generation and verification of
idmap files. The tool is modelled on 'dexopt', and is intended to be
used similarly, notably by 'installd'.
See cmds/idmap/idmap.cpp for further documentation on 'idmap'.

Note: this commit is interdependent on a commit in project build/ to add
'idmap' to PRODUCT_PACKAGES.

Note: the changes to androidfw are only stubs. The actual implementation
will be provided in Runtime resource overlay, iteration 2.

Change-Id: I7131b74ece1e46c8a9c0a31d103e686aa07da2bb
2014-02-03 16:16:39 +01:00
Arve Hjønnevåg
e5245cbf5d ServiceManager: Implement PING_TRANSACTION
Stop printing "invalid id " to stderr every time a process tries to
connect to the servicemanager.

Change-Id: Ib0e5a0375bfa2dec2c2f9cd668bd5dda46ed6588
2014-01-31 17:22:30 -08:00
Arve Hjønnevåg
399b6c3bbc ServiceManager: Use 32/64 bit types from new binder header
Change-Id: I1bd7c38ed9f43125cf9c63aa533434ee7ca06f80
2014-01-31 17:22:30 -08:00
Arve Hjønnevåg
84e625ac1e Binder: Use 64 bit pointers in 32 processes if selected by the target
Uses new kernel header where void * has been replaced by binder_uintptr_t

Change-Id: Icfc67c2a279269f700343bd9246fd7cb94efe2c1
2014-01-31 15:51:06 -08:00
Arve Hjønnevåg
e91fff0a2d Add BINDER_IPC_32BIT to CFLAGS unless TARGET_USES_64_BIT_BINDER is true
Change-Id: I96c643123b0314c361b7f48a18d5c22c660d4ff5
2014-01-31 15:50:59 -08:00
Serban Constantinescu
f683e0163a Binder: Make binder portable
Changes include
- Binder attempts to cast pointers to a int datatype
  which is not sufficient on a 64-bit platform.

- This patch introduces new read/write functions into
  Parcel that allow pointers to be written using the
  uintptr_t datatype for compile-time data type size
  selection.

-  Change access specifier for the methods above.

-  Binder uses the 64bit android_atomic_release_cas64
   (aka cmpxchg)

Change-Id: I595280541e0ba1d19c94b2ca2127bf9d96efabf1
Signed-off-by: Matthew Leach <matthew.leach@arm.com>
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:40 +00:00
Serban Constantinescu
3a345f0df5 ServiceManager: Fix the binder interface
This patch adds support for binder transactions on 64bit systems
without breaking the existing 32bit ABI. It has been tested on
the Android emulator and ARMv8 Model.

Most of the changes in this patch just follow the binder ABI.

Change-Id: I8c37b847ea65008d56554d34d4696fe3d22f7533
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:34 +00:00
Serban Constantinescu
5fb1b8836a ServiceManager: Store handles in uint32_t instead of void *
This patch corrects the types used for storing handles.

Change-Id: If9c10782345f1de9e12b4b3fd6be9e02e6b568cd
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:30 +00:00
Serban Constantinescu
9b738bb411 ServiceManager: Generic Fixes
This patch fixes some of the ServiceManager issues. The following patches
of the series add fixes to the ABI.

Change-Id: Ib479234c8704e12592f1b149ddec67881bc50230
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:25 +00:00
Serban Constantinescu
a44542ca74 ServiceManager: Add extra error handling
This patch extends the error handling. It also adds a check for a matching
binder version - kernel/userspace.

Change-Id: I43a262934b38c5711536aaa42754fed1ef04b39e
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:20 +00:00
Serban Constantinescu
dc832dc551 ServiceManager: Fix Android.mk
This patch fixes Android.mk and enables building bctest as an optional
module without any extra hacks.

Change-Id: Icaf8bf9452776db2ea4a2ba75f3abf05b4e2cdab
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:49:16 +00:00
Serban Constantinescu
bcf38880c6 ServiceManager: Make use of kernel exported structures
This patch switches ServiceManager to use the structures exported in the
kernel headers rather then redefining its own.

struct binder_txn is replaced with struct binder_transaction_data and struct
binder_object with struct flat_binder_object, both defined in the binder driver
header <linux/binder.h>.

Change-Id: I3b3e97918173ea35a289e184774ae06193192da3
Signed-off-by: Serban Constantinescu <serban.constantinescu@arm.com>
2014-01-31 10:20:49 +00:00
Brian Carlstrom
af3efe8ce7 Merge "frameworks/native: Rename persist.sys.dalvik.vm.lib to allow new default" 2014-01-30 21:50:56 +00:00
Brian Carlstrom
0c05d3aca6 frameworks/native: Rename persist.sys.dalvik.vm.lib to allow new default
Bug: 12798969
Change-Id: I6b40317eceb3d89b0acff88238a9a9ab423c4d78
2014-01-30 13:16:53 -08:00
Siva Velusamy
39177b4103 GLES_trace: fix compile errors on 64 bit architectures
GLES_trace passes some pointers back to the host. Encode them
using int64's rather than int32's

This fix requires an update to the host tool to look at pointers
as 64 bit, and if not found, then fall back to 32 bit integers.

Change-Id: I11ff2ca51290f05913c1b9143cecee1caf015543
2014-01-28 17:38:32 -08:00
Jesse Hall
f5bcb391c5 Merge "SurfaceFlinger: mFbProducerSlot initailization" 2014-01-28 18:17:46 +00:00
mayank parshar
fdfde88d0b SurfaceFlinger: mFbProducerSlot initailization
b/12487813

SurfaceFlinger crash is observed during simulation of
Secondary display

Note: change 14e8b01a76
removed the initialization leading to the crash when
simulating secondary display.  Restore the initialization
to solve the problem.

Change-Id: Iae5845fb82735e01de5cc0dc582d13c27e3c614f
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
2014-01-28 09:33:33 -08:00
Colin Cross
851b2cb18c Merge "Make libEGL build cleanly under 64-bit" 2014-01-28 02:22:11 +00:00
Dan Stoza
4864e85430 Make libEGL build cleanly under 64-bit
Change-Id: I255dfb70b166b7469d59352b1acfc7aececa07de
2014-01-27 18:16:50 -08:00
Colin Cross
55f0668ffd Merge "frameworks/native: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH" 2014-01-28 00:48:32 +00:00
Colin Cross
df50868a32 frameworks/native: convert LOCAL_MODULE_PATH to LOCAL_MODULE_RELATIVE_PATH
LOCAL_MODULE_PATH doesn't work for multiarch builds, replace it
with LOCAL_MODULE_RELATIVE_PATH.

Change-Id: I4e4ceec61d026bbe74ba604554c06104bde42e5e
2014-01-27 12:39:29 -08:00
Jesse Hall
fcf9c1bafb Merge "SurfaceFlinger: mFbFence initialization" 2014-01-26 08:15:15 +00:00
mayank parshar
b988f85fc4 SurfaceFlinger: mFbFence initialization
MobC00383030
b/12487813

SurfaceFlinger crash is observed while connecting
to Wi-Fi display.

Note: change 14e8b01a76
removed the initialization leading to the crash when
running through the HWC composition path.  Restore the
initialization to solve the problem.

Change-Id: I581defc7135ac512080c0da06a62b1dae7d218c4
Signed-off-by: mayank parshar <mayankp@broadcom.com>
Signed-off-by: Pierre Couillaud <pierre@broadcom.com>
2014-01-25 06:35:24 -08:00
Colin Cross
af29b77ab7 Merge "libGLES_android: fix 64-bit compile errors" 2014-01-25 00:38:16 +00:00
Colin Cross
444839b842 libGLES_android: fix 64-bit compile errors
Fix size of vertex_t on 64-bit architectures
Fix __get_tls casts, the TLS area is a void**
Cast through uintptr_t to store integers in a pointer
Use %zu to print size_t

Change-Id: I91079ec76025237e6d2081784c5348518b0ce122
2014-01-24 14:44:57 -08:00
Jesse Hall
b6c2100458 Merge "Implement per-display EGLConfig and configless EGLContext" 2014-01-03 18:25:07 +00:00
Jesse Hall
662d3134cb Merge "Move EGLConfig selection to RenderEngine" 2014-01-03 18:24:30 +00:00
Jesse Hall
19e872912a Implement per-display EGLConfig and configless EGLContext
Bug: 12230666
Change-Id: Icca608b108cbdcab9cf01a9236d8cdbda000a836
Signed-off-by: Jesse Hall <jessehall@google.com>
2013-12-23 21:53:39 -08:00
Jesse Hall
05f8c703d4 Move EGLConfig selection to RenderEngine
Bug: 12230666
Change-Id: I8d1111a7e0fd9d9e2525e6a80da8ce46d7dd085d
Signed-off-by: Jesse Hall <jessehall@google.com>
2013-12-23 21:53:39 -08:00
Brian Carlstrom
7fea23613a Merge "Track Looper decoupling from ALooper" 2013-12-19 07:13:03 +00:00
Nick Kralevich
c02c35fbdc Merge "restorecon /data/media when re-creating it for multi-user upgrade." 2013-12-17 23:02:36 +00:00
Stephen Smalley
47a351834f restorecon /data/media when re-creating it for multi-user upgrade.
Change-Id: I112c61863f2104d1962697c54cff25106e9b48a0
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2013-12-17 16:04:20 -05:00