Commit Graph

15 Commits

Author SHA1 Message Date
Nader Jawad
23b82af43f Merge "Fix AdaptiveIconDrawable#getAlpha" 2018-11-27 01:04:45 +00:00
Hyunyoung Song
911851b91f Fix isProjected and setAlpha method inside AdaptiveIconDrawable
Test: atest AdaptiveIconDrawableTest (in coretests and cts)
Bug: 119755247
Bug: 118503770

Some contexts regarding why setAlpha was misbehaving before and after
setBounds: mPaint object which is used to setAlpha was shared between
mLayerBitmpa and mMaskBitmap. When bounds changed, mMaskBitmap alpha was
never properly refreshed. To fix this issue AND to optimize memory
footprint, the drawable no longer make use of the mMaskBitmap object.

CtsGraphicsTestCases (21 Tests)
------------------------------
[1/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInflateNull: PASSED (1ms)
[2/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetVisible: PASSED (1ms)
[3/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDraw: PASSED (1ms)
[4/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetOpacity: PASSED (0ms)
[5/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetForegroundBackground: PASSED (25ms)
[6/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetConstantState: PASSED (0ms)
[7/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testIsStateful: PASSED (0ms)
[8/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawNull: PASSED (1ms)
[9/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawWithoutSetBounds: PASSED (0ms)
[10/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetIntrinsicHeight: PASSED (25ms)
[11/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testScheduleDrawable: PASSED (1ms)
[12/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetIntrinsicWidth: PASSED (1ms)
[13/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetColorFilter: PASSED (1ms)
[14/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInflate: PASSED (1ms)
[15/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testMutate: PASSED (1ms)
[16/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testGetChangingConfigurations: PASSED (1ms)
[17/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testInvalidateDrawable: PASSED (0ms)
[18/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testUnscheduleDrawable: PASSED (25ms)
[19/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testConstructor: PASSED (0ms)
[20/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testSetAlpha: PASSED (0ms)
[21/21] android.graphics.drawable.cts.AdaptiveIconDrawableTest#testDrawSetBounds: PASSED (478ms)

Summary
-------
CtsGraphicsTestCases: Passed: 21, Failed: 0

FrameworksCoreTests (6 Tests)
----------------------------
[1/6] android.graphics.drawable.AdaptiveIconDrawableTest#testDraw_withBounds: PASSED (454ms)
[2/6] android.graphics.drawable.AdaptiveIconDrawableTest#testDraw_withoutBounds: PASSED (0ms)
[3/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetIconMaskAfterSetBounds: PASSED (1ms)
[4/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetIconMask_withoutBounds: PASSED (1ms)
[5/6] android.graphics.drawable.AdaptiveIconDrawableTest#testGetOutline_withBounds: PASSED (0ms)
[6/6] android.graphics.drawable.AdaptiveIconDrawableTest#testSetAlpha: PASSED (0ms)

Summary
-------
FrameworksCoreTests: Passed: 6, Failed: 0

Change-Id: Ie52019f14159e06b957760cb33118cb74f58415e
2018-11-21 16:06:22 -08:00
Nader Jawad
c0a315a1a8 Fix AdaptiveIconDrawable#getAlpha
Reverted getAlpha implementation to return the
alpha value of the first non-null child drawable

Bug: 119668265
Test: Added test to AdaptiveIconDrawableTest
Change-Id: Ia3384755e8f9a83b88d586881eae80e4c201097f
2018-11-21 13:19:26 -08:00
Sunny Goyal
32b64217a9 Setting the alpha on the full bitmap for AdaptiveIcon instead of individual layers
Test: atest FrameworksCoreTests:AdaptiveIconDrawableTest
Bug: 72798522
Change-Id: I3862942bf6f2c4767c293f09ad14725b5f0fbb2b
2018-03-07 10:11:56 -08:00
Hyunyoung Song
dba9934fb7 AdaptiveIconDrawable should not update layer bounds when bound is empty
Test: build succeeds. Also, setting tint mode does not result in error.

Bug: 37682281
Change-Id: I5991b8e58514a2130a793a5edb90baeafae9b148
2017-06-28 00:13:15 +00:00
Hyunyoung Song
ac2f74e80e Fix safezone and getAlpha
b/38361276
Test: frameworks/base/core/tests/coretests/src/android/graphics/drawable/IconTest.java

Change-Id: I3e1c73276968747249b053fd581f289c340d98af
2017-05-24 17:29:34 -07:00
Hyunyoung Song
d2afdab226 Add @TestApi annotation to AdaptiveIconDrawable
Bug: 37779858
Bug: 37788590

Test: $ make -j31
Test: $ make update-api -j31

Change-Id: I459317e8b9f6db227a4bb567c17b212639454e9d
2017-04-28 15:40:50 -07:00
Adam Lesinski
50954d2b4e Propagate density through AdaptiveIconDrawable and BitmapDrawable
Resources#getDrawableForDensity now propagates the overridden
density through to AdaptiveIconDrawable so that the density can be
propagated to leaf BitmapDrawables correctly.

This enables AdaptiveIconDrawable to support higher resolution
foreground/background bitmaps for use in Launcher.

Bug: 36039665
Test: bit CtsContentTestCases:android.content.res.cts.ResourcesTest
Change-Id: Iaa9a5592626e38e1ff839a76f7c6cfb9e16e5dc1
2017-04-21 13:25:44 -07:00
Hyunyoung Song
76c13a5fce Merge "Update API, add more documentation on AdaptiveIconDrawable" into oc-dev 2017-04-13 16:53:43 +00:00
Hyunyoung Song
92e3da2354 Update API, add more documentation on AdaptiveIconDrawable
and fix multiple miscellaneous bugs.

Bug: 37079814
Bug: 37100106
Bug: 34829216

Test: $ runtest --path=frameworks/base/core/tests/coretests/src/android/graphics/drawable/IconTest.java
Test: $ runtest --path=frameworks/base/services/tests/servicestests/src/com/android/server/pm/ShortcutManagerTest1.java
Test: $ runtest --path=frameworks/base/core/tests/coretests/src/android/grpahics/drawable/AdaptiveIconDrawableTest.java

Change-Id: I0f5b2232853031bf3860ebea2736e894d17e4d2e
2017-04-12 16:06:45 -07:00
Jiaquan He
4a81674b45 Detect unhandled keyboard focused state.
A View uses a Drawable as its background, which changes
its appearance according to the View's state. This commit
adds an algorithm to detect undefined state_focused in
state specs for those Drawables.

Test: cts-tradefed run singleCommand cts --skip-device-info
--skip-preconditions --abi armeabi-v7a -m CtsGraphicsTestCases
-t android.graphics.drawable.cts.DefaultFocusHighlightTest
Bug: 35096940

Change-Id: I5e9f07141679881fe88f9040aa116ea2f9d537c9
2017-04-10 21:01:49 +00:00
Hyunyoung Song
55211c032c Prevent NPE when draw is called without bounds being set
Test: unit test inside AdaptiveIconDrawableTest.java

Change-Id: Ic3260ce9c6bae595c7eba7be1cd7ae249939a1cf
2017-04-03 00:23:49 -07:00
Hyunyoung Song
547010ff86 Add LauncherIcons.AdaptiveIconDrawableWithShadow class to support shadow
b/36088922

Test: Settings app
This utility class can be used to bake shadow in drawable level in
system ui surfaces such as Settings, Overview and ShareSheet.

Change-Id: Iaec867d9ce5b949380c1e5004b68269d1bbeacd4
2017-03-16 13:51:28 -07:00
Hyunyoung Song
0bbf4f5974 AdaptiveIconDrawable should handle all usage cases of setBounds
Test: runtest --path=frameworks/base/core/tests/coretests/src/android/graphics/drawable/AdaptiveIconDrawableTest.java

b/35950873
b/35673169
b/34902453

adb  shell am instrument -e class 'android.graphics.drawable.AdaptiveIconDrawableTest' -w 'com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner'
android.graphics.drawable.AdaptiveIconDrawableTest:..

Time: 1.241

OK (2 tests)


Change-Id: I6498f6acc782a30188fc2afc50781cef83e4747b
2017-03-07 11:42:29 -08:00
Hyunyoung Song
be8835e86b Change MaskableIconDrawable to AdaptiveIconDrawable
Test: $ make -j31 dist

Bug: 35399620
Change-Id: I5e54f75b3df21ffe546e0e54dbd7ea29499d1789
2017-02-17 12:13:22 -08:00