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

Commit a88605df authored by Charlie Anderson's avatar Charlie Anderson Committed by Android (Google) Code Review
Browse files

Merge "Add additional debug logging for when Launcher cannot find a valid...

Merge "Add additional debug logging for when Launcher cannot find a valid activity to launch an app with." into main
parents 56392d2f d11c24e7
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ class WorkspaceItemProcessor(
        var allowMissingTarget = false
        var intent = c.parseIntent()
        if (intent == null) {
            c.markDeleted("Null intent for item id=${c.id}", RestoreError.MISSING_INFO)
            c.markDeleted("Null intent from db for item id=${c.id}", RestoreError.MISSING_INFO)
            return
        }
        var disabledState =
@@ -157,13 +157,19 @@ class WorkspaceItemProcessor(
                c.markRestored()
            } else {
                // Gracefully try to find a fallback activity.
                FileLog.d(
                    TAG,
                    "Activity not enabled for id=${c.id}, component=$cn, user=${c.user}." +
                        " Will attempt to find fallback Activity for targetPkg=$targetPkg."
                )
                intent = pmHelper.getAppLaunchIntent(targetPkg, c.user)
                if (intent != null) {
                    c.restoreFlag = 0
                    c.updater().put(Favorites.INTENT, intent.toUri(0)).commit()
                } else {
                    c.markDeleted(
                        "Intent null, unable to find a launch target",
                        "No Activities found for id=${c.id}, targetPkg=$targetPkg, component=$cn." +
                            " Unable to create launch Intent.",
                        RestoreError.MISSING_INFO
                    )
                    return
+9 −2
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ class WorkspaceItemProcessorTest {
        // When
        itemProcessorUnderTest.processItem()
        // Then
        verify(mockCursor).markDeleted("Null intent for item id=1", MISSING_INFO)
        verify(mockCursor).markDeleted("Null intent from db for item id=1", MISSING_INFO)
        verify(mockCursor, times(0)).checkAndAddItem(any(), any(), anyOrNull())
    }

@@ -309,7 +309,14 @@ class WorkspaceItemProcessorTest {
        assertWithMessage("item restoreFlag should be unchanged")
            .that(mockCursor.restoreFlag)
            .isEqualTo(1)
        verify(mockCursor).markDeleted("Intent null, unable to find a launch target", MISSING_INFO)
        verify(mockCursor)
            .markDeleted(
                "No Activities found for id=1," +
                    " targetPkg=package," +
                    " component=ComponentInfo{package/class}." +
                    " Unable to create launch Intent.",
                MISSING_INFO
            )
        verify(mockCursor, times(0)).checkAndAddItem(any(), any(), anyOrNull())
    }