2931 Commits

Author SHA1 Message Date
Dave Allison
07a1e2323b Move options buffers to top scope
It is important that the char buffers for options do
not go out of scope as the mOptions.add() does not copy
the buffer.  This moves all the buffers to the top
level scope of the function to prevent accidental
overwriting when they go out of scope.

Bug: 13448497
Change-Id: I5a97ddd32ff34f237915927906e1e1f833ff036e
2014-03-14 21:15:08 +00:00
Narayan Kamath
b3802a8e23 Remove java.io.tmpdir assignment in AndroidRuntime (again).
This was brought back by a bad merge conflict resolution
in change 0efbd9a463c848118c7685f4bfc8765a82caa761.

Change-Id: I0c7cbe8ee396293619eabf4d0a3c2f06c76bdd6e
2014-03-11 15:02:10 +00:00
Brian Carlstrom
98ba7bd5d1 Only pass -Xprofile-* options to ART
Bug: 13391896
Change-Id: I5d6a3b900c9b20f02e1d4ccb73f712e9260c7dfd
2014-03-10 10:22:10 -07:00
Narayan Kamath
6381dd4ff2 LP64: Make 9 patches architecture agnostic.
The Res_png_9patch struct had several pointer members
whose size differed between 32 and 64 bit platforms.

These members have been replaced by uint32_t offsets
to serialized data. The serialized form for 9patches
places a Res_png_9patch object at the beginning of
serialized data, followed by int32_t arrays of xDivs,
yDivs and colors.

Note that these offsets are not strictly required,
since they can be computed from the values of numXDivs,
numYDivs & numColors, however they are called in tight
loops so having them computed once is a beneficial.

This change also removed the unused patch_equals function
from aapt's Image.cpp.

Change-Id: I3b9ac8ae5c05510d41377cae4dff1c69b40c2531
2014-03-10 10:00:02 +00:00
Dave Allison
0efbd9a463 ART profiler usage.
This is a change to add args to some of the profiler related
functions, including installd commands.

Also read properties and set command line options for the runtime
profiling parameters.

Changed calls to isDexOptNeeded() to isDexOptNeededInternal().  This
needs additional arguments passed for profiles.

Bug: 12877748
Change-Id: I1a426c9309d760bac0cf92daa298defee62287c1

Conflicts:
	core/jni/AndroidRuntime.cpp
2014-03-07 12:32:44 -08:00
Brian Carlstrom
3beff1e023 Add dex2oat-flags plumbing to AndroidRuntime
Change-Id: Idaa7e5351e146d76e1972cbe4d93af69f0b999a6
2014-03-04 14:08:46 -08:00
Narayan Kamath
eee2c72f96 Merge "Various format string fixes for 64bit" 2014-02-28 13:41:58 +00:00
Ashok Bhat
64d38d9f48 AArch64: Make eglGetDisplay(int) work for EGL_DEFAULT_DISPLAY
Note that files changed in this patch have been automatically
generated by running frameworks/native/opengl/tools/glgen/gen
script

This will allow eglGetDisplay(int) to work on both 32-bit and
64-bit systems when EGL_DEFAULT_DISPLAY is passed as a parameter.

Change-Id: Idf27d6e00d623d331bb2d4d7f85fa450e0db26c9
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-26 19:07:54 +00:00
Narayan Kamath
2ba70fd49b Merge "Use reinterpret_cast when an integer is cast to a pointer" 2014-02-25 13:05:48 +00:00
Kévin PETIT
95ece35c2f Various format string fixes for 64bit
Change-Id: I74532a4e0400033f5ee3e3f6827ac42f77d16f53
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-02-24 17:39:46 +00:00
Ashok Bhat
84bbeb9e0c Use long for pointers in opengl/EGL classes
Note that files changed in this patch have been automatically
generated by running frameworks/native/opengl/tools/glgen/gen script

This patch updates EGL classes in frameworks/base to support
64-bit platforms. Key changes in the EGL classes include

[x] EGLObjectHandle class - EGLObjectHandle class has two public
    methods (constructor and getHandle) that assume handles are
    32-bit. They have not been changed. Instead, two new hidden
    methods (EGLObjectHandle(long) and getNativeHandle) have been
    added.

[x] EG14 class - Two public methods eglGetDisplay and
    eglCreatePbufferFromClientBuffer assume that handles are 32-bit.
    They have been changed to throw unsupported operation exception
    on non 32-bit machines. Two new methods eglGetDisplay(long)
    and eglCreatePbufferFromClientBuffer(...long buffer..) have
    been added to support 64-bit handles.

Change-Id: I9e0f064e5b33700eb0baa2e1841a21f931f7a765
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-24 15:50:22 +00:00
Ashok Bhat
01c26ea89d Use reinterpret_cast when an integer is cast to a pointer
Note that files changed in this patch have been generated
by running frameworks/native/opengl/tools/glgen/gen script.

Change-Id: Iff3ac2e804af41b9a6ec073fd65019c6806fe821
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-24 14:33:52 +00:00
Greg Hackmann
bbfc08b3ab Merge changes I6d4fdada,Ia34899a4
* changes:
  open("/dev/rtc0") failure in AlarmManagerService.setTime() should be non-fatal
  Move time setting code from SystemClock to AlarmManagerService
2014-02-21 21:01:00 +00:00
Greg Hackmann
38bf514668 Move time setting code from SystemClock to AlarmManagerService
On devices using /dev/rtc instead of /dev/alarm, updating the
time-of-day clock and RTC are separate syscalls.  Hence the clock and
RTC could be left in inconsistent states if two threads called
SystemClock.setCurrentTimeMillis() simultaneously.

By moving this code into AlarmManagerService, we can put a global lock
around AlarmManagerService.setTime() and prevent the race condition.

Note that access to SystemClock.setCurrentTimeMillis() is now gated by
android.permission.SET_TIME, where before it was gated by filesystem
permissions (i.e., could the process write to /dev/alarm or /dev/rtc).

Change-Id: Ia34899a4cde983656305fd2ef466dfe908ed23c8
Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-02-21 09:53:19 -08:00
Ashok Bhat
42f06b0e22 Remove unused JNITest class
JNITest class is no longer actively used. This patch
removes the class (java and jni) files.

JNI interfaces and calls are extensively tested in
the art unit tests (art/tests) and in cts (see
CtsJniTestCases).

Change-Id: I62f7c72deb5d206fa3f545ae39a9cb9011110d0a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-21 14:34:35 +00:00
Narayan Kamath
05cebdc2ab Merge "Fix several bad function definitions." 2014-02-20 12:55:27 +00:00
Narayan Kamath
047b938f71 Fix several bad function definitions.
We claim these functions want jlong as input (8 bytes wide)
but the definitions use pointer types or jints
(4 bytes wide for 32 bit).

bug: 12890271

(cherry picked from 017546e65280a3389b6167f5fc3b5d1c3001154a)

Change-Id: Iede02be90e6a3c9a2db1fe04dcd0db99abe37097
2014-02-20 12:52:16 +00:00
Ashok Bhat
4de3f481bc AArch64: Make AssetAtlasService 64-bit compatible
Changes in this patch include

[x] Long(64-bit) is used to store native pointers in
    AssetAtlasService and related classes as they can be 64-bit.

[x] Some minor changes have been done to conform with
    standard JNI practice (e.g. use of jint instead of int
    in JNI function prototypes)

Change-Id: Ib4c77c134e3ad5b21732e20cde9a54a0b16bdab1
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-20 12:10:24 +00:00
Narayan Kamath
7c710936c5 Merge "Remove java.io.tmpdir assignment in AndroidRuntime." 2014-02-19 14:24:48 +00:00
Narayan Kamath
3d03e5b90d Remove java.io.tmpdir assignment in AndroidRuntime.
This value is overridden by the framework anyway
(see ActivityThread.handleBindApplication). Besides,
it doesn't seem like a great idea to let tools clutter
/sdcard/ with temp files.

Change-Id: I26c710cbea7397f89e6103e54a73044a87da95b1
2014-02-14 17:42:24 +00:00
Narayan Kamath
fa8f95e9b9 Merge "AArch64: Use long for pointers in SurfaceSession class" 2014-02-14 13:10:44 +00:00
Nick Kralevich
a9bb594da6 Merge "Convert all selinux_android_restorecon and _setfilecon calls to new API." 2014-02-12 23:09:37 +00:00
Dianne Hackborn
67754d93c4 Merge "Runtime resource overlay, iteration 2" 2014-02-11 21:29:58 +00:00
Narayan Kamath
3aeb629d82 Merge "Use long to store pointers in GLES_JNI/EGL classes" 2014-02-11 15:39:04 +00:00
Narayan Kamath
f44a3f1e00 Merge "Use long for pointers in EmojiFactory and PdfDocument" 2014-02-11 14:07:17 +00:00
Colin Cross
d06969518b frameworks/base: fix errors inside ALOGV
Fix errors exposed by adding compile-time checking to disabled ALOGVs.

Change-Id: I9beeb5d5df498c63d6bed49734ee80a8e0afcefc
2014-02-09 21:54:01 -08:00
Stephen Smalley
d8fa586099 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:25 -05:00
Ashok Bhat
a3850d8f8f AArch64: Use long for pointers in SurfaceSession class
For storing pointers, long is used in SurfaceSession class,
as native pointers can be 64-bit.

Change-Id: I1535a488dfffaddd20e3beac57e558035d715cbf
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-02-06 16:57:49 +00:00
Mårten Kongstad
48d22323ce 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 11:20:30 +01:00
Ashok Bhat
863f98bbb3 Use long to store pointers in GLES_JNI/EGL classes
Change-Id: I43b32f2a85c07b3f59c57e28e3d03e8d1cabcd8b
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-01-31 16:27:30 +00:00
Ashok Bhat
896043d67d AArch64: Make AssetManager and related classes 64-bit compatible
Following changes have been done:

[x] Long is used to store native pointers as pointers can be
    64-bit.

[x] AssetManager openAsset native function returned -1 if
    file name was empty and java function considered any
    non-zero value as success. This has been fixed by native
    function throwing Illegal Argument Exception as well.

[x] AssetManager incRefsLocked and decRefsLocked now accept
    long as input to support 64-bit native references.

[x] AssetManager incRefsLocked method incorrecly used
    'this.hashCode()' instead of the passed parameter id.
    This has been fixed.

[x] Some minor changes have been done to conform with
    standard JNI practice (e.g. use of jint instead of int
    in JNI function prototypes)

Change-Id: I095b9f900d49e51f43ad6afc47cbc23116a6a64a
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
2014-01-31 14:14:29 +00:00
Ashok Bhat
cdf34469b3 Use long for pointers in EmojiFactory and PdfDocument
Change-Id: I275c9ce390dd9e01f772e2044c74cebdb0701de6
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-01-31 12:03:28 +00:00
Igor Murashkin
e05b7b50e2 Merge "EGL14.eglCreateWindowSurface should set producerControlledByApp" 2014-01-31 01:26:15 +00:00
Narayan Kamath
ab71f8b68f Merge "AArch64: Use of long for pointers in PropertyValuesHolder" 2014-01-30 10:37:12 +00:00
Chong Zhang
b215529c72 change Surface constructor arg to 64bit
Bug: 12799017
Bug: 12799384

(cherry picked from commit af608e81d450b962a443a21fb1a6feadeb355fe1)

Change-Id: I8d1471b16e6a6d334a3a32b789045eb171b81e03
2014-01-30 09:50:21 +00:00
Stephen Smalley
e0dda3c8e2 Map SELinux log levels to Android log levels.
Change-Id: I202c543ca6e4110c4011d1904eada4b75b59ff10
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
2014-01-29 12:55:58 -05:00
Narayan Kamath
d228a03891 Merge "mNativeCanvas is long, not int." 2014-01-29 15:02:05 +00:00
Narayan Kamath
e3a6663bb2 mNativeCanvas is long, not int.
swapNativeCanvas was asking for an int field.

Change-Id: I660fb13ecfb5d3b24201676dc03c16d61c92af07
2014-01-29 12:21:32 +00:00
Narayan Kamath
d4ccffd3ba Merge "AArch64: Use long for pointers in graphics/Interpolator" 2014-01-29 12:12:27 +00:00
Narayan Kamath
887b1ca879 Merge "AArch64: Use long for pointers in SurfaceTexture" 2014-01-29 12:12:17 +00:00
Ashok Bhat
0141e88434 AArch64: Use of long for pointers in PropertyValuesHolder
Long is used in PropertyValuesHolder class to store native pointers
as they can be 64-bit. Note that jmethodID, a pointer to structures,
is also carried in long rather than int to support 64-bit system.

Change-Id: Ifb514fc8473d7c41c0d6194fc6eb85d4816b2cd9
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
2014-01-29 10:47:27 +00:00
Narayan Kamath
50afaefdc0 Merge "AArch64: Make Binder and Parcel 64-bit compatible" 2014-01-29 10:43:23 +00:00
Mark Salyzyn
967c5d00df Merge changes I3659193f,I8b78e4db
* changes:
  jni: Resolve build warnings
  jni: Incorporate liblog reading API
2014-01-28 21:30:40 +00:00
Ashok Bhat
5753b45516 AArch64: Use long for pointers in graphics/Camera
For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Change-Id: Ic05ebf2051a225a1638a43f476bab6176c0b5c38
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
2014-01-28 17:53:30 +00:00
Ashok Bhat
a0398430fc AArch64: Make graphics classes 64-bit compatible
Changes in this patch include

[x] Long is used to store native pointers as they can
    be 64-bit.

[x] Some minor changes have been done to conform with
    standard JNI practice (e.g. use of jint instead of int
    in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
    yet. Specifically mAtlasMap member has to be converted
    to hold native pointer using long. Added a TODO to
    AssetAtlasManager.java to indicate the change required.

Change-Id: I940433f601c6db998c1a8ffff338f5361200d5ed
Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>
2014-01-28 17:40:38 +00:00
Mark Salyzyn
3ed8e2e679 jni: Resolve build warnings
(cherry picked from commit 087f58dd80e3296a53c6e3c74c089e9a0265f3bd)

Change-Id: I3659193f1ba1ba94561e4684cdb6627880ffc2fa
2014-01-27 15:25:51 -08:00
Mark Salyzyn
7933c2943f jni: Incorporate liblog reading API
(cherry picked from commit e11cbd441df4a1689c89b2ab91b84523c9f2fd10)

Change-Id: I8b78e4db67b6daabb975ce740fb40478df4ffcef
2014-01-27 15:25:09 -08:00
Mathieu Chartier
db52572486 Merge "Fix dest == src bugs in Matrix.cpp." 2014-01-27 17:26:48 +00:00
Narayan Kamath
745d4efc83 AssetManager cookies should be int32_t and not void*.
Cookies are really indices into vectors and arrays, so
they don't need to be void*. We choose int32_t instead
of size_t to allow their width to be well specified.

(cherry picked from commit ebfdd0f467e39c3af8d92cade78263935340acb7)
(cherry picked from commit a7fa2e592e2e579e5acdb903dba83fc074ebc215)
(cherry picked from commit a9d5701b034ed2d9771b3f0943e1add00741d7cd)

Change-Id: I2aed3db568b6fdc487bf99e2c5dd123206736fda
2014-01-27 11:20:24 +00:00
Mathieu Chartier
768480c245 Fix dest == src bugs in Matrix.cpp.
The main bug was that the AutoJavaFloatArray autoSrc was not passing in
read only. This meant that the destructor overwrote the data which
the autoDst AutoJavaFloatArray had written in it's destructor.
This case only happened if src == dest and the arrays were copies.
Also improved performance by passing in read only a few other places.

Bug: 12570144

Change-Id: Idc8764087dc165433c584b87a0f9d4ed0ec795e8
2014-01-25 17:54:22 -08:00