183 Commits

Author SHA1 Message Date
Romain Guy
253f2c213f Linear blending, step 1
NOTE: Linear blending is currently disabled in this CL as the
      feature is still a work in progress

Android currently performs all blending (any kind of linear math
on colors really) on gamma-encoded colors. Since Android assumes
that the default color space is sRGB, all bitmaps and colors
are encoded with the sRGB Opto-Electronic Conversion Function
(OECF, which can be approximated with a power function). Since
the power curve is not linear, our linear math is incorrect.
The result is that we generate colors that tend to be too dark;
this affects blending but also anti-aliasing, gradients, blurs,
etc.

The solution is to convert gamma-encoded colors back to linear
space before doing any math on them, using the sRGB Electo-Optical
Conversion Function (EOCF). This is achieved in different
ways in different parts of the pipeline:

- Using hardware conversions when sampling from OpenGL textures
  or writing into OpenGL frame buffers
- Using software conversion functions, to translate app-supplied
  colors to and from sRGB
- Using Skia's color spaces

Any type of processing on colors must roughly ollow these steps:

[sRGB input]->EOCF->[linear data]->[processing]->OECF->[sRGB output]

For the sRGB color space, the conversion functions are defined as
follows:

OECF(linear) :=
linear <= 0.0031308 ? linear * 12.92 : (pow(linear, 1/2.4) * 1.055) - 0.055

EOCF(srgb) :=
srgb <= 0.04045 ? srgb / 12.92 : pow((srgb + 0.055) / 1.055, 2.4)

The EOCF is simply the reciprocal of the OECF.
While it is highly recommended to use the exact sRGB conversion
functions everywhere possible, it is sometimes useful or beneficial
to rely on approximations:

- pow(x,2.2) and pow(x,1/2.2)
- x^2 and sqrt(x)

The latter is particularly useful in fragment shaders (for instance
to apply dithering in sRGB space), especially if the sqrt() can be
replaced with an inversesqrt().

Here is a fairly exhaustive list of modifications implemented
in this CL:

- Set TARGET_ENABLE_LINEAR_BLENDING := false in BoardConfig.mk
  to disable linear blending. This is only for GLES 2.0 GPUs
  with no hardware sRGB support. This flag is currently assumed
  to be false (see note above)
- sRGB writes are disabled when entering a functor (WebView).
  This will need to be fixed at some point
- Skia bitmaps are created with the sRGB color space
- Bitmaps using a 565 config are expanded to 888
- Linear blending is disabled when entering a functor
- External textures are not properly sampled (see below)
- Gradients are interpolated in linear space
- Texture-based dithering was replaced with analytical dithering
- Dithering is done in the quantization color space, which is
  why we must do EOCF(OECF(color)+dither)
- Text is now gamma corrected differently depending on the luminance
  of the source pixel. The asumption is that a bright pixel will be
  blended on a dark background and the other way around. The source
  alpha is gamma corrected to thicken dark on bright and thin
  bright on dark to match the intended design of fonts. This also
  matches the behavior of popular design/drawing applications
- Removed the asset atlas. It did not contain anything useful and
  could not be sampled in sRGB without a yet-to-be-defined GL
  extension
- The last column of color matrices is converted to linear space
  because its value are added to linear colors

Missing features:
- Resource qualifier?
- Regeneration of goldeng images for automated tests
- Handle alpha8/grey8 properly
- Disable sRGB write for layers with external textures

Test: Manual testing while work in progress
Bug: 29940137

Change-Id: I6a07b15ab49b554377cd33a36b6d9971a15e9a0b
2016-10-11 17:47:58 -07:00
John Reck
aa67f684ff Fix a bunch of repeated reads of a ro.* property
SystemProperties.get() is not particularly fast,
especially if a string is returned. Since ro.* values
are unable to be changed, there's no need to
continously re-query them. Cache the value at
static init time to trivially fix this.

Test: refactoring CL.
Change-Id: Iccb021d3cb2ba3a4a1d0048ddec6811bb7409eec
2016-09-21 16:10:54 -07:00
Tobias Thierer
8431c55fb8 Merge "Ensure apps cannot prevent uncaught exceptions being logged."
am: f61a449ee9

Change-Id: I826c175547a73123cd438ebe6991efee39a433d0
2016-08-09 09:02:27 +00:00
Tobias Thierer
addbf9015a Ensure apps cannot prevent uncaught exceptions being logged.
Let RuntimeInit use an UncaughtExceptionPreHandler to log an exception
rather than relying on UncaughtHandler, which apps can replace. This
makes it easier to diagnose application death, especially during app
compatibility testing for a new version of Android.

Test: Verified manually, with the help of a small sample app (not
checked in), that stacktraces for RuntimeExceptions thrown on main
or background threads are logged even when the app set a default
UncaughtExceptionHandler that swallows the exception with no action.

Note that such an inappropriate UncaughtExceptionHandler will still
cause threads to die without the app being killed, which it should be.
In an exception then happens on the main thread, the app will freeze
until the ANR dialog kicks in after a few seconds. I have manually
verified that this behavior is unchanged from before this CL.

No new integration tests are included because the default system
behavior has not changed.

Bug: 29624607
Change-Id: Ie87377b0bcadc3ba4083a8ab1bedb8f3dd95a4bd
2016-08-08 17:59:28 +01:00
Andreas Gampe
cbcb9e3ec6 Frameworks/base: Update preloaded-classes
Another update.

Bug: 27248115
Change-Id: Ie0c3b8624a0f43c400a71759c176c02c56d270af
2016-06-06 14:58:44 -07:00
Andreas Gampe
52764cba59 Frameworks/base: Add holder to BaseBundle
Move EMPTY_PARCEL into an inner holder class. Add holder to
preloaded-classes. Clean up dependencies.

Allows to compile-time initialize:
* android.os.BaseBundle
* android.os.Bundle
* android.os.PersistableBundle
* android.telephony.CarrierConfigManager

Bug: 27265238
Change-Id: Ib8017aa419c2985963b3c68a8046462a38652ef2
2016-04-19 20:46:43 -07:00
Andreas Gampe
859e278fcc Frameworks/base: Update preloaded-classes
Bug: 27248115
Change-Id: Ib7d73b3e24dd71ae1cc8c245bdc953dea6136486
2016-04-12 02:41:18 +00:00
Doris Liu
28cfd20f02 Support running AVD on UI thread
By default, AVD animates on RT thread. But since in some cases there's a
need for a finer control on when the frame update for the animation should
happen, such as coordiating the AVD animation with other animations that
run on UI thread, we are providing a way to force the AVD to run on UI
thread.

Bug: 27278616
Change-Id: I372ecd3dc52e3fa0bdce3a1e9c19443f9b199027
2016-02-23 14:40:47 -08:00
Andreas Gampe
571fc303a9 Frameworks/base: Preloaded classes for N
Update the preloaded-classes list for Android N.

Bug: 27248115
Change-Id: Iaf726fa318a4495a5af57d2845a427095bc5f831
2016-02-18 17:29:35 -08:00
Przemyslaw Szczepaniak
d5f0eb0c84 Remove merge markers from preloaded-classes
(cherry picked from commit b0868054720a05d9e6d8ef6ee7e4c8c2d176f456)

Change-Id: Ieb1953e33dab7f852740872af110a938eb5c1ca4
2015-12-22 13:10:55 +00:00
Przemyslaw Szczepaniak
6a8ad6d161 Move StrictJarFile from libcore to framework
Bug: 25337946

(cherry picked from commit 8a7c1606d88873c5a1b5764c16cb046b6f2275b2)

Change-Id: I1bfce4129887d7cbfc02d92641b44920d7cdbbee
2015-12-22 13:10:55 +00:00
Przemyslaw Szczepaniak
bb02b6704d Stop preloading fortress classes
(cherry picked from commit f1e520169309f1303d4383298dd5644df59efe4b)

Change-Id: I4fd13c4dc373482c1235b54746fdf7f029a80dc2
2015-12-22 13:10:55 +00:00
Przemyslaw Szczepaniak
b086805472 Remove merge markers from preloaded-classes
Change-Id: I8267fc4cd41868f406e32a64ee750c0e5ca6098d
2015-12-02 11:32:22 +00:00
Przemyslaw Szczepaniak
8a7c1606d8 Move StrictJarFile from libcore to framework
Bug: 25337946
Change-Id: Ib4fac6fa9f534b8654e5ca158bbaedb2393772ba
(cherrypicked from 43ea2cc2a81926a6b2ca13d41f4eab089640129e)
2015-11-27 15:33:15 +00:00
Przemyslaw Szczepaniak
f1e5201693 Stop preloading fortress classes
(cherry-picked from 90d8781876643dc730aecee20f34dbe9e695653c)

Change-Id: If184fe9e40ba4c21fdb05d38c2975abfb4d0410b
2015-11-20 15:42:51 +00:00
Chad Brubaker
78d4712f27 Install the Network Security Config Provider
The provider is installed early in ActivityThread to ensure that no
TLS objects are created in the application before the provider is
installed.

Change-Id: I5f77addfa75a4ee19301de54e01507d8dca33657
2015-11-18 14:48:29 -08:00
Roozbeh Pournader
112d9c7f11 Remove EmojiFactory and its mentions from frameworks.
Bug: 18134313
Bug: 20158206
Change-Id: If46cdbd9d558e6592280b2b95f00b87d04de70a2
2015-08-07 12:57:01 -07:00
Andreas Gampe
61e7b66bc2 Frameworks/base: Update preloaded-classes
Update for Android M release.

Bug: 21760614
Change-Id: Ib1b1ac60da894ad4a4b6b7db37d8930b0d2b9046
2015-06-18 20:35:10 -07:00
Alex Klyubin
dcdaf87ed0 Move Android Keystore impl to android.security.keystore.
This moves the non-public API classes backing Android Keystore from
android.security to android.security.keystore, a package specially
created for Android Keystore.

Bug: 18088752
Change-Id: Ibf04d6a26c54d310b0501fc5e34f37b1176324ad
2015-05-13 16:17:40 -07:00
Alex Klyubin
4812563f68 AndroidKeyStore keys should not be handled by Bouncy Castle.
Bouncy Castle JCA provider incorrectly declares that its Cipher, Mac,
Signature, and KeyAgreement implementations accept arbitrary keys (
including AndroidKeyStore keys). As a result, when a Cipher, Mac,
Signature, or KeyAgreement instance is requested from JCA without
explicitly specifying the provider (which follows best practices)
and then initialied with an AndroidKeyStore key, JCA chooses the
BouncyCastle's implementation, which in turn blows up because it
can't handle such keys.

The workaround is to install Cipher, Mac, Signature, and
KeyAgreement implementations backed by AndroidKeyStore as a
higher-priority JCA provider than the Bouncy Castle one. This is
achieved by splitting out the above implementations from
AndroidKeyStoreProvider into AndroidKeyStoreBCWorkaroundProvider
and installing the AndroidKeyStoreProvider at the usual priority
(below Bouncy Castle) and the AndroidKeyStoreBCWorkaroundProvider
at above Bouncy Castle priority.

Bug: 20691708
Change-Id: I336464f4a49bc30c6845ddc4e84b07f4105424dd
2015-04-29 13:28:56 -07:00
Fyodor Kupolov
946646e4b9 Added SystemServiceRegistry to preloaded-classes
SystemServiceRegistry class should be preloaded in the zygote.

Bug: 20559324
Change-Id: I3120c7e42b50c54213513a04d7135d745c8abd7c
2015-04-24 13:34:00 -07:00
Neil Fuller
dad03bf185 am a921fa0f: am ff1e7e01: am 0e29681f: Merge "Load ICU4J data on boot"
* commit 'a921fa0fc354fed48d29822109c573a124a95dfd':
  Load ICU4J data on boot
2015-04-24 11:11:14 +00:00
Neil Fuller
9f7cd10134 Load ICU4J data on boot
Bug: 20252074
Bug: 20396452
Change-Id: I17de761e0d81caa2fc280b5cc368ee6113a5d655
2015-04-23 14:50:34 +01:00
Chet Haase
575217fc3d Make ActionBar animations work correctly
Previous ActionBar animations didn't handle configuration changes
or other situations in which the view would get detached. listeners
would stay on the view and would attempt to do something nonsensical
in the new window. This new approach removes listeners on window
detach to avoid this problem.

Issue #20125407 Settings Crashes when changing orientation of device

Change-Id: I0b3bbd0f6fc23cdb4cbd646b0d2772d72d3d795d
2015-04-14 14:09:26 +00:00
Alex Klyubin
6def5afcbc Load fewer classes when AndroidKeyStore provider is installed.
This avoids loading all AndroidKeyStore crypto SPI classes when the
AndroidKeyStore provider is instantiated and installed. This provider
is installed early on during the initialization of each app. Most apps
don't need these classes loaded.

Bug: 18088752
Change-Id: Ib43c9dd6a7d434b128916e0f9c8652ba61df0d47
2015-04-03 12:45:16 -07:00
Brian Carlstrom
0b36620014 Manually add SignalStrength to preloaded-classes
Bug: 19323020
Change-Id: I61e9d2dd5d06fe2353da17e5646f259122e5ea98
2015-03-04 21:56:26 -08:00
Alex Klyubin
f162066db5 Remove DefaultHostnameVerifier from preloaded-classes.
libcore's DefaultHostnameVerifier no longer exists. See
https://android-review.googlesource.com/#/c/117453/.

Bug: 18481199
Change-Id: I5c07e058aaaf8531d420058cfd104c4e751757a3
2014-12-04 09:41:46 -08:00
Andreas Gampe
dcad4caa84 Revert "Revert "Frameworks/base: Update to preloaded-classes""
This reverts commit 16626a7ee9f18c70b2f6437b4ab85753dbbb2263.

Remove three classes that break Shamu booting.

Bug: 17480683
Bug: 17791590
Change-Id: Ic487c5344d4186ea5205f117f07ca3ab7d945fb7
2014-10-02 19:05:44 -07:00
Andreas Gampe
16626a7ee9 Revert "Frameworks/base: Update to preloaded-classes"
Breaks shamu for unknown reason.

This reverts commit da3050614fc9dc31d39ff87ae5df0261fb76f93c.

Bug: 17480683
Change-Id: Id10ff18ef6e3acb5eb84196f7e5608add7edeb66
2014-10-02 08:45:09 +00:00
Andreas Gampe
da3050614f Frameworks/base: Update to preloaded-classes
Bug: 17480683
Change-Id: I06d2a64d2f9544cac0f5940cb9129cd5668740ba
2014-09-29 08:14:54 -07:00
Torne (Richard Coles)
b5de924fad Remove WebView library preloading mechanism.
We don't want to preload the WebView library in the zygote process any
more, as loading an updatable WebView in the zygote is a stability risk.
The memory benefits of preloading will be obtained in other ways.

Bug: 13005501
Change-Id: Ic89f2a1d057dc92b01fb775bf326b47ac2d4caa2
2014-07-17 09:18:43 -07:00
Lajos Molnar
e0e77cb5bb Remove VideoEditor
remove android.media.videoeditor.*

No longer supported and should not be used.

Bug: 13542518
Change-Id: I12de122443f0289ab1dfdd8b553e572a830cf412
2014-04-21 16:11:51 -07:00
Mike Lockwood
54d3bcfdf5 Remove non-existent classes from preloaded-classes
Change-Id: I0f86f7ab2ef132fbd12f85ff96e448d189af7177
2014-02-27 13:51:00 -08:00
Kenny Root
faa1057d4c am aa6ff54e: am 85ee57d1: am c064a1b5: Merge "Remove DRLCertFactory"
* commit 'aa6ff54ef57936024e98d9f565afe9fff24df2e4':
  Remove DRLCertFactory
2014-01-31 23:07:24 +00:00
Kenny Root
4f2323106b Remove DRLCertFactory
No longer needed since Conscrypt is the main provider.

Change-Id: Iee741ef376af2de52db79df07e96057438778bc6
2014-01-31 14:10:15 -08:00
Chris Craik
5438979e49 Move GLES20DisplayList functionality into DisplayList
Removes unneeded indirection layer

Change-Id: I75d3e369eda2788cbc52a3575c4e1c521e842f59
2013-12-20 13:53:50 -08:00
Kenny Root
e6585b32ea Use java.util.Objects instead on internal API
Not needed since java.util.Objects implements all the needed
functionality.

Change-Id: Icd31d49a9801d1705427f028e9ac927d58e7d34c
2013-12-13 13:40:30 -08:00
Kenny Root
e1263de835 Add GCMParameterSpec to preloaded-classes
Needed for Bouncycastle 1.50 upgrade with art.

Change-Id: I901122c1ce21abba437a7537e70331724c3cbc9c
2013-12-13 00:40:00 +00:00
Kenny Root
53bcf2264c preloaded-classes: remove some OpenSSLCipher modes
Some cipher modes were removed from OpenSSLCipher. This change removes
those classes from the preloaded classes list.

Change-Id: Ib4450c392513973836684b4d5df7fffb200b6260
2013-12-09 14:03:02 -08:00
Kenny Root
744f562c4d Add CertStoreParameters to preloaded-classes
For image creating, art needs this in the preloaded-classes list.
Otherwise it complains loudly about not being able to load it from a
class initializer in Provider.java.

Change-Id: Ie7ed5655cba038b504767c3de9f70b47a8965cce
2013-12-09 13:49:29 -08:00
Torne (Richard Coles)
6067d1a3c7 Remove old WebView classes from zygote preload list.
Don't preload java classes used only by the old WebView implementation.

Bug: 10427705
Change-Id: I1378ab564ef2d173e08806c30d1deb6020d65ba8
2013-10-15 10:45:18 +01:00
Brian Carlstrom
d6b964c16b Update preloaded-classes for KLP
Bug: 9189353
Change-Id: I9136692d7f23a513553981eca398351f28b5ddc6
2013-10-09 20:45:30 -07:00
Jonathan Dixon
caee47f096 Merge "Preparation for deleting WebViewClassic" into klp-dev 2013-09-11 17:59:42 +00:00
Adam Skory
aae67e11bc Fix bad references in preloaded-classes
http://ag/352924 renamed INdefPushCallback
to IAppCallback. Update preloaded-classes
to reflect this.

This is a cherry-pick of Id552e94e3a01cdd61593480f3c0aedb32d185f80

Change-Id: I0901f14fb41f94e3c7572c09e090ec5903a878d1
2013-09-11 18:35:33 +01:00
Jonathan Dixon
22e90cf2b0 Preparation for deleting WebViewClassic
Bug: 10427705

- layoutlib has references to classes that no longer build into the host
  core JAR when WebViewClassic is removed.
- preloaded-classes should not reference WebViewClassic classes.

Change-Id: I4d6773a88ea2932982278127a3c96d38be54ddf5
2013-08-25 23:02:37 -07:00
Elliott Hughes
58b5057c6e am c40e46e8: am bfe1b801: Merge "Update preloaded-classes"
* commit 'c40e46e8413c112186eadc8526d20306d81c9008':
  Update preloaded-classes
2013-07-30 14:10:43 -07:00
Sungmin Choi
66fe96aa65 Update preloaded-classes
Change-Id: I42247e498ad532e3f4699bc87c0d314cde74e3f6
2013-07-30 13:50:27 -07:00
Torne (Richard Coles)
03ce9b3e69 Enable preloading of the appropriate WebView.
Allow the appropriate WebView to be preloaded in the zygote by
constructing the currently selected WebViewFactoryProvider when the
WebViewFactory is preloaded. At runtime, if the preloaded provider is
still the current selection, the preloaded instance is used, otherwise
the provider is loaded at that time.

This change also removes "graceful" fallback from the experimental
WebView to the classic implementation: if the option to use the
experimental WebView is selected and it could not be loaded
successfully at the time a WebView is created, an exception will be
thrown, rather than allowing execution to continue with the classic
implementation, as the fallback may mislead developers who do not
examine logcat output in detail.

Change-Id: I0cd01c784d7048abeac55ab5863ca16b8fd9ecf2
2013-06-19 15:03:08 +01:00
Kenny Root
e9ae6822a8 resolved conflicts for merge of 1f6e789b to jb-mr2-dev-plus-aosp
Change-Id: I06c05d637613215b6d83df3e29cd495f6a5a0176
2013-04-29 23:09:03 -07:00
Kenny Root
12e752225a Track change to JSSE provider
Change-Id: I35e824e47ad758ab6408e91e2ba5dcda053a82f5
2013-04-29 15:15:27 -07:00