Skip to content

fix(widget): open the tapped note from the note list widget - #3380

Open
mark99i wants to merge 1 commit into
nextcloud:mainfrom
mark99i:fix-open-note-on-click-widget
Open

mark99i wants to merge 1 commit into
nextcloud:mainfrom
mark99i:fix-open-note-on-click-widget

Conversation

@mark99i

@mark99i mark99i commented Oct 8, 2026 •

Copy link
Copy Markdown

The note list widget used WidgetUtil.pendingIntentFlagCompat() for its PendingIntent template, which adds FLAG_IMMUTABLE on Android 14+ (API 34+). An immutable PendingIntent cannot be modified at send time, so the per-item fill-in intent carrying the note id was discarded and EditNoteActivity received an intent without PARAM_NOTE_ID, falling back to creating a new note instead of opening the tapped one.

Use FLAG_MUTABLE explicitly (as SingleNoteWidget already does) so the fill-in intent with the note id is applied, and use the appWidgetId as PendingIntent request code so widget instances no longer share one PendingIntent.

Affected devices: Android 14 and newer (API 34+). On Android 12-13 pendingIntentFlagCompat() returned FLAG_MUTABLE and on Android 11 and below no flag was added, so the fill-in intent worked there.

Partically closes: #3168, #2805

AI-assistant: Cline Extension 1.x (GLM-5.3)

🖼️ Screenshots

🏚️ Before 🏡 After
B A

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@mark99i

mark99i commented Oct 14, 2026

Copy link
Copy Markdown
Author

Hi guys
@AndyScherzinger , @alperozturk96 , @daniele-verducci @tobiasKaminskycan
someone see this one and my two small ones pullrequest?
Thanks

@alperozturk96 alperozturk96 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, thank you for the PR. I cannot launch app, I'm getting following error:

Process: it.niedermann.owncloud.notes.dev, PID: 24532
java.lang.RuntimeException: Unable to start receiver it.niedermann.owncloud.notes.widget.notelist.NoteListWidget
at android.app.ActivityThread.handleReceiver(ActivityThread.java: 5670)
at android.app.ActivityThread. - $$Nest$mhandleReceiver(ActivityThread.java: 0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java: 2708)
at android.os.Handler.dispatchMessageImpl(Handler.java: 142)
at android.os.Handler.dispatchMessage(Handler.java: 126)
at android.os.Looper.loopOnce(Looper.java: 285)
at android.os.Looper.loop(Looper.java: 390)
at android.app.ActivityThread.main(ActivityThread.java: 9884)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java: 575)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java: 906)
Caused by: java.lang.IllegalArgumentException: Cannot set both FLAG_IMMUTABLE and FLAG_MUTABLE
for PendingIntent
at android.app.PendingIntent.checkPendingIntent(PendingIntent.java: 450)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java: 579)
at android.app.PendingIntent.getActivity(PendingIntent.java: 564)
at android.app.PendingIntent.getActivity(PendingIntent.java: 528)
at it.niedermann.owncloud.notes.widget.notelist.NoteListWidget$Companion.updateAppWidget(NoteListWidget.kt: 103)
at it.niedermann.owncloud.notes.widget.notelist.NoteListWidget.onUpdate(NoteListWidget.kt: 36)
at android.appwidget.AppWidgetProvider.onReceive(AppWidgetProvider.java: 71)
at it.niedermann.owncloud.notes.widget.notelist.NoteListWidget.onReceive(NoteListWidget.kt: 40)
at android.app.ActivityThread.handleReceiver(ActivityThread.java: 5663)
    ...10 more

@mark99i

mark99i commented Oct 14, 2026 •

Copy link
Copy Markdown
Author

Hello, thank you for the PR. I cannot launch app, I'm getting following error:

@alperozturk96
I can’t reproduce your problem; these two flags are never combined in the code.
Can you check that you have exactly the same code in your working directory as the one I proposed in the PR?

What Android API version you try start?

The note list widget used WidgetUtil.pendingIntentFlagCompat() for its
PendingIntent template, which adds FLAG_IMMUTABLE on Android 14+ (API 34+).
An immutable PendingIntent cannot be modified at send time, so the
per-item fill-in intent carrying the note id was discarded and
EditNoteActivity received an intent without PARAM_NOTE_ID, falling back
to creating a new note instead of opening the tapped one.

Use FLAG_MUTABLE explicitly (as SingleNoteWidget already does) so the
fill-in intent with the note id is applied, and use the appWidgetId as
PendingIntent request code so widget instances no longer share one
PendingIntent.

Affected devices: Android 14 and newer (API 34+). On Android 12-13
pendingIntentFlagCompat() returned FLAG_MUTABLE and on Android 11 and
below no flag was added, so the fill-in intent worked there.

AI-assistant: Cline Extension 1.x (GLM-5.3)
Signed-off-by: Mark <mark-smirnow@yandex.ru>
@alperozturk96
alperozturk96 force-pushed the fix-open-note-on-click-widget branch from a58b9ea to dba83ca Compare October 15, 2026 09:06
@alperozturk96

alperozturk96 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Hello, thank you for the PR. I cannot launch app, I'm getting following error:

@alperozturk96 I can’t reproduce your problem; these two flags are never combined in the code. Can you check that you have exactly the same code in your working directory as the one I proposed in the PR?

What Android API version you try start?

  1. Previous version installed
  2. Have a widget
  3. Check out this branch
  4. Crash

but I tried again and can't able to reproduce as well. @daniele-verducci can you also try?

alperozturk96 pushed a commit to mark99i/notes-android that referenced this pull request Oct 15, 2026
Restore the widget header row that was removed in a78ee27: the first
scrollable entry of the note list widget shows the widget context title
(app name, favorites or category) with a create note button.

- tapping the title opens the app
- tapping the + button creates a new note in the widget category
- the + icon is tinted with the account color when the contrast is
  sufficient
- widget_entry_add.xml: cleaned up legacy paddings and hardcoded sizes,
  fixed content description of the create button
- restore the widget_create_note string

Click handling relies on the pending intent template being mutable,
which is fixed in nextcloud#3380. Merge that PR first (or together).

AI-assistant: Cline Extension 1.x (GLM-5.3)
Signed-off-by: Mark <mark-smirnow@yandex.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Widget issues

2 participants