Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26726fc8 authored by Kwangkyu Park's avatar Kwangkyu Park
Browse files

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
parent 44102a40
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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 =