搜索

430

主题

515

帖子

2102

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
2102
QQ
发表于 2020-9-27 13:53:35 4785 浏览 0 回复

MT6761/6762,首次开机或恢复出厂设置,来短信消息..


[DESCRIPTION]

手机恢复出厂设置后,接收短信不会提示音,只有等来电后,来电提示音响后,再接收短信,提示音会恢复正常。
或等开机完后等一段时间,或开机完后手动灭屏再亮屏、或当重启机器后也会恢复正常。

[SOLUTION]
当恢复出厂设置后, mDisableNotificationEffects 为true,导致了不发出通知音。
而 mDisableNotificationEffects 设置为true是google代码中专门设置的,并且是灭屏上锁的时候 mDisableNotificationEffects 才会改变为false
因此这就是Google的原始设计,且不影响用户使用,不建议做修改,以免引起其他问题。

/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
  1. // TODO: All tests should use this init instead of the one-off setters above.
  2. 1599 @VisibleForTesting
  3. 1600 void init(Looper looper, IPackageManager packageManager,
  4. 1601 PackageManager packageManagerClient,
  5. 1602 LightsManager lightsManager, NotificationListeners notificationListeners,
  6. 1603 NotificationAssistants notificationAssistants, ConditionProviders conditionProviders,
  7. 1604 ICompanionDeviceManager companionManager, SnoozeHelper snoozeHelper,
  8. 1605 NotificationUsageStats usageStats, AtomicFile policyFile,
  9. 1606 ActivityManager activityManager, GroupHelper groupHelper, IActivityManager am,
  10. 1607 UsageStatsManagerInternal appUsageStats, DevicePolicyManagerInternal dpm,
  11. 1608 IUriGrantsManager ugm, UriGrantsManagerInternal ugmInternal, AppOpsManager appOps,
  12. 1609 UserManager userManager) {
  13. 1610 Resources resources = getContext().getResources();
  14. ......

  15. 1490 // Don't start allowing notifications until the setup wizard has run once.
  16. 1491 // After that, including subsequent boots, init with notifications turned on.
  17. 1492 // This works on the first boot because the setup wizard will toggle this
  18. 1493 // flag at least once and we'll go back to 0 after that.
  19. 1494 if (0 == Settings.Global.getInt(getContext().getContentResolver(),
  20. 1495 Settings.Global.DEVICE_PROVISIONED, 0)) {
  21. 1496 mDisableNotificationEffects = true;
  22. 1497 }


  23. 751 @VisibleForTesting
  24. 752 final NotificationDelegate mNotificationDelegate = new NotificationDelegate() {
  25. 753
  26. 754 @Override
  27. 755 public void onSetDisabled(int status) {
  28. 756 synchronized (mNotificationLock) {
  29. 757 mDisableNotificationEffects =
  30. 758 (status & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
  31. 759 if (disableNotificationEffects(null) != null) {
  32. 760 // cancel whatever's going on
  33. 761 long identity = Binder.clearCallingIdentity();
  34. 762 try {
  35. 763 final IRingtonePlayer player = mAudioManager.getRingtonePlayer();
  36. 764 if (player != null) {
  37. 765 player.stopAsync();
  38. 766 }
  39. 767 } catch (RemoteException e) {
  40. 768 } finally {
  41. 769 Binder.restoreCallingIdentity(identity);
  42. 770 }
  43. 771
  44. 772 identity = Binder.clearCallingIdentity();
  45. 773 try {
  46. 774 mVibrator.cancel();
  47. 775 } finally {
  48. 776 Binder.restoreCallingIdentity(identity);
  49. 777 }
  50. 778 }
  51. 779 }
  52. 780 }


  53. 在 shouldMuteNotificationLocked 方法中,如下// muted by listener返回true了
  54. 5859 @GuardedBy("mNotificationLock")
  55. 5860 boolean shouldMuteNotificationLocked(final NotificationRecord record) {
  56. 5861 // Suppressed because it's a silent update
  57. 5862 final Notification notification = record.getNotification();
  58. 5863 if (record.isUpdate && (notification.flags & FLAG_ONLY_ALERT_ONCE) != 0) {
  59. 5864 return true;
  60. 5865 }
  61. 5866
  62. 5867 // muted by listener
  63. 5868 final String disableEffects = disableNotificationEffects(record);
  64. 5869 if (disableEffects != null) {
  65. 5870 ZenLog.traceDisableEffects(record, disableEffects);
  66. 5871 return true;
  67. 5872 }
  68. 5873
  69. 5874 // suppressed due to DND
  70. 5875 if (record.isIntercepted()) {
  71. 5876 return true;
  72. 5877 }
  73. 5878
  74. 5879 // Suppressed because another notification in its group handles alerting
  75. 5880 if (record.sbn.isGroup()) {
  76. 5881 if (notification.suppressAlertingDueToGrouping()) {
  77. 5882 return true;
  78. 5883 }
  79. 5884 }
  80. 5885
  81. 5886 // Suppressed for being too recently noisy
  82. 5887 final String pkg = record.sbn.getPackageName();
  83. 5888 if (mUsageStats.isAlertRateLimited(pkg)) {
  84. 5889 Slog.e(TAG, "Muting recently noisy " + record.getKey());
  85. 5890 return true;
  86. 5891 }
  87. 5892
  88. 5893 return false;
  89. 5894 }


  90. 3705 private String disableNotificationEffects(NotificationRecord record) {
  91. 3706 if (mDisableNotificationEffects) {
  92. 3707 return "booleanState";
  93. 3708 }
  94. 3709 if ((mListenerHints & HINT_HOST_DISABLE_EFFECTS) != 0) {
  95. 3710 return "listenerHints";
  96. 3711 }
  97. 3712 if (mCallState != TelephonyManager.CALL_STATE_IDLE && !mZenModeHelper.isCall(record)) {
  98. 3713 return "callState";
  99. 3714 }
  100. 3715 return null;
  101. 3716 };
复制代码




手机微信同号:13682654092
回复

使用道具 举报

返回列表
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则


登录或注册
快速回复 返回顶部 返回列表