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

Commit 774dd220 authored by Winson Chung's avatar Winson Chung
Browse files

Add null check for clip data before getting the description

Fixes: 383034393
Test: atest WMShellUnitTests
Flag: EXEMPT bugfix
Change-Id: I177164162d79c0ef3ec2e24070e1fcde62be6679
parent 767ff220
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -74,7 +74,7 @@ public class DragSession {
        mInitialDragData = data;
        mInitialDragFlags = dragFlags;
        displayLayout = dispLayout;
        hideDragSourceTaskId = data.getDescription().getExtras() != null
        hideDragSourceTaskId = data != null && data.getDescription().getExtras() != null
                ? data.getDescription().getExtras().getInt(EXTRA_HIDE_DRAG_SOURCE_TASK_ID, -1)
                : -1;
        ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP,
+7 −0
Original line number Diff line number Diff line
@@ -58,6 +58,13 @@ class DragSessionTest : ShellTestCase() {
        MockitoAnnotations.initMocks(this)
    }

    @Test
    fun testNullClipData() {
        // Start a new drag session with null data
        val session = DragSession(activityTaskManager, displayLayout, null, 0)
        assertThat(session.hideDragSourceTaskId).isEqualTo(-1)
    }

    @Test
    fun testGetRunningTask() {
        // Set up running tasks