Repository navigation
Commit 1c89b68
feat(messaging,android): improve how messaging is determining permission on Android (#18101)
* feat(messaging,android): improve how messaging is determining permission on Android
* format
* format
* fix(messaging,android): harden notification permission status resolution
Use PackageManager permission flags instead of SharedPreferences so soft
deny, permanent deny, and never-asked are distinguished correctly even when
another plugin requested POST_NOTIFICATIONS. Add AuthorizationStatus.deniedPermanently
and reset Android 13+ e2e permission state between tests.
* fix(messaging): use local functions in Android permission e2e helpers
Getters are not valid inside the group() callback body, which broke
dart analyze in the tests package.
* fix(messaging,android): resolve permission status without hidden platform APIs
PackageManager.getPermissionFlags() and the FLAG_PERMISSION_USER_SET /
FLAG_PERMISSION_USER_FIXED constants are @hide/@Systemapi and are not part of
the public SDK at any API level, so the plugin failed to compile.
Resolve the status with public API instead: shouldShowRequestPermissionRationale()
plus a SharedPreferences record of whether the prompt was ever shown. The flag is
written when the permission is requested rather than only on denial, so a grant
followed by a revoke from system settings still reports deniedPermanently.
Also clear that record from the e2e permission reset helper so "never asked" is
reproducible across tests, and fix a google-java-format violation.
* fix(messaging,test): grant Android permission e2e helpers without instrumentation
flutter test launches the example app without UiAutomation, so CI could not
reset or grant POST_NOTIFICATIONS. Fall back to the host adb server from the
emulator and fix google-java-format / ktfmt.
---------
Co-authored-by: Jude Kwashie <judekwashie70@gmail.com>1 parent 6d48e7c commit 1c89b68
9 files changed
Lines changed: 767 additions & 11 deletions
File tree
- packages/firebase_messaging
- firebase_messaging_platform_interface
- lib/src
- test
- method_channel_tests
- firebase_messaging
- android/src/main/java/io/flutter/plugins/firebase/messaging
- example
- android/app/src/main/kotlin/io/flutter/plugins/firebase/messaging/example
- integration_test
- lib
- tests/android/app/src/main/kotlin/io/flutter/plugins/firebase/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
| |||
17 | 19 | | |
18 | 20 | | |
19 | 21 | | |
| 22 | + | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| |||
373 | 376 | | |
374 | 377 | | |
375 | 378 | | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
376 | 389 | | |
377 | 390 | | |
378 | 391 | | |
| |||
385 | 398 | | |
386 | 399 | | |
387 | 400 | | |
388 | | - | |
389 | | - | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
390 | 413 | | |
391 | 414 | | |
392 | 415 | | |
393 | 416 | | |
394 | 417 | | |
395 | | - | |
| 418 | + | |
396 | 419 | | |
397 | 420 | | |
398 | 421 | | |
| |||
411 | 434 | | |
412 | 435 | | |
413 | 436 | | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
414 | 489 | | |
415 | 490 | | |
416 | 491 | | |
417 | 492 | | |
418 | 493 | | |
419 | 494 | | |
420 | 495 | | |
421 | | - | |
422 | 496 | | |
423 | | - | |
| 497 | + | |
424 | 498 | | |
425 | | - | |
426 | | - | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
427 | 504 | | |
428 | | - | |
429 | 505 | | |
430 | 506 | | |
431 | 507 | | |
| |||
0 commit comments