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

Commit 548000b4 authored by Marcello Galhardo's avatar Marcello Galhardo Committed by Android Build Coastguard Worker
Browse files

Force disable Note Task Shortcut

* Shortcut won't be enabled until additional features are implemented.
* Once the features are completed, the CL will be reverted.

Test: atest NoteTaskControllerTest
Flag: NONE
Bug: b/316332684
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:5bb3a0dc231c31e937dcb43251bb611fd59027aa)
Merged-In: I605cdf9452469b448a6c6443ee41f5dc00a64226
Change-Id: I605cdf9452469b448a6c6443ee41f5dc00a64226
parent 2e1d6c23
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -263,7 +263,11 @@ constructor(
     * If the shortcut entry `android:enabled` is set to `true`, the shortcut will be visible in the
     * If the shortcut entry `android:enabled` is set to `true`, the shortcut will be visible in the
     * Widget Picker to all users.
     * Widget Picker to all users.
     */
     */
    // TODO(b/316332684)
    @Suppress("UNREACHABLE_CODE")
    fun setNoteTaskShortcutEnabled(value: Boolean, user: UserHandle) {
    fun setNoteTaskShortcutEnabled(value: Boolean, user: UserHandle) {
        return // shortcut should not be enabled until additional features are implemented.

        if (!userManager.isUserUnlocked(user)) {
        if (!userManager.isUserUnlocked(user)) {
            debugLog { "setNoteTaskShortcutEnabled call but user locked: user=$user" }
            debugLog { "setNoteTaskShortcutEnabled call but user locked: user=$user" }
            return
            return
+8 −0
Original line number Original line Diff line number Diff line
@@ -75,6 +75,7 @@ import kotlinx.coroutines.test.TestScope
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.UnconfinedTestDispatcher
import kotlinx.coroutines.test.runCurrent
import kotlinx.coroutines.test.runCurrent
import org.junit.Before
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.anyInt
import org.mockito.ArgumentMatchers.anyInt
@@ -462,6 +463,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {


    // region setNoteTaskShortcutEnabled
    // region setNoteTaskShortcutEnabled
    @Test
    @Test
    @Ignore("b/316332684")
    fun setNoteTaskShortcutEnabled_setTrue() {
    fun setNoteTaskShortcutEnabled_setTrue() {
        createNoteTaskController().setNoteTaskShortcutEnabled(value = true, userTracker.userHandle)
        createNoteTaskController().setNoteTaskShortcutEnabled(value = true, userTracker.userHandle)


@@ -478,6 +480,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @Ignore("b/316332684")
    fun setNoteTaskShortcutEnabled_setFalse() {
    fun setNoteTaskShortcutEnabled_setFalse() {
        createNoteTaskController().setNoteTaskShortcutEnabled(value = false, userTracker.userHandle)
        createNoteTaskController().setNoteTaskShortcutEnabled(value = false, userTracker.userHandle)


@@ -494,6 +497,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @Ignore("b/316332684")
    fun setNoteTaskShortcutEnabled_workProfileUser_setTrue() {
    fun setNoteTaskShortcutEnabled_workProfileUser_setTrue() {
        whenever(context.createContextAsUser(eq(workUserInfo.userHandle), any()))
        whenever(context.createContextAsUser(eq(workUserInfo.userHandle), any()))
            .thenReturn(workProfileContext)
            .thenReturn(workProfileContext)
@@ -515,6 +519,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @Ignore("b/316332684")
    fun setNoteTaskShortcutEnabled_workProfileUser_setFalse() {
    fun setNoteTaskShortcutEnabled_workProfileUser_setFalse() {
        whenever(context.createContextAsUser(eq(workUserInfo.userHandle), any()))
        whenever(context.createContextAsUser(eq(workUserInfo.userHandle), any()))
            .thenReturn(workProfileContext)
            .thenReturn(workProfileContext)
@@ -733,6 +738,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {


    // region internalUpdateNoteTaskAsUser
    // region internalUpdateNoteTaskAsUser
    @Test
    @Test
    @Ignore("b/316332684")
    fun updateNoteTaskAsUserInternal_withNotesRole_withShortcuts_shouldUpdateShortcuts() {
    fun updateNoteTaskAsUserInternal_withNotesRole_withShortcuts_shouldUpdateShortcuts() {
        createNoteTaskController(isEnabled = true)
        createNoteTaskController(isEnabled = true)
            .launchUpdateNoteTaskAsUser(userTracker.userHandle)
            .launchUpdateNoteTaskAsUser(userTracker.userHandle)
@@ -766,6 +772,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @Ignore("b/316332684")
    fun updateNoteTaskAsUserInternal_noNotesRole_shouldDisableShortcuts() {
    fun updateNoteTaskAsUserInternal_noNotesRole_shouldDisableShortcuts() {
        whenever(roleManager.getRoleHoldersAsUser(ROLE_NOTES, userTracker.userHandle))
        whenever(roleManager.getRoleHoldersAsUser(ROLE_NOTES, userTracker.userHandle))
            .thenReturn(emptyList())
            .thenReturn(emptyList())
@@ -789,6 +796,7 @@ internal class NoteTaskControllerTest : SysuiTestCase() {
    }
    }


    @Test
    @Test
    @Ignore("b/316332684")
    fun updateNoteTaskAsUserInternal_flagDisabled_shouldDisableShortcuts() {
    fun updateNoteTaskAsUserInternal_flagDisabled_shouldDisableShortcuts() {
        createNoteTaskController(isEnabled = false)
        createNoteTaskController(isEnabled = false)
            .launchUpdateNoteTaskAsUser(userTracker.userHandle)
            .launchUpdateNoteTaskAsUser(userTracker.userHandle)