FileDocCategorySizeDatePackage
ZenLog.javaAPI DocAndroid 5.1 API8076Thu Mar 12 22:22:42 GMT 2015com.android.server.notification

ZenLog

public class ZenLog extends Object
Copyright (c) 2014, The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Fields Summary
private static final String
TAG
private static final boolean
DEBUG
private static final int
SIZE
private static final long[]
TIMES
private static final int[]
TYPES
private static final String[]
MSGS
private static final SimpleDateFormat
FORMAT
private static final int
TYPE_INTERCEPTED
private static final int
TYPE_ALLOW_DISABLE
private static final int
TYPE_SET_RINGER_MODE_EXTERNAL
private static final int
TYPE_SET_RINGER_MODE_INTERNAL
private static final int
TYPE_DOWNTIME
private static final int
TYPE_SET_ZEN_MODE
private static final int
TYPE_UPDATE_ZEN_MODE
private static final int
TYPE_EXIT_CONDITION
private static final int
TYPE_SUBSCRIBE
private static final int
TYPE_UNSUBSCRIBE
private static final int
TYPE_CONFIG
private static final int
TYPE_NOT_INTERCEPTED
private static final int
TYPE_DISABLE_EFFECTS
private static int
sNext
private static int
sSize
Constructors Summary
Methods Summary
private static voidappend(int type, java.lang.String msg)

        synchronized(MSGS) {
            TIMES[sNext] = System.currentTimeMillis();
            TYPES[sNext] = type;
            MSGS[sNext] = msg;
            sNext = (sNext + 1) % SIZE;
            if (sSize < SIZE) {
                sSize++;
            }
        }
        if (DEBUG) Slog.d(TAG, typeToString(type) + ": " + msg);
    
private static java.lang.StringcomponentToString(android.content.ComponentName component)

        return component != null ? component.toShortString() : null;
    
public static voiddump(java.io.PrintWriter pw, java.lang.String prefix)

        synchronized(MSGS) {
            final int start = (sNext - sSize + SIZE) % SIZE;
            for (int i = 0; i < sSize; i++) {
                final int j = (start + i) % SIZE;
                pw.print(prefix);
                pw.print(FORMAT.format(new Date(TIMES[j])));
                pw.print(' ");
                pw.print(typeToString(TYPES[j]));
                pw.print(": ");
                pw.println(MSGS[j]);
            }
        }
    
private static java.lang.StringringerModeToString(int ringerMode)

        switch (ringerMode) {
            case AudioManager.RINGER_MODE_SILENT: return "silent";
            case AudioManager.RINGER_MODE_VIBRATE: return "vibrate";
            case AudioManager.RINGER_MODE_NORMAL: return "normal";
            default: return "unknown";
        }
    
private static java.lang.StringsubscribeResult(android.service.notification.IConditionProvider provider, android.os.RemoteException e)

        return provider == null ? "no provider" : e != null ? e.getMessage() : "ok";
    
public static voidtraceConfig(android.service.notification.ZenModeConfig oldConfig, android.service.notification.ZenModeConfig newConfig)

        append(TYPE_CONFIG, newConfig != null ? newConfig.toString() : null);
    
public static voidtraceDisableEffects(NotificationRecord record, java.lang.String reason)

        append(TYPE_DISABLE_EFFECTS, record.getKey() + "," + reason);
    
public static voidtraceDowntimeAutotrigger(java.lang.String result)

        append(TYPE_DOWNTIME, result);
    
public static voidtraceExitCondition(android.service.notification.Condition c, android.content.ComponentName component, java.lang.String reason)

        append(TYPE_EXIT_CONDITION, c + "," + componentToString(component) + "," + reason);
    
public static voidtraceIntercepted(NotificationRecord record, java.lang.String reason)


           
        if (record != null && record.isIntercepted()) return;  // already logged
        append(TYPE_INTERCEPTED, record.getKey() + "," + reason);
    
public static voidtraceNotIntercepted(NotificationRecord record, java.lang.String reason)

        if (record != null && record.isUpdate) return;  // already logged
        append(TYPE_NOT_INTERCEPTED, record.getKey() + "," + reason);
    
public static voidtraceSetRingerModeExternal(int ringerModeOld, int ringerModeNew, java.lang.String caller, int ringerModeInternalIn, int ringerModeInternalOut)

        append(TYPE_SET_RINGER_MODE_EXTERNAL, caller + ",e:" +
                ringerModeToString(ringerModeOld) + "->" +
                ringerModeToString(ringerModeNew)  + ",i:" +
                ringerModeToString(ringerModeInternalIn) + "->" +
                ringerModeToString(ringerModeInternalOut));
    
public static voidtraceSetRingerModeInternal(int ringerModeOld, int ringerModeNew, java.lang.String caller, int ringerModeExternalIn, int ringerModeExternalOut)

        append(TYPE_SET_RINGER_MODE_INTERNAL, caller + ",i:" +
                ringerModeToString(ringerModeOld) + "->" +
                ringerModeToString(ringerModeNew)  + ",e:" +
                ringerModeToString(ringerModeExternalIn) + "->" +
                ringerModeToString(ringerModeExternalOut));
    
public static voidtraceSetZenMode(int zenMode, java.lang.String reason)

        append(TYPE_SET_ZEN_MODE, zenModeToString(zenMode) + "," + reason);
    
public static voidtraceSubscribe(android.net.Uri uri, android.service.notification.IConditionProvider provider, android.os.RemoteException e)

        append(TYPE_SUBSCRIBE, uri + "," + subscribeResult(provider, e));
    
public static voidtraceUnsubscribe(android.net.Uri uri, android.service.notification.IConditionProvider provider, android.os.RemoteException e)

        append(TYPE_UNSUBSCRIBE, uri + "," + subscribeResult(provider, e));
    
public static voidtraceUpdateZenMode(int fromMode, int toMode)

        append(TYPE_UPDATE_ZEN_MODE, zenModeToString(fromMode) + " -> " + zenModeToString(toMode));
    
private static java.lang.StringtypeToString(int type)

        switch (type) {
            case TYPE_INTERCEPTED: return "intercepted";
            case TYPE_ALLOW_DISABLE: return "allow_disable";
            case TYPE_SET_RINGER_MODE_EXTERNAL: return "set_ringer_mode_external";
            case TYPE_SET_RINGER_MODE_INTERNAL: return "set_ringer_mode_internal";
            case TYPE_DOWNTIME: return "downtime";
            case TYPE_SET_ZEN_MODE: return "set_zen_mode";
            case TYPE_UPDATE_ZEN_MODE: return "update_zen_mode";
            case TYPE_EXIT_CONDITION: return "exit_condition";
            case TYPE_SUBSCRIBE: return "subscribe";
            case TYPE_UNSUBSCRIBE: return "unsubscribe";
            case TYPE_CONFIG: return "config";
            case TYPE_NOT_INTERCEPTED: return "not_intercepted";
            case TYPE_DISABLE_EFFECTS: return "disable_effects";
            default: return "unknown";
        }
    
private static java.lang.StringzenModeToString(int zenMode)

        switch (zenMode) {
            case Global.ZEN_MODE_OFF: return "off";
            case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: return "important_interruptions";
            case Global.ZEN_MODE_NO_INTERRUPTIONS: return "no_interruptions";
            default: return "unknown";
        }