43 Commits

Author SHA1 Message Date
Neil Fuller
3b96bfb103 am 9b0109eb: am c7aa8fe6: Merge "Removing some more FloatMath references"
* commit '9b0109eb051fcf0a7ad801d03e73aa4e0bf2d7a7':
  Removing some more FloatMath references
2014-10-17 14:59:48 +00:00
Neil Fuller
6de42dac43 Removing some more FloatMath references
See frameworks/base commit 33253a4baa6279f81a73425b49dfb6abe5f5416e
for details.

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I46d4ee4c4be7972e3bcc6782fb50f024b6fff1ee
2014-10-15 11:45:45 +01:00
Selim Cinek
f8574f865b am 6e46a99f: am 3b0169ae: am a07421c6: am 2c461def: Merge "Fixed missing translation for wallpaper cropper" into lmp-dev
* commit '6e46a99fa5bbe3214a7adc56a301aa65ba436417':
  Fixed missing translation for wallpaper cropper
2014-10-10 23:21:10 +00:00
Selim Cinek
2c461def93 Merge "Fixed missing translation for wallpaper cropper" into lmp-dev 2014-10-10 21:14:34 +00:00
Selim Cinek
b7cde675a2 Fixed missing translation for wallpaper cropper
Also a fixed a small visibility issue.

Bug: 17927204
Change-Id: Ia9566fe8fe0c70f83edc295b0bf8317e94eb85fe
2014-10-10 13:55:36 -07:00
Christoph Studer
d55008d4b7 am efeb94a8: am a6a6f4b2: am a2830b7d: am 2c2cb29a: Merge "WallpaperCropper: Use white color for action bar" into lmp-dev
* commit 'efeb94a87d5598b486299202e35a72d4e46cde8b':
  WallpaperCropper: Use white color for action bar
2014-10-10 17:14:50 +00:00
Christoph Studer
9e8482062d WallpaperCropper: Use white color for action bar
Bug: 17343815
Change-Id: I5802f04204d081b97fbc2e2cb203fa03f16fea6a
2014-10-09 13:50:21 -07:00
Neil Fuller
c2a0b4482d resolved conflicts for merge of ee665151 to lmp-mr1-dev-plus-aosp
Change-Id: I2588c65b7a9fa43f968151a206924a804f0595a7
2014-10-02 14:32:37 +01:00
Neil Fuller
33253a4baa Switch from FloatMath -> Math and Math.hypot where possible
The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
2014-10-01 14:04:15 +01:00
Sunny Goyal
fabf1f23d6 Fixing memory leak in WallpaperCropActivity
issue: 15516788
Change-Id: I53a312addbb7ce17ecf02b2f14b9e991eab42be9
2014-07-23 10:52:32 -07:00
Adam Skory
0212c563c8 Squash unreachable catch
The compiler warning distracts me often.

Change-Id: Ia96e6c82ce1c0f1ae58f7faadbf8769b36d1f810
2014-06-05 14:38:30 +01:00
Alan Viverette
e3c38a0b0e Fix recents theme, add missing headers
Change-Id: Ib8eea6153eaf7e0e93e54c69fe59e63e98a409a6
2014-04-02 15:39:13 -07:00
Alan Viverette
6259933ec9 Switch framework Holo references to Quantum.Light
Change-Id: Ib545a143f1959b6104adbc9d594dd626851d90b3
2014-04-01 14:57:39 -07:00
Selim Cinek
49fb8aeff5 am c3db8011: am 58e99f56: am b6e077dc: am 7718fc12: Fixed crash when setting wallpaper with built in rotation
* commit 'c3db8011d7f7a5bcb0a9e5ae2d20022c6e88d8f9':
  Fixed crash when setting wallpaper with built in rotation
2014-03-27 23:16:51 +00:00
Selim Cinek
7718fc1291 Fixed crash when setting wallpaper with built in rotation
If an image had a built in rotation, a crash could occur,
when setting it. An example was a panorama image which had
a rotation of 90 degrees

Change-Id: Iede8226dac3a40f08d39a69162eb388e6aba97ec
Bug: 13507421
2014-03-27 19:34:01 +00:00
Selim Cinek
92a87e3026 am 50cd7c39: am f7805dd7: am 7290b56b: am 8ae8689d: am c41853ce: Fixed wallpaper bug where wrong size was taken when cropping
* commit '50cd7c39bb9f62d443a62d1f4af7f6ebc107f217':
  Fixed wallpaper bug where wrong size was taken when cropping
2014-03-25 21:18:45 +00:00
Selim Cinek
c41853cee8 Fixed wallpaper bug where wrong size was taken when cropping
When cropping, the selected area of the image was incorrectly
cropped to the size of the view instead of the size of the image

Bug: 13617446
Change-Id: If54a0891fa2cdeee70ba63752874f1543d401701
2014-03-24 13:53:06 +01:00
Selim Cinek
ba126c09a5 Disable Set Wallpaper button while loading image
Bug: 13534714
Change-Id: I45ff3436de40ea85fb22d776584d9f30f0795898
(cherry picked from commit 0fa6c1b146f7ed1aba335c30878e2c1b2bf2a8f1)
2014-03-21 22:15:10 +00:00
Adam Cohen
fb40d78c57 Merge "Catch exceptions if Exif is malformed" 2014-03-21 19:55:54 +00:00
Adam Cohen
146af201d3 Merge "Catching security exception when activity destroyed" 2014-03-21 19:54:55 +00:00
Selim Cinek
a4c1ccf3e0 Merge "Disable Set Wallpaper button while loading image" 2014-03-21 19:39:38 +00:00
Selim Cinek
5ab7d37d90 Catch exceptions if Exif is malformed
Bug: 11650650
Change-Id: Ie1680220fdb235a166a0eaa0a2309729f861865c
2014-03-21 20:32:34 +01:00
Selim Cinek
d6901a95d8 Catching security exception when activity destroyed
Fixed a bug where an asynctask tried to load an image
even after the activity was destroyed leading to a
security exception since the permission could not be granted anymore.

Bug: 12760267
Change-Id: Ieffb10b1007f349371647512ffe4fe72433344e7
2014-03-21 20:24:55 +01:00
Selim Cinek
0fa6c1b146 Disable Set Wallpaper button while loading image
Bug: 13534714
Change-Id: I45ff3436de40ea85fb22d776584d9f30f0795898
2014-03-21 19:19:08 +01:00
Adam Cohen
55b523cc3f Merge "[DO NOT MERGE] Fix wallpaper cropping bugs" into klp-dev 2014-03-19 20:16:11 +00:00
Michael Jurka
929e75e8d0 [DO NOT MERGE] Centering the crop by default in system wallpaper cropper
Bug: 12034934

Change-Id: Ice1b1140bd6e351dd4e520f555f245d84a645aac
(cherry picked from commit 2ab14daebac46307d2364733481edc3115bbf98c)
2014-03-19 17:57:17 +00:00
Michael Jurka
c82618c660 [DO NOT MERGE] Fix wallpaper cropping bugs
- take into account that image decoder might not
respect inSampleSize
- check rounded values so we don't have crop rects
that lie outside a bitmap's dimensions
- correctly set initial scale on bitmaps that are
larger than the screen size
- switch to using asynctask when setting wallpaper
dimensions
(cherry picked from commit e39c9a953ca11319b747b3aa79f4ccd082b775b7)

Change-Id: I43372f0bff37f139c8bc83f9956a967d0b4a8708
2014-03-19 17:56:55 +00:00
Selim Cinek
eb95e74e21 DO NOT MERGE - Fixed crash for odd image width/height
Due to an internal rounding in the renderer, the calculations
for the cropping area could be slightly offset, getting out
of the image boundaries. I sanitized the rect by ensuring they
are inside the image.

Bug: 12174629
Change-Id: Icc37790732ddd479631b898b23c05501d2dcd5be
2014-03-14 20:11:17 +00:00
Selim Cinek
912e0df89c Fixed a crash when an image with an odd width/height was selected
Due to an internal rounding in the renderer, the calculations
for the cropping area could be slightly offset, getting out
of the image boundaries. I sanitized the rect by ensuring they
are inside the image.

Bug: 12174629
Change-Id: Icc37790732ddd479631b898b23c05501d2dcd5be
2014-03-14 18:48:03 +01:00
Michael Jurka
01f7cc17c8 Don't set suggested wallpaper dimensions in default wallpaper cropper
suggestWallpaperDimensions is deprecated/ignored now anyway

Bug: 12118434
2014-01-29 15:04:59 +01:00
Michael Jurka
2ab14daeba Centering the crop by default in system wallpaper cropper
Bug: 12034934

Change-Id: Ice1b1140bd6e351dd4e520f555f245d84a645aac
2014-01-14 15:11:37 +01:00
Michael Jurka
35f922d1d0 Update system wallpaper cropper with latest changes from Launcher3 cropper 2014-01-14 14:10:32 +01:00
Michael Jurka
e39c9a953c Fix wallpaper cropping bugs
- take into account that image decoder might not
respect inSampleSize
- check rounded values so we don't have crop rects
that lie outside a bitmap's dimensions
- correctly set initial scale on bitmaps that are
larger than the screen size
- switch to using asynctask when setting wallpaper
dimensions
2013-12-02 15:05:44 -08:00
John Spurlock
6090995951 Remove unused imports from frameworks/base.
Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
2013-11-20 11:31:47 -05:00
Michael Jurka
eed96a0b90 Fix calculation of default wallpaper size
Bug: 11324470
2013-11-06 13:22:51 +01:00
Michael Jurka
b2552648ce Fix crashes for images that are not PNG or JPEG
Bug: 11342816

Change-Id: Ib8bbd30c1cc2d4f984af889895fb78412a1ab004
2013-11-01 13:31:14 +01:00
Michael Jurka
7b215cb922 Make wallpaper cropper more robust
- don't crash if image passed to wallpaper picker
is invalid
- close input streams correctly

Bug: 11413915
Bug: 11380658
Bug: 11362731
2013-10-30 14:54:21 +01:00
Michael Jurka
5271ea16c1 Load wallpaper images on a bg thread
Bug: 11134758
2013-10-28 14:42:48 +01:00
Michael Jurka
69784065ea Add EXIF rotation support to system wallpaper cropper
Bug: 11137824
2013-10-14 14:44:36 -07:00
Michael Jurka
33c493e653 Wallpaper cropper should inherit translucent theme
Change-Id: Icd13130d6250759c71ef016f62d10d7359cf067e
2013-10-08 12:47:22 -07:00
Michael Jurka
e72aa7f0a6 Fix crash in built-in wallpaper cropper
Also, sync to latest version of WallpaperCropActivity

Bug: 10950237
2013-10-07 17:06:23 -07:00
Michael Jurka
8b4836085b Fix default wallpaper dimensions
Bug: 10834711
2013-09-20 04:32:20 +02:00
Michael Jurka
e8d1bf7a43 Add new intent/method for cropping and setting wallpapers
Also, create a system fallback WallpaperCropper

Bug: 4225598

Change-Id: I6bc6d5a3bb3df1dc00f3db701978aa172020c568
2013-09-13 17:04:46 +02:00