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

Commit 90487af7 authored by Marcello Galhardo's avatar Marcello Galhardo Committed by Automerger Merge Worker
Browse files

Merge "Use final constants for note taking experience" into udc-dev am: bc8ba5a6

parents 71d460bc bc8ba5a6
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ constructor(
    private val roleManager: RoleManager,
    private val packageManager: PackageManager,
) {

    fun resolveInfo(
        entryPoint: NoteTaskEntryPoint? = null,
        isInMultiWindowMode: Boolean = false,
@@ -38,7 +39,8 @@ constructor(
    ): NoteTaskInfo? {
        // TODO(b/267634412): Select UserHandle depending on where the user initiated note-taking.
        val user = context.user
        val packageName = roleManager.getRoleHoldersAsUser(ROLE_NOTES, user).firstOrNull()
        val packageName =
            roleManager.getRoleHoldersAsUser(RoleManager.ROLE_NOTES, user).firstOrNull()

        if (packageName.isNullOrEmpty()) return null

+2 −1
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.systemui.notetask

import android.view.KeyEvent
import androidx.annotation.VisibleForTesting
import com.android.systemui.statusbar.CommandQueue
import com.android.wm.shell.bubbles.Bubbles
@@ -35,7 +36,7 @@ constructor(
    val callbacks =
        object : CommandQueue.Callbacks {
            override fun handleSystemKey(keyCode: Int) {
                if (keyCode == NoteTaskController.NOTE_TASK_KEY_EVENT) {
                if (keyCode == KeyEvent.KEYCODE_STYLUS_BUTTON_TAIL) {
                    controller.showNoteTask(NoteTaskEntryPoint.TAIL_BUTTON)
                }
            }
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ interface NoteTaskModule {
            featureFlags: FeatureFlags,
            roleManager: RoleManager,
        ): Boolean {
            val isRoleAvailable = roleManager.isRoleAvailable(NoteTaskInfoResolver.ROLE_NOTES)
            val isRoleAvailable = roleManager.isRoleAvailable(RoleManager.ROLE_NOTES)
            val isFeatureEnabled = featureFlags.isEnabled(Flags.NOTE_TASKS)
            return isRoleAvailable && isFeatureEnabled
        }
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ constructor(
            return Intent(context, LaunchNoteTaskActivity::class.java).apply {
                // Intent's action must be set in shortcuts, or an exception will be thrown.
                // TODO(b/254606432): Use Intent.ACTION_CREATE_NOTE instead.
                action = NoteTaskController.ACTION_CREATE_NOTE
                action = Intent.ACTION_CREATE_NOTE
            }
        }
    }
+6 −7
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.os.UserManager
import androidx.test.filters.SmallTest
import androidx.test.runner.AndroidJUnit4
import com.android.systemui.SysuiTestCase
import com.android.systemui.notetask.NoteTaskController.Companion.INTENT_EXTRA_USE_STYLUS_MODE
import com.android.systemui.notetask.shortcut.CreateNoteTaskShortcutActivity
import com.android.systemui.settings.UserTracker
import com.android.systemui.util.mockito.any
@@ -228,10 +227,10 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
        val intentCaptor = argumentCaptor<Intent>()
        verify(context).startActivity(capture(intentCaptor))
        intentCaptor.value.let { intent ->
            assertThat(intent.action).isEqualTo(NoteTaskController.ACTION_CREATE_NOTE)
            assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE)
            assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME)
            assertThat(intent.flags).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK)
            assertThat(intent.getBooleanExtra(INTENT_EXTRA_USE_STYLUS_MODE, false)).isTrue()
            assertThat(intent.getBooleanExtra(Intent.EXTRA_USE_STYLUS_MODE, false)).isTrue()
        }
        verify(eventLogger).logNoteTaskOpened(expectedInfo)
        verifyZeroInteractions(bubbles)
@@ -258,10 +257,10 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
        val intentCaptor = argumentCaptor<Intent>()
        verify(bubbles).showOrHideAppBubble(capture(intentCaptor))
        intentCaptor.value.let { intent ->
            assertThat(intent.action).isEqualTo(NoteTaskController.ACTION_CREATE_NOTE)
            assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE)
            assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME)
            assertThat(intent.flags).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK)
            assertThat(intent.getBooleanExtra(INTENT_EXTRA_USE_STYLUS_MODE, false)).isTrue()
            assertThat(intent.getBooleanExtra(Intent.EXTRA_USE_STYLUS_MODE, false)).isTrue()
        }
        verifyZeroInteractions(eventLogger)
    }
@@ -286,10 +285,10 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
        val intentCaptor = argumentCaptor<Intent>()
        verify(context).startActivity(capture(intentCaptor))
        intentCaptor.value.let { intent ->
            assertThat(intent.action).isEqualTo(NoteTaskController.ACTION_CREATE_NOTE)
            assertThat(intent.action).isEqualTo(Intent.ACTION_CREATE_NOTE)
            assertThat(intent.`package`).isEqualTo(NOTES_PACKAGE_NAME)
            assertThat(intent.flags).isEqualTo(Intent.FLAG_ACTIVITY_NEW_TASK)
            assertThat(intent.getBooleanExtra(INTENT_EXTRA_USE_STYLUS_MODE, false)).isTrue()
            assertThat(intent.getBooleanExtra(Intent.EXTRA_USE_STYLUS_MODE, false)).isTrue()
        }
        verify(eventLogger).logNoteTaskOpened(expectedInfo)
        verifyZeroInteractions(bubbles)
Loading