|
发表于 2020-9-27 13:53:35
8065 浏览 0 回复
MT6761/6762,首次开机或恢复出厂设置,来短信消息..
[DESCRIPTION]
手机恢复出厂设置后,接收短信不会提示音,只有等来电后,来电提示音响后,再接收短信,提示音会恢复正常。
或等开机完后等一段时间,或开机完后手动灭屏再亮屏、或当重启机器后也会恢复正常。
[SOLUTION]
当恢复出厂设置后, mDisableNotificationEffects 为true,导致了不发出通知音。
而 mDisableNotificationEffects 设置为true是google代码中专门设置的,并且是灭屏上锁的时候 mDisableNotificationEffects 才会改变为false
因此这就是Google的原始设计,且不影响用户使用,不建议做修改,以免引起其他问题。
/frameworks/base/services/core/java/com/android/server/notification/NotificationManagerService.java
- // TODO: All tests should use this init instead of the one-off setters above.
- 1599 @VisibleForTesting
- 1600 void init(Looper looper, IPackageManager packageManager,
- 1601 PackageManager packageManagerClient,
- 1602 LightsManager lightsManager, NotificationListeners notificationListeners,
- 1603 NotificationAssistants notificationAssistants, ConditionProviders conditionProviders,
- 1604 ICompanionDeviceManager companionManager, SnoozeHelper snoozeHelper,
- 1605 NotificationUsageStats usageStats, AtomicFile policyFile,
- 1606 ActivityManager activityManager, GroupHelper groupHelper, IActivityManager am,
- 1607 UsageStatsManagerInternal appUsageStats, DevicePolicyManagerInternal dpm,
- 1608 IUriGrantsManager ugm, UriGrantsManagerInternal ugmInternal, AppOpsManager appOps,
- 1609 UserManager userManager) {
- 1610 Resources resources = getContext().getResources();
- ......
- 1490 // Don't start allowing notifications until the setup wizard has run once.
- 1491 // After that, including subsequent boots, init with notifications turned on.
- 1492 // This works on the first boot because the setup wizard will toggle this
- 1493 // flag at least once and we'll go back to 0 after that.
- 1494 if (0 == Settings.Global.getInt(getContext().getContentResolver(),
- 1495 Settings.Global.DEVICE_PROVISIONED, 0)) {
- 1496 mDisableNotificationEffects = true;
- 1497 }
- 751 @VisibleForTesting
- 752 final NotificationDelegate mNotificationDelegate = new NotificationDelegate() {
- 753
- 754 @Override
- 755 public void onSetDisabled(int status) {
- 756 synchronized (mNotificationLock) {
- 757 mDisableNotificationEffects =
- 758 (status & StatusBarManager.DISABLE_NOTIFICATION_ALERTS) != 0;
- 759 if (disableNotificationEffects(null) != null) {
- 760 // cancel whatever's going on
- 761 long identity = Binder.clearCallingIdentity();
- 762 try {
- 763 final IRingtonePlayer player = mAudioManager.getRingtonePlayer();
- 764 if (player != null) {
- 765 player.stopAsync();
- 766 }
- 767 } catch (RemoteException e) {
- 768 } finally {
- 769 Binder.restoreCallingIdentity(identity);
- 770 }
- 771
- 772 identity = Binder.clearCallingIdentity();
- 773 try {
- 774 mVibrator.cancel();
- 775 } finally {
- 776 Binder.restoreCallingIdentity(identity);
- 777 }
- 778 }
- 779 }
- 780 }
- 在 shouldMuteNotificationLocked 方法中,如下// muted by listener返回true了
- 5859 @GuardedBy("mNotificationLock")
- 5860 boolean shouldMuteNotificationLocked(final NotificationRecord record) {
- 5861 // Suppressed because it's a silent update
- 5862 final Notification notification = record.getNotification();
- 5863 if (record.isUpdate && (notification.flags & FLAG_ONLY_ALERT_ONCE) != 0) {
- 5864 return true;
- 5865 }
- 5866
- 5867 // muted by listener
- 5868 final String disableEffects = disableNotificationEffects(record);
- 5869 if (disableEffects != null) {
- 5870 ZenLog.traceDisableEffects(record, disableEffects);
- 5871 return true;
- 5872 }
- 5873
- 5874 // suppressed due to DND
- 5875 if (record.isIntercepted()) {
- 5876 return true;
- 5877 }
- 5878
- 5879 // Suppressed because another notification in its group handles alerting
- 5880 if (record.sbn.isGroup()) {
- 5881 if (notification.suppressAlertingDueToGrouping()) {
- 5882 return true;
- 5883 }
- 5884 }
- 5885
- 5886 // Suppressed for being too recently noisy
- 5887 final String pkg = record.sbn.getPackageName();
- 5888 if (mUsageStats.isAlertRateLimited(pkg)) {
- 5889 Slog.e(TAG, "Muting recently noisy " + record.getKey());
- 5890 return true;
- 5891 }
- 5892
- 5893 return false;
- 5894 }
- 3705 private String disableNotificationEffects(NotificationRecord record) {
- 3706 if (mDisableNotificationEffects) {
- 3707 return "booleanState";
- 3708 }
- 3709 if ((mListenerHints & HINT_HOST_DISABLE_EFFECTS) != 0) {
- 3710 return "listenerHints";
- 3711 }
- 3712 if (mCallState != TelephonyManager.CALL_STATE_IDLE && !mZenModeHelper.isCall(record)) {
- 3713 return "callState";
- 3714 }
- 3715 return null;
- 3716 };
复制代码
|
|
手机微信同号:13682654092
|
|
|
|
|
登录或注册
|