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

Commit 7aae738d authored by Marcello Galhardo's avatar Marcello Galhardo Committed by Brian Egizi
Browse files

Support split-mode on Note Shortcut

Cherry picked I90adb9eaf7cb33968db38daa8322ecd8a0a62939 to master due to b/286408867.

Code was merged via `-s ours` and is missing even though the sha exists on the target branch. Cherry pick is required to bring in the code.

Manually remove the "Merged in" directive to allow for downstream propagation.

Test: atest NoteTaskInfoTest
Flag: not needed
Fixes: b/284296041
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:cb876c5e29567718cd41cc24d63f58928adcdc0f)
Change-Id: I588fbf8122300b4826db9913d742a9ca5ea7b5e8
parent 47df3d96
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -1005,7 +1005,6 @@
            android:name=".notetask.shortcut.LaunchNoteTaskActivity"
            android:exported="true"
            android:excludeFromRecents="true"
            android:resizeableActivity="false"
            android:theme="@android:style/Theme.NoDisplay" >

            <intent-filter>
@@ -1018,7 +1017,6 @@
            android:name=".notetask.LaunchNotesRoleSettingsTrampolineActivity"
            android:exported="true"
            android:excludeFromRecents="true"
            android:resizeableActivity="false"
            android:theme="@android:style/Theme.NoDisplay" >
            <intent-filter>
                <action android:name="com.android.systemui.action.MANAGE_NOTES_ROLE_FROM_QUICK_AFFORDANCE" />
+1 −2
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ import com.android.systemui.notetask.NoteTaskRoleManagerExt.getDefaultRoleHolder
import com.android.systemui.notetask.shortcut.CreateNoteTaskShortcutActivity
import com.android.systemui.settings.UserTracker
import com.android.systemui.shared.system.ActivityManagerKt.isInForeground
import com.android.systemui.util.kotlin.getOrNull
import com.android.systemui.util.settings.SecureSettings
import com.android.wm.shell.bubbles.Bubble
import com.android.wm.shell.bubbles.Bubbles.BubbleExpandListener
@@ -219,7 +218,7 @@ constructor(
                    debugLog { "onShowNoteTask - opened as app bubble: $info" }
                }
                is NoteTaskLaunchMode.Activity -> {
                    if (activityManager.isInForeground(info.packageName)) {
                    if (info.isKeyguardLocked && activityManager.isInForeground(info.packageName)) {
                        // Force note task into background by calling home.
                        val intent = createHomeIntent()
                        context.startActivityAsUser(intent, user)
+4 −2
Original line number Diff line number Diff line
@@ -25,12 +25,14 @@ import com.android.systemui.screenshot.appclips.AppClipsTrampolineActivity
 * An entry point represents where the note task has ben called from. In rare cases, it may
 * represent a "re-entry" (i.e., [APP_CLIPS]).
 */
enum class
NoteTaskEntryPoint {
enum class NoteTaskEntryPoint {

    /** @see [LaunchNoteTaskActivity] */
    WIDGET_PICKER_SHORTCUT,

    /** @see [LaunchNoteTaskActivity] */
    WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE,

    /** @see [NoteTaskQuickAffordanceConfig] */
    QUICK_AFFORDANCE,

+31 −24
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import com.android.systemui.notetask.NoteTaskEntryPoint.KEYBOARD_SHORTCUT
import com.android.systemui.notetask.NoteTaskEntryPoint.QUICK_AFFORDANCE
import com.android.systemui.notetask.NoteTaskEntryPoint.TAIL_BUTTON
import com.android.systemui.notetask.NoteTaskEntryPoint.WIDGET_PICKER_SHORTCUT
import com.android.systemui.notetask.NoteTaskEntryPoint.WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE
import com.android.systemui.notetask.NoteTaskEventLogger.NoteTaskUiEvent
import com.android.systemui.notetask.NoteTaskEventLogger.NoteTaskUiEvent.NOTE_OPENED_VIA_KEYGUARD_QUICK_AFFORDANCE
import com.android.systemui.notetask.NoteTaskEventLogger.NoteTaskUiEvent.NOTE_OPENED_VIA_SHORTCUT
import com.android.systemui.notetask.NoteTaskEventLogger.NoteTaskUiEvent.NOTE_OPENED_VIA_STYLUS_TAIL_BUTTON
@@ -49,10 +51,13 @@ class NoteTaskEventLogger @Inject constructor(private val uiEventLogger: UiEvent
                            NOTE_OPENED_VIA_STYLUS_TAIL_BUTTON
                        }
                    }
                WIDGET_PICKER_SHORTCUT -> NOTE_OPENED_VIA_SHORTCUT

                    WIDGET_PICKER_SHORTCUT,
                    WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE -> NOTE_OPENED_VIA_SHORTCUT

                    QUICK_AFFORDANCE -> NOTE_OPENED_VIA_KEYGUARD_QUICK_AFFORDANCE
                APP_CLIPS -> return
                KEYBOARD_SHORTCUT -> return
                    APP_CLIPS,
                    KEYBOARD_SHORTCUT,
                    null -> return
                }
        uiEventLogger.log(event, info.uid, info.packageName)
@@ -69,10 +74,12 @@ class NoteTaskEventLogger @Inject constructor(private val uiEventLogger: UiEvent
                            NoteTaskUiEvent.NOTE_CLOSED_VIA_STYLUS_TAIL_BUTTON
                        }
                    }
                WIDGET_PICKER_SHORTCUT -> return
                QUICK_AFFORDANCE -> return
                APP_CLIPS -> return
                KEYBOARD_SHORTCUT -> return

                    WIDGET_PICKER_SHORTCUT,
                    WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE,
                    QUICK_AFFORDANCE,
                    APP_CLIPS,
                    KEYBOARD_SHORTCUT,
                    null -> return
                }
        uiEventLogger.log(event, info.uid, info.packageName)
+2 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
package com.android.systemui.notetask

import android.os.UserHandle
import com.android.systemui.notetask.NoteTaskEntryPoint.WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE

/** Contextual information required to launch a Note Task by [NoteTaskController]. */
data class NoteTaskInfo(
@@ -27,7 +28,7 @@ data class NoteTaskInfo(
) {

    val launchMode: NoteTaskLaunchMode =
        if (isKeyguardLocked) {
        if (isKeyguardLocked || entryPoint == WIDGET_PICKER_SHORTCUT_IN_MULTI_WINDOW_MODE) {
            NoteTaskLaunchMode.Activity
        } else {
            NoteTaskLaunchMode.AppBubble
Loading