diff --git a/AndroidManifest.xml b/AndroidManifest.xml index dd0999772c0..a95afc9eff3 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4875,7 +4875,7 @@ android:excludeFromRecents="true" android:resizeableActivity="false" android:theme="@android:style/Theme.NoDisplay" - android:label="@string/note_task_button_label" + android:label="@string/note_task_shortcut_label" android:icon="@drawable/ic_note_task_shortcut_widget"> diff --git a/res/drawable/ic_note_task_shortcut_widget.xml b/res/drawable/ic_note_task_shortcut_widget.xml index e37c22ad8f8..ce1f51ad319 100644 --- a/res/drawable/ic_note_task_shortcut_widget.xml +++ b/res/drawable/ic_note_task_shortcut_widget.xml @@ -14,18 +14,20 @@ ~ limitations under the License. --> - - - + android:width="48dp" + android:height="48dp" + android:viewportWidth="48" + android:viewportHeight="48"> + + + + + + + \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 028b731dd30..2a891c892df 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -12058,5 +12058,5 @@ "This app can only be opened in 1 window" - Notetaking + Note shortcut diff --git a/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt b/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt index b9846226df6..d3d751063b3 100644 --- a/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt +++ b/src/com/android/settings/notetask/shortcut/CreateNoteTaskShortcutActivity.kt @@ -37,6 +37,11 @@ import com.android.settings.R * shortcut will appear in the widget picker. If the shortcut is selected, the Activity here will be * launched, creating a new shortcut for [CreateNoteTaskShortcutActivity], and will finish. * + * IMPORTANT! The shortcut package name and class should be synchronized with SystemUI controller: + * [com.android.systemui.notetask.NoteTaskController#SETTINGS_CREATE_NOTE_TASK_SHORTCUT_COMPONENT]. + * + * Changing the package name or class is a breaking change. + * * @see Creating * a custom shortcut activity @@ -81,9 +86,16 @@ internal class CreateNoteTaskShortcutActivity : ComponentActivity() { setPackage(systemUiComponent.packageName) } - return ShortcutInfo.Builder(context, SHORTCUT_ID) + // Creates a System UI context. That will let the ownership with SystemUI and allows it + // to perform updates such as enabling or updating the badge override package. + val systemUiContext = context.createPackageContext( + systemUiComponent.packageName, + /* flags */ 0, + ) + + return ShortcutInfo.Builder(systemUiContext, SHORTCUT_ID) .setIntent(intent) - .setShortLabel(context.getString(R.string.note_task_button_label)) + .setShortLabel(context.getString(R.string.note_task_shortcut_label)) .setLongLived(true) .setIcon(icon) .setExtras(extras)