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

Commit 227df243 authored by Joe Onorato's avatar Joe Onorato Committed by Android (Google) Code Review
Browse files

Merge "Switch the services library to using the new Slog"

parents eb494c00 8a9b2205
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -289,10 +289,11 @@ public final class Log {
        return println_native(LOG_ID_MAIN, priority, tag, msg);
    }

    static final int LOG_ID_MAIN = 0;
    static final int LOG_ID_RADIO = 1;
    static final int LOG_ID_EVENTS = 2;
    static final int LOG_ID_SYSTEM = 3;
    /** @hide */ public static final int LOG_ID_MAIN = 0;
    /** @hide */ public static final int LOG_ID_RADIO = 1;
    /** @hide */ public static final int LOG_ID_EVENTS = 2;
    /** @hide */ public static final int LOG_ID_SYSTEM = 3;

    static native int println_native(int bufID, int priority, String tag, String msg);
    /** @hide */ public static native int println_native(int bufID,
            int priority, String tag, String msg);
}
+13 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ package android.util;
public class LogPrinter implements Printer {
    private final int mPriority;
    private final String mTag;
    private final int mBuffer;
    
    /**
     * Create a new Printer that sends to the log with the given priority
@@ -39,9 +40,20 @@ public class LogPrinter implements Printer {
    public LogPrinter(int priority, String tag) {
        mPriority = priority;
        mTag = tag;
        mBuffer = Log.LOG_ID_MAIN;
    }

    /**
     * @hide
     * Same as above, but buffer is one of the LOG_ID_ constants from android.util.Log.
     */
    public LogPrinter(int priority, String tag, int buffer) {
        mPriority = priority;
        mTag = tag;
        mBuffer = buffer;
    }
    
    public void println(String x) {
        Log.println(mPriority, mTag, x);
        Log.println_native(mBuffer, mPriority, mTag, x);
    }
}
+10 −10
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.text.TextUtils.SimpleStringSplitter;
import android.util.Config;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.IAccessibilityManager;
@@ -275,7 +275,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                client.setEnabled(mIsEnabled);
                mClients.add(client);
            } catch (RemoteException re) {
                Log.w(LOG_TAG, "Dead AccessibilityManagerClient: " + client, re);
                Slog.w(LOG_TAG, "Dead AccessibilityManagerClient: " + client, re);
            }
        }
    }
@@ -309,13 +309,13 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    service.mServiceInterface.onInterrupt();
                } catch (RemoteException re) {
                    if (re instanceof DeadObjectException) {
                        Log.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
                        Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
                        if (removeDeadServiceLocked(service)) {
                            count--;
                            i--;
                        }
                    } else {
                        Log.e(LOG_TAG, "Error during sending interrupt request to "
                        Slog.e(LOG_TAG, "Error during sending interrupt request to "
                                + service.mService, re);
                    }
                }
@@ -343,7 +343,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                }
                return;
            default:
                Log.w(LOG_TAG, "Unknown message type: " + message.what);
                Slog.w(LOG_TAG, "Unknown message type: " + message.what);
        }
    }

@@ -451,16 +451,16 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        try {
            listener.onAccessibilityEvent(event);
            if (Config.DEBUG) {
                Log.i(LOG_TAG, "Event " + event + " sent to " + listener);
                Slog.i(LOG_TAG, "Event " + event + " sent to " + listener);
            }
        } catch (RemoteException re) {
            if (re instanceof DeadObjectException) {
                Log.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
                Slog.w(LOG_TAG, "Dead " + service.mService + ". Cleaning up.");
                synchronized (mLock) {
                    removeDeadServiceLocked(service);
                }
            } else {
                Log.e(LOG_TAG, "Error during sending " + event + " to " + service.mService, re);
                Slog.e(LOG_TAG, "Error during sending " + event + " to " + service.mService, re);
            }
        }
    }
@@ -476,7 +476,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
        mHandler.removeMessages(service.mId);

        if (Config.DEBUG) {
            Log.i(LOG_TAG, "Dead service " + service.mService + " removed");
            Slog.i(LOG_TAG, "Dead service " + service.mService + " removed");
        }

        if (mServices.isEmpty()) {
@@ -722,7 +722,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
                    }
                }
            } catch (RemoteException re) {
                Log.w(LOG_TAG, "Error while setting Controller for service: " + service, re);
                Slog.w(LOG_TAG, "Error while setting Controller for service: " + service, re);
            }
        }

+16 −16
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ import android.os.SystemProperties;
import android.text.TextUtils;
import android.text.format.Time;
import android.util.EventLog;
import android.util.Log;
import android.util.Slog;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -141,7 +141,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
        if (mDescriptor != -1) {
            mWaitThread.start();
        } else {
            Log.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
            Slog.w(TAG, "Failed to open alarm driver. Falling back to a handler.");
        }
    }
    
@@ -160,7 +160,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    public void setRepeating(int type, long triggerAtTime, long interval, 
            PendingIntent operation) {
        if (operation == null) {
            Log.w(TAG, "set/setRepeating ignored because there is no intent");
            Slog.w(TAG, "set/setRepeating ignored because there is no intent");
            return;
        }
        synchronized (mLock) {
@@ -173,7 +173,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
            // Remove this alarm if already scheduled.
            removeLocked(operation);

            if (localLOGV) Log.v(TAG, "set: " + alarm);
            if (localLOGV) Slog.v(TAG, "set: " + alarm);

            int index = addAlarmLocked(alarm);
            if (index == 0) {
@@ -185,7 +185,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
    public void setInexactRepeating(int type, long triggerAtTime, long interval, 
            PendingIntent operation) {
        if (operation == null) {
            Log.w(TAG, "setInexactRepeating ignored because there is no intent");
            Slog.w(TAG, "setInexactRepeating ignored because there is no intent");
            return;
        }

@@ -237,7 +237,7 @@ class AlarmManagerService extends IAlarmManager.Stub {

        // Remember where this bucket started (reducing the amount of later 
        // fixup required) and set the alarm with the new, bucketed start time.
        if (localLOGV) Log.v(TAG, "setInexactRepeating: interval=" + interval
        if (localLOGV) Slog.v(TAG, "setInexactRepeating: interval=" + interval
                + " bucketTime=" + bucketTime);
        mInexactDeliveryTimes[intervalSlot] = bucketTime;
        setRepeating(type, bucketTime, interval, operation);
@@ -264,7 +264,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
        synchronized (this) {
            String current = SystemProperties.get(TIMEZONE_PROPERTY);
            if (current == null || !current.equals(zone.getID())) {
                if (localLOGV) Log.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
                if (localLOGV) Slog.v(TAG, "timezone changed: " + current + ", new=" + zone.getID());
                timeZoneWasChanged = true; 
                SystemProperties.set(TIMEZONE_PROPERTY, zone.getID());
            }
@@ -379,18 +379,18 @@ class AlarmManagerService extends IAlarmManager.Stub {
        if (index < 0) {
            index = 0 - index - 1;
        }
        if (localLOGV) Log.v(TAG, "Adding alarm " + alarm + " at " + index);
        if (localLOGV) Slog.v(TAG, "Adding alarm " + alarm + " at " + index);
        alarmList.add(index, alarm);

        if (localLOGV) {
            // Display the list of alarms for this alarm type
            Log.v(TAG, "alarms: " + alarmList.size() + " type: " + alarm.type);
            Slog.v(TAG, "alarms: " + alarmList.size() + " type: " + alarm.type);
            int position = 0;
            for (Alarm a : alarmList) {
                Time time = new Time();
                time.set(a.when);
                String timeStr = time.format("%b %d %I:%M:%S %p");
                Log.v(TAG, position + ": " + timeStr
                Slog.v(TAG, position + ": " + timeStr
                        + " " + a.operation.getTargetPackage());
                position += 1;
            }
@@ -514,7 +514,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
        {
            Alarm alarm = it.next();

            if (localLOGV) Log.v(TAG, "Checking active alarm when=" + alarm.when + " " + alarm);
            if (localLOGV) Slog.v(TAG, "Checking active alarm when=" + alarm.when + " " + alarm);

            if (alarm.when > now) {
                // don't fire alarms in the future
@@ -526,14 +526,14 @@ class AlarmManagerService extends IAlarmManager.Stub {
            // the Calendar app with a reminder that is in the past. In that
            // case, the reminder alarm will fire immediately.
            if (localLOGV && now - alarm.when > LATE_ALARM_THRESHOLD) {
                Log.v(TAG, "alarm is late! alarm time: " + alarm.when
                Slog.v(TAG, "alarm is late! alarm time: " + alarm.when
                        + " now: " + now + " delay (in seconds): "
                        + (now - alarm.when) / 1000);
            }

            // Recurring alarms may have passed several alarm intervals while the
            // phone was asleep or off, so pass a trigger count when sending them.
            if (localLOGV) Log.v(TAG, "Alarm triggering: " + alarm);
            if (localLOGV) Slog.v(TAG, "Alarm triggering: " + alarm);
            alarm.count = 1;
            if (alarm.repeatInterval > 0) {
                // this adjustment will be zero if we're late by
@@ -644,7 +644,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
                synchronized (mLock) {
                    final long nowRTC = System.currentTimeMillis();
                    final long nowELAPSED = SystemClock.elapsedRealtime();
                    if (localLOGV) Log.v(
                    if (localLOGV) Slog.v(
                        TAG, "Checking for alarms... rtc=" + nowRTC
                        + ", elapsed=" + nowELAPSED);

@@ -665,7 +665,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
                    while (it.hasNext()) {
                        Alarm alarm = it.next();
                        try {
                            if (localLOGV) Log.v(TAG, "sending alarm " + alarm);
                            if (localLOGV) Slog.v(TAG, "sending alarm " + alarm);
                            alarm.operation.send(mContext, 0,
                                    mBackgroundIntent.putExtra(
                                            Intent.EXTRA_ALARM_COUNT, alarm.count),
@@ -696,7 +696,7 @@ class AlarmManagerService extends IAlarmManager.Stub {
                                remove(alarm.operation);
                            }
                        } catch (RuntimeException e) {
                            Log.w(TAG, "Failure sending alarm.", e);
                            Slog.w(TAG, "Failure sending alarm.", e);
                        }
                    }
                }
+13 −13
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ import android.os.Process;
import android.os.RemoteException;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
import android.util.TypedValue;
import android.util.Xml;
import android.widget.RemoteViews;
@@ -428,7 +428,7 @@ class AppWidgetService extends IAppWidgetService.Stub
        synchronized (mAppWidgetIds) {
            Provider p = lookupProviderLocked(provider);
            if (p == null) {
                Log.w(TAG, "updateAppWidgetProvider: provider doesn't exist: " + provider);
                Slog.w(TAG, "updateAppWidgetProvider: provider doesn't exist: " + provider);
                return;
            }
            ArrayList<AppWidgetId> instances = p.instances;
@@ -683,7 +683,7 @@ class AppWidgetService extends IAppWidgetService.Stub
            parser = activityInfo.loadXmlMetaData(mPackageManager,
                    AppWidgetManager.META_DATA_APPWIDGET_PROVIDER);
            if (parser == null) {
                Log.w(TAG, "No " + AppWidgetManager.META_DATA_APPWIDGET_PROVIDER + " meta-data for "
                Slog.w(TAG, "No " + AppWidgetManager.META_DATA_APPWIDGET_PROVIDER + " meta-data for "
                        + "AppWidget provider '" + component + '\'');
                return null;
            }
@@ -698,7 +698,7 @@ class AppWidgetService extends IAppWidgetService.Stub
            
            String nodeName = parser.getName();
            if (!"appwidget-provider".equals(nodeName)) {
                Log.w(TAG, "Meta-data does not start with appwidget-provider tag for"
                Slog.w(TAG, "Meta-data does not start with appwidget-provider tag for"
                        + " AppWidget provider '" + component + '\'');
                return null;
            }
@@ -737,7 +737,7 @@ class AppWidgetService extends IAppWidgetService.Stub
            // Ok to catch Exception here, because anything going wrong because
            // of what a client process passes to us should not be fatal for the
            // system process.
            Log.w(TAG, "XML parsing failed for AppWidget provider '" + component + '\'', e);
            Slog.w(TAG, "XML parsing failed for AppWidget provider '" + component + '\'', e);
            return null;
        } finally {
            if (parser != null) parser.close();
@@ -829,7 +829,7 @@ class AppWidgetService extends IAppWidgetService.Stub
        }

        if (!writeStateToFileLocked(temp)) {
            Log.w(TAG, "Failed to persist new settings");
            Slog.w(TAG, "Failed to persist new settings");
            return;
        }

@@ -980,7 +980,7 @@ class AppWidgetService extends IAppWidgetService.Stub
                            int pIndex = Integer.parseInt(providerString, 16);
                            id.provider = loadedProviders.get(pIndex);
                            if (false) {
                                Log.d(TAG, "bound appWidgetId=" + id.appWidgetId + " to provider "
                                Slog.d(TAG, "bound appWidgetId=" + id.appWidgetId + " to provider "
                                        + pIndex + " which is " + id.provider);
                            }
                            if (id.provider == null) {
@@ -1007,15 +1007,15 @@ class AppWidgetService extends IAppWidgetService.Stub
            } while (type != XmlPullParser.END_DOCUMENT);
            success = true;
        } catch (NullPointerException e) {
            Log.w(TAG, "failed parsing " + file, e);
            Slog.w(TAG, "failed parsing " + file, e);
        } catch (NumberFormatException e) {
            Log.w(TAG, "failed parsing " + file, e);
            Slog.w(TAG, "failed parsing " + file, e);
        } catch (XmlPullParserException e) {
            Log.w(TAG, "failed parsing " + file, e);
            Slog.w(TAG, "failed parsing " + file, e);
        } catch (IOException e) {
            Log.w(TAG, "failed parsing " + file, e);
            Slog.w(TAG, "failed parsing " + file, e);
        } catch (IndexOutOfBoundsException e) {
            Log.w(TAG, "failed parsing " + file, e);
            Slog.w(TAG, "failed parsing " + file, e);
        }
        try {
            if (stream != null) {
@@ -1055,7 +1055,7 @@ class AppWidgetService extends IAppWidgetService.Stub
    BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            //Log.d(TAG, "received " + action);
            //Slog.d(TAG, "received " + action);
            if (Intent.ACTION_BOOT_COMPLETED.equals(action)) {
                sendInitialBroadcasts();
            } else if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) {
Loading