Merge "Remove hardcoded constants" into udc-dev

This commit is contained in:
Marcello Galhardo
2023-03-08 18:00:43 +00:00
committed by Android (Google) Code Review
3 changed files with 4 additions and 16 deletions

View File

@@ -187,25 +187,16 @@ constructor(
companion object {
val TAG = NoteTaskController::class.simpleName.orEmpty()
// TODO(b/254604589): Use final KeyEvent.KEYCODE_* instead.
const val NOTE_TASK_KEY_EVENT = 311
// TODO(b/265912743): Use Intent.ACTION_CREATE_NOTE instead.
const val ACTION_CREATE_NOTE = "android.intent.action.CREATE_NOTE"
// TODO(b/265912743): Use Intent.INTENT_EXTRA_USE_STYLUS_MODE instead.
const val INTENT_EXTRA_USE_STYLUS_MODE = "android.intent.extra.USE_STYLUS_MODE"
}
}
private fun createNoteIntent(info: NoteTaskInfo): Intent =
Intent(NoteTaskController.ACTION_CREATE_NOTE).apply {
Intent(Intent.ACTION_CREATE_NOTE).apply {
setPackage(info.packageName)
// EXTRA_USE_STYLUS_MODE does not mean a stylus is in-use, but a stylus entrypoint
// was used to start it.
putExtra(NoteTaskController.INTENT_EXTRA_USE_STYLUS_MODE, true)
putExtra(Intent.EXTRA_USE_STYLUS_MODE, true)
addFlags(FLAG_ACTIVITY_NEW_TASK)
// We should ensure the note experience can be open both as a full screen (lock screen)

View File

@@ -56,9 +56,6 @@ constructor(
companion object {
private val TAG = NoteTaskInfoResolver::class.simpleName.orEmpty()
// TODO(b/265912743): Use RoleManager.NOTES_ROLE instead.
const val ROLE_NOTES = "android.app.role.NOTES"
private val EMPTY_APPLICATION_INFO_FLAGS = ApplicationInfoFlags.of(0)!!
/**

View File

@@ -454,7 +454,7 @@ 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(FLAG_ACTIVITY_NEW_TASK)
assertThat(intent.getBooleanExtra(Intent.EXTRA_USE_STYLUS_MODE, false)).isTrue()
@@ -481,7 +481,7 @@ 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(FLAG_ACTIVITY_NEW_TASK)
assertThat(intent.getBooleanExtra(Intent.EXTRA_USE_STYLUS_MODE, false)).isTrue()