diff options
| author | 2023-03-09 21:28:46 +0900 | |
|---|---|---|
| committer | 2023-03-09 21:28:46 +0900 | |
| commit | 26726fc81e5a766fccf47db16eb41e71a028a071 (patch) | |
| tree | 57f786ccd691a58241f7a867585177790ef047de | |
| parent | 44102a405a0e9c371021fceeeb03ee2996513102 (diff) | |
Camera: Fix null pointer access
If a device is rebooted then the RecentTasks contains task list but
topActivityInfo could be null. In this case, if a camera device is
opened from a process without activity then CameraServiceProxy could
access null topActivityInfo.
Bug: 272428586
Test: Manual test with the OEM attention service
Change-Id: I9a9f42e8954d72e74c74f26ad5a690bcdd3a4cbc
| -rw-r--r-- | services/core/java/com/android/server/camera/CameraServiceProxy.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/services/core/java/com/android/server/camera/CameraServiceProxy.java b/services/core/java/com/android/server/camera/CameraServiceProxy.java index aec60deba933..96fcd9d937f1 100644 --- a/services/core/java/com/android/server/camera/CameraServiceProxy.java +++ b/services/core/java/com/android/server/camera/CameraServiceProxy.java @@ -487,7 +487,8 @@ public class CameraServiceProxy extends SystemService if ((recentTasks != null) && (!recentTasks.getList().isEmpty())) { for (ActivityManager.RecentTaskInfo task : recentTasks.getList()) { - if (packageName.equals(task.topActivityInfo.packageName)) { + if (task.topActivityInfo != null && packageName.equals( + task.topActivityInfo.packageName)) { taskInfo = new TaskInfo(); taskInfo.frontTaskId = task.taskId; taskInfo.isResizeable = |