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

Commit 0528b5e7 authored by Winson Chung's avatar Winson Chung Committed by Android Build Coastguard Worker
Browse files

Add null check for clip data before getting the description

Fixes: 383034393
Test: atest WMShellUnitTests
Flag: EXEMPT bugfix
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:774dd22036a68f4a19a13719ed5f783d9734174d)
Merged-In: I177164162d79c0ef3ec2e24070e1fcde62be6679
Change-Id: I177164162d79c0ef3ec2e24070e1fcde62be6679
parent 06195e27
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