From c8408b8fa758e0d10271bbe29f0e397c662a3641 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 25 Jan 2017 17:58:56 -0800 Subject: Fixing crash in SystemUI fetching task description icons. When we compose the TaskDescription for the task, we update it with information from each activity from top down. If an activity has a saved icon, the filepath for that icon will be encoded with the user id of the activity and saved into the task description. However, if that activity's user is different from the user id of the root activity of the task, we will later try to fetch the icon with the user id of the task which will cause an exception to be thrown. Instead, because the task description describes the task and information belonging to the task description is always fetched as the user of that task, we can save the icon with the task's user encoded instead of the activity's. Bug: 34692261 Test: Launch primary user activity with a custom task description icon in a task that is rooted with a work profile activity, then restart before the primary user activity is finished. Change-Id: I02200f20c4ed70f9b230418bae7b347fbef7fe87 --- services/core/java/com/android/server/am/ActivityRecord.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java index 2a849b6d573d..8ca77c50b9e1 100644 --- a/services/core/java/com/android/server/am/ActivityRecord.java +++ b/services/core/java/com/android/server/am/ActivityRecord.java @@ -1810,7 +1810,8 @@ final class ActivityRecord implements AppWindowContainerListener { if (_taskDescription.getIconFilename() == null && (icon = _taskDescription.getIcon()) != null) { final String iconFilename = createImageFilename(createTime, task.taskId); - final File iconFile = new File(TaskPersister.getUserImagesDir(userId), iconFilename); + final File iconFile = new File(TaskPersister.getUserImagesDir(task.userId), + iconFilename); final String iconFilePath = iconFile.getAbsolutePath(); service.mRecentTasks.saveImage(icon, iconFilePath); _taskDescription.setIconFilename(iconFilePath); -- cgit v1.2.3-59-g8ed1b