diff options
author | Winson Chung <winsonc@google.com> | 2020-02-18 15:16:08 -0800 |
---|---|---|
committer | Winson Chung <winsonc@google.com> | 2020-02-19 15:49:00 -0800 |
commit | d6722037ba1f89af5efa9be4831a33df125c5d1e (patch) | |
tree | 8ae3ee853a4406f7f33e8918c4f0703ee8cf859e /tests/ActivityTests/src | |
parent | 2a180f114060e217411dec75563993a227aa9769 (diff) |
Ensure task description icon resources are loaded from the right package
- We previously assumed that icons set in the task description would be
loaded from the same package as the root activity (which is incorrect),
instead, they should be fetched from the activity which set them.
We also deprecate getIcon() because:
- apps could only get the icons they set previously (not very useful)
- it didn't return resource icons, only in memory or loaded from disk
- the name doesn't indicate that it could result in a disk load
Instead, callers (namely SysUI) should now call loadIcon() to get the
actual icon directly (or loaded if necessary).
Bug: 143363444
Test: atest TaskDescriptionTest
Test: atest ActivityManagerTest
Change-Id: I48aaba17de2edf0b3a61fa049cf897020d4c2ef1
Diffstat (limited to 'tests/ActivityTests/src')
-rw-r--r-- | tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java index 07b3a97817a3..768cfaea4898 100644 --- a/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java +++ b/tests/ActivityTests/src/com/google/android/test/activity/ActivityTestMain.java @@ -32,6 +32,7 @@ import android.content.pm.UserInfo; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.drawable.Icon; import android.net.Uri; import android.os.Bundle; import android.os.Handler; @@ -587,7 +588,7 @@ public class ActivityTestMain extends Activity { desc.setLabel("Added #" + i); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon); if ((i&1) == 0) { - desc.setIcon(bitmap); + desc.setIcon(Icon.createWithBitmap(bitmap)); } int taskId = am.addAppTask(this, intent, desc, bitmap); Log.i(TAG, "Added new task id #" + taskId); |