Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fbe1ddee authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix notification widget's alerting logs"

parents 2a65b60e 8ddeb521
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -9473,10 +9473,14 @@
    <string name="notification_log_details_parcel">parcel size</string>
    <!-- Notification log debug tool: notification ashmem size -->
    <string name="notification_log_details_ashmem">ashmem</string>
    <!-- Notification log debug tool: header: notification alert info -->
    <string name="notification_log_details_alerted">notification alerted</string>
    <!-- Notification log debug tool: header: notification sound info -->
    <string name="notification_log_details_sound">sound</string>
    <!-- Notification log debug tool: header: notification vibration info -->
    <string name="notification_log_details_vibrate">vibrate</string>
    <!-- Notification log debug tool: header: notification vibration info -->
    <string name="notification_log_details_vibrate_pattern">pattern</string>
    <!-- Notification log debug tool: the word 'default' -->
    <string name="notification_log_details_default">default</string>
    <!-- Notification log debug tool: the word 'none' -->
+48 −20
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@

package com.android.settings.notification;

import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;

import android.app.Activity;
import android.app.ActivityManager;
import android.app.INotificationManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -354,9 +357,23 @@ public class NotificationStation extends SettingsPreferenceFragment {
                        getString(R.string.notification_log_details_group_summary)));
            }
        }
        if (info.active) {
            // mRanking only applies to active notifications
            if (mRanking != null && mRanking.getRanking(sbn.getKey(), rank)) {
                if (rank.getLastAudiblyAlertedMillis() > 0) {
                    sb.append("\n")
                            .append(bold(getString(R.string.notification_log_details_alerted)));
                }
            }
        }
        try {
            NotificationChannel channel = mNoMan.getNotificationChannelForPackage(
                    sbn.getPackageName(), sbn.getUid(), n.getChannelId(), false);
            sb.append("\n")
                    .append(bold(getString(R.string.notification_log_details_sound)))
                    .append(delim);
            if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {

                if (0 != (n.defaults & Notification.DEFAULT_SOUND)) {
                    sb.append(getString(R.string.notification_log_details_default));
                } else if (n.sound != null) {
@@ -364,19 +381,30 @@ public class NotificationStation extends SettingsPreferenceFragment {
                } else {
                    sb.append(getString(R.string.notification_log_details_none));
                }
            } else {
                sb.append(String.valueOf(channel.getSound()));
            }
            sb.append("\n")
                    .append(bold(getString(R.string.notification_log_details_vibrate)))
                    .append(delim);
            if (channel.getImportance() == IMPORTANCE_UNSPECIFIED) {
                if (0 != (n.defaults & Notification.DEFAULT_VIBRATE)) {
                    sb.append(getString(R.string.notification_log_details_default));
                } else if (n.vibrate != null) {
            for (int vi=0;vi<n.vibrate.length;vi++) {
                if (vi > 0) sb.append(',');
                sb.append(String.valueOf(n.vibrate[vi]));
                    sb.append(getString(R.string.notification_log_details_vibrate_pattern));
                } else {
                    sb.append(getString(R.string.notification_log_details_none));
                }
            } else {
                if (channel.getVibrationPattern() != null) {
                    sb.append(getString(R.string.notification_log_details_vibrate_pattern));
                } else {
                    sb.append(getString(R.string.notification_log_details_none));
                }
            }
        } catch (RemoteException e) {
            Log.d(TAG, "cannot read channel info", e);
        }
        sb.append("\n")
                .append(bold(getString(R.string.notification_log_details_visibility)))
                .append(delim)