android12崩溃,PendingIntent标志位需要适配

Open
#147 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
android, java
Domain
mobile

Research direction

Start at DisplayService.java line 46, in DisplayService.onBlock, where the PendingIntent is created and the Android 12 stack trace originates. Read the surrounding notification flow and verify the PendingIntent flag behavior for apps targeting Android 12 or later. Done means the crash no longer occurs on that platform while the block notification still works.

Written by the indexing model from the issue text.

Description

java.lang.IllegalArgumentException: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
    at android.app.PendingIntent.checkFlags(PendingIntent.java:378)
    at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461)
    at android.app.PendingIntent.getActivity(PendingIntent.java:447)
    at android.app.PendingIntent.getActivity(PendingIntent.java:411)
    at com.github.moduth.blockcanary.DisplayService.onBlock(DisplayService.java:46)
    at com.github.moduth.blockcanary.BlockCanaryInternals$1.onBlockEvent(BlockCanaryInternals.java:67)
    at com.github.moduth.blockcanary.LooperMonitor$1.run(LooperMonitor.java:80)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:233)
    at android.os.Looper.loop(Looper.java:344)
    at android.os.HandlerThread.run(HandlerThread.java:67)
Dominant language
Java
Stars
6.7k
Forks
1k
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from markzhai/AndroidPerformanceMonitor

All issues in markzhai/AndroidPerformanceMonitor

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.