Loading packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ <queries> <intent> <action android:name="android.intent.action.NOTES" /> <action android:name="android.intent.action.CREATE_NOTE" /> </intent> </queries> Loading packages/SystemUI/src/com/android/systemui/notetask/NoteTaskController.kt +5 −0 Original line number Diff line number Diff line Loading @@ -104,4 +104,9 @@ constructor( PackageManager.DONT_KILL_APP, ) } companion object { // TODO(b/254604589): Use final KeyEvent.KEYCODE_* instead. const val NOTE_TASK_KEY_EVENT = 311 } } packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ 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 Loading @@ -37,7 +36,7 @@ constructor( val callbacks = object : CommandQueue.Callbacks { override fun handleSystemKey(keyCode: Int) { if (keyCode == KeyEvent.KEYCODE_VIDEO_APP_1) { if (keyCode == NoteTaskController.NOTE_TASK_KEY_EVENT) { noteTaskController.showNoteTask() } } Loading packages/SystemUI/src/com/android/systemui/notetask/NoteTaskIntentResolver.kt +10 −9 Original line number Diff line number Diff line Loading @@ -21,12 +21,12 @@ import android.content.Intent import android.content.pm.ActivityInfo import android.content.pm.PackageManager import android.content.pm.PackageManager.ResolveInfoFlags import com.android.systemui.notetask.NoteTaskIntentResolver.Companion.NOTES_ACTION import com.android.systemui.notetask.NoteTaskIntentResolver.Companion.ACTION_CREATE_NOTE import javax.inject.Inject /** * Class responsible to query all apps and find one that can handle the [NOTES_ACTION]. If found, an * [Intent] ready for be launched will be returned. Otherwise, returns null. * Class responsible to query all apps and find one that can handle the [ACTION_CREATE_NOTE]. If * found, an [Intent] ready for be launched will be returned. Otherwise, returns null. * * TODO(b/248274123): should be revisited once the notes role is implemented. */ Loading @@ -37,15 +37,16 @@ constructor( ) { fun resolveIntent(): Intent? { val intent = Intent(NOTES_ACTION) val intent = Intent(ACTION_CREATE_NOTE) val flags = ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()) val infoList = packageManager.queryIntentActivities(intent, flags) for (info in infoList) { val packageName = info.serviceInfo.applicationInfo.packageName ?: continue val packageName = info.activityInfo.applicationInfo.packageName ?: continue val activityName = resolveActivityNameForNotesAction(packageName) ?: continue return Intent(NOTES_ACTION) return Intent(ACTION_CREATE_NOTE) .setPackage(packageName) .setComponent(ComponentName(packageName, activityName)) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } Loading @@ -54,7 +55,7 @@ constructor( } private fun resolveActivityNameForNotesAction(packageName: String): String? { val intent = Intent(NOTES_ACTION).setPackage(packageName) val intent = Intent(ACTION_CREATE_NOTE).setPackage(packageName) val flags = ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()) val resolveInfo = packageManager.resolveActivity(intent, flags) Loading @@ -69,8 +70,8 @@ constructor( } companion object { // TODO(b/254606432): Use Intent.ACTION_NOTES and Intent.ACTION_NOTES_LOCKED instead. const val NOTES_ACTION = "android.intent.action.NOTES" // TODO(b/254606432): Use Intent.ACTION_CREATE_NOTE instead. const val ACTION_CREATE_NOTE = "android.intent.action.CREATE_NOTE" } } Loading packages/SystemUI/src/com/android/systemui/notetask/shortcut/LaunchNoteTaskActivity.kt +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ constructor( fun newIntent(context: Context): Intent { 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_NOTES instead. action = NoteTaskIntentResolver.NOTES_ACTION // TODO(b/254606432): Use Intent.ACTION_CREATE_NOTE instead. action = NoteTaskIntentResolver.ACTION_CREATE_NOTE } } } Loading Loading
packages/SystemUI/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -292,7 +292,7 @@ <queries> <intent> <action android:name="android.intent.action.NOTES" /> <action android:name="android.intent.action.CREATE_NOTE" /> </intent> </queries> Loading
packages/SystemUI/src/com/android/systemui/notetask/NoteTaskController.kt +5 −0 Original line number Diff line number Diff line Loading @@ -104,4 +104,9 @@ constructor( PackageManager.DONT_KILL_APP, ) } companion object { // TODO(b/254604589): Use final KeyEvent.KEYCODE_* instead. const val NOTE_TASK_KEY_EVENT = 311 } }
packages/SystemUI/src/com/android/systemui/notetask/NoteTaskInitializer.kt +1 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ 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 Loading @@ -37,7 +36,7 @@ constructor( val callbacks = object : CommandQueue.Callbacks { override fun handleSystemKey(keyCode: Int) { if (keyCode == KeyEvent.KEYCODE_VIDEO_APP_1) { if (keyCode == NoteTaskController.NOTE_TASK_KEY_EVENT) { noteTaskController.showNoteTask() } } Loading
packages/SystemUI/src/com/android/systemui/notetask/NoteTaskIntentResolver.kt +10 −9 Original line number Diff line number Diff line Loading @@ -21,12 +21,12 @@ import android.content.Intent import android.content.pm.ActivityInfo import android.content.pm.PackageManager import android.content.pm.PackageManager.ResolveInfoFlags import com.android.systemui.notetask.NoteTaskIntentResolver.Companion.NOTES_ACTION import com.android.systemui.notetask.NoteTaskIntentResolver.Companion.ACTION_CREATE_NOTE import javax.inject.Inject /** * Class responsible to query all apps and find one that can handle the [NOTES_ACTION]. If found, an * [Intent] ready for be launched will be returned. Otherwise, returns null. * Class responsible to query all apps and find one that can handle the [ACTION_CREATE_NOTE]. If * found, an [Intent] ready for be launched will be returned. Otherwise, returns null. * * TODO(b/248274123): should be revisited once the notes role is implemented. */ Loading @@ -37,15 +37,16 @@ constructor( ) { fun resolveIntent(): Intent? { val intent = Intent(NOTES_ACTION) val intent = Intent(ACTION_CREATE_NOTE) val flags = ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()) val infoList = packageManager.queryIntentActivities(intent, flags) for (info in infoList) { val packageName = info.serviceInfo.applicationInfo.packageName ?: continue val packageName = info.activityInfo.applicationInfo.packageName ?: continue val activityName = resolveActivityNameForNotesAction(packageName) ?: continue return Intent(NOTES_ACTION) return Intent(ACTION_CREATE_NOTE) .setPackage(packageName) .setComponent(ComponentName(packageName, activityName)) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) } Loading @@ -54,7 +55,7 @@ constructor( } private fun resolveActivityNameForNotesAction(packageName: String): String? { val intent = Intent(NOTES_ACTION).setPackage(packageName) val intent = Intent(ACTION_CREATE_NOTE).setPackage(packageName) val flags = ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY.toLong()) val resolveInfo = packageManager.resolveActivity(intent, flags) Loading @@ -69,8 +70,8 @@ constructor( } companion object { // TODO(b/254606432): Use Intent.ACTION_NOTES and Intent.ACTION_NOTES_LOCKED instead. const val NOTES_ACTION = "android.intent.action.NOTES" // TODO(b/254606432): Use Intent.ACTION_CREATE_NOTE instead. const val ACTION_CREATE_NOTE = "android.intent.action.CREATE_NOTE" } } Loading
packages/SystemUI/src/com/android/systemui/notetask/shortcut/LaunchNoteTaskActivity.kt +2 −2 Original line number Diff line number Diff line Loading @@ -45,8 +45,8 @@ constructor( fun newIntent(context: Context): Intent { 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_NOTES instead. action = NoteTaskIntentResolver.NOTES_ACTION // TODO(b/254606432): Use Intent.ACTION_CREATE_NOTE instead. action = NoteTaskIntentResolver.ACTION_CREATE_NOTE } } } Loading