move event log tags used by system server into this package

We can now locate event log tag definitions in individual packages
(and java constants for the tag numbers get auto-generated), so move
all the tags used by the system server into the package.
diff --git a/services/java/Android.mk b/services/java/Android.mk
index 5e912d6..5c54e33 100644
--- a/services/java/Android.mk
+++ b/services/java/Android.mk
@@ -5,7 +5,8 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-            $(call all-subdir-java-files)
+            $(call all-subdir-java-files) \
+	    com/android/server/EventLogTags.logtags
 
 LOCAL_MODULE:= services
 
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index c3b591e..3307932 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -102,22 +102,6 @@
     private static final int MSG_RUN_CLEAR = 4;
     private static final int MSG_RUN_INITIALIZE = 5;
 
-    // Event tags -- see system/core/logcat/event-log-tags
-    private static final int BACKUP_DATA_CHANGED_EVENT = 2820;
-    private static final int BACKUP_START_EVENT = 2821;
-    private static final int BACKUP_TRANSPORT_FAILURE_EVENT = 2822;
-    private static final int BACKUP_AGENT_FAILURE_EVENT = 2823;
-    private static final int BACKUP_PACKAGE_EVENT = 2824;
-    private static final int BACKUP_SUCCESS_EVENT = 2825;
-    private static final int BACKUP_RESET_EVENT = 2826;
-    private static final int BACKUP_INITIALIZE_EVENT = 2827;
-
-    private static final int RESTORE_START_EVENT = 2830;
-    private static final int RESTORE_TRANSPORT_FAILURE_EVENT = 2831;
-    private static final int RESTORE_AGENT_FAILURE_EVENT = 2832;
-    private static final int RESTORE_PACKAGE_EVENT = 2833;
-    private static final int RESTORE_SUCCESS_EVENT = 2834;
-
     // Timeout interval for deciding that a bind or clear-data has taken too long
     static final long TIMEOUT_INTERVAL = 10 * 1000;
 
@@ -1016,7 +1000,7 @@
             Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
 
             try {
-                EventLog.writeEvent(BACKUP_START_EVENT, mTransport.transportDirName());
+                EventLog.writeEvent(EventLogTags.BACKUP_START, mTransport.transportDirName());
 
                 // If we haven't stored package manager metadata yet, we must init the transport.
                 File pmState = new File(mStateDir, PACKAGE_MANAGER_SENTINEL);
@@ -1025,9 +1009,9 @@
                     resetBackupState(mStateDir);  // Just to make sure.
                     status = mTransport.initializeDevice();
                     if (status == BackupConstants.TRANSPORT_OK) {
-                        EventLog.writeEvent(BACKUP_INITIALIZE_EVENT);
+                        EventLog.writeEvent(EventLogTags.BACKUP_INITIALIZE);
                     } else {
-                        EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, "(initialize)");
+                        EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(initialize)");
                         Log.e(TAG, "Transport error in initializeDevice()");
                     }
                 }
@@ -1056,9 +1040,9 @@
                     status = mTransport.finishBackup();
                     if (status == BackupConstants.TRANSPORT_OK) {
                         int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
-                        EventLog.writeEvent(BACKUP_SUCCESS_EVENT, mQueue.size(), millis);
+                        EventLog.writeEvent(EventLogTags.BACKUP_SUCCESS, mQueue.size(), millis);
                     } else {
-                        EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, "(finish)");
+                        EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(finish)");
                         Log.e(TAG, "Transport error in finishBackup()");
                     }
                 }
@@ -1067,7 +1051,7 @@
                     // The backend reports that our dataset has been wiped.  We need to
                     // reset all of our bookkeeping and instead run a new backup pass for
                     // everything.  This must come after mBackupOrRestoreInProgress is cleared.
-                    EventLog.writeEvent(BACKUP_RESET_EVENT, mTransport.transportDirName());
+                    EventLog.writeEvent(EventLogTags.BACKUP_RESET, mTransport.transportDirName());
                     resetBackupState(mStateDir);
                 }
             } catch (Exception e) {
@@ -1201,7 +1185,7 @@
                 if (DEBUG) Log.v(TAG, "doBackup() success");
             } catch (Exception e) {
                 Log.e(TAG, "Error backing up " + packageName, e);
-                EventLog.writeEvent(BACKUP_AGENT_FAILURE_EVENT, packageName, e.toString());
+                EventLog.writeEvent(EventLogTags.BACKUP_AGENT_FAILURE, packageName, e.toString());
                 backupDataName.delete();
                 newStateName.delete();
                 return BackupConstants.TRANSPORT_ERROR;
@@ -1241,13 +1225,13 @@
                 if (result == BackupConstants.TRANSPORT_OK) {
                     backupDataName.delete();
                     newStateName.renameTo(savedStateName);
-                    EventLog.writeEvent(BACKUP_PACKAGE_EVENT, packageName, size);
+                    EventLog.writeEvent(EventLogTags.BACKUP_PACKAGE, packageName, size);
                 } else {
-                    EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, packageName);
+                    EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, packageName);
                 }
             } catch (Exception e) {
                 Log.e(TAG, "Transport error backing up " + packageName, e);
-                EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, packageName);
+                EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, packageName);
                 result = BackupConstants.TRANSPORT_ERROR;
             } finally {
                 try { if (backupData != null) backupData.close(); } catch (IOException e) {}
@@ -1364,7 +1348,7 @@
             // build the set of apps to restore
             try {
                 // TODO: Log this before getAvailableRestoreSets, somehow
-                EventLog.writeEvent(RESTORE_START_EVENT, mTransport.transportDirName(), mToken);
+                EventLog.writeEvent(EventLogTags.RESTORE_START, mTransport.transportDirName(), mToken);
 
                 // Get the list of all packages which have backup enabled.
                 // (Include the Package Manager metadata pseudo-package first.)
@@ -1391,24 +1375,24 @@
                 if (mTransport.startRestore(mToken, restorePackages.toArray(new PackageInfo[0])) !=
                         BackupConstants.TRANSPORT_OK) {
                     Log.e(TAG, "Error starting restore operation");
-                    EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT);
+                    EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
                     return;
                 }
 
                 String packageName = mTransport.nextRestorePackage();
                 if (packageName == null) {
                     Log.e(TAG, "Error getting first restore package");
-                    EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT);
+                    EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
                     return;
                 } else if (packageName.equals("")) {
                     Log.i(TAG, "No restore data available");
                     int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
-                    EventLog.writeEvent(RESTORE_SUCCESS_EVENT, 0, millis);
+                    EventLog.writeEvent(EventLogTags.RESTORE_SUCCESS, 0, millis);
                     return;
                 } else if (!packageName.equals(PACKAGE_MANAGER_SENTINEL)) {
                     Log.e(TAG, "Expected restore data for \"" + PACKAGE_MANAGER_SENTINEL
                           + "\", found only \"" + packageName + "\"");
-                    EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, PACKAGE_MANAGER_SENTINEL,
+                    EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, PACKAGE_MANAGER_SENTINEL,
                             "Package manager data missing");
                     return;
                 }
@@ -1423,7 +1407,7 @@
                 // the restore operation.
                 if (!pmAgent.hasMetadata()) {
                     Log.e(TAG, "No restore metadata available, so not restoring settings");
-                    EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, PACKAGE_MANAGER_SENTINEL,
+                    EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, PACKAGE_MANAGER_SENTINEL,
                             "Package manager restore metadata missing");
                     return;
                 }
@@ -1434,7 +1418,7 @@
 
                     if (packageName == null) {
                         Log.e(TAG, "Error getting next restore package");
-                        EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT);
+                        EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
                         return;
                     } else if (packageName.equals("")) {
                         break;
@@ -1452,7 +1436,7 @@
                     Metadata metaInfo = pmAgent.getRestoredMetadata(packageName);
                     if (metaInfo == null) {
                         Log.e(TAG, "Missing metadata for " + packageName);
-                        EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
+                        EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
                                 "Package metadata missing");
                         continue;
                     }
@@ -1463,7 +1447,7 @@
                         packageInfo = mPackageManager.getPackageInfo(packageName, flags);
                     } catch (NameNotFoundException e) {
                         Log.e(TAG, "Invalid package restoring data", e);
-                        EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
+                        EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
                                 "Package missing on device");
                         continue;
                     }
@@ -1472,13 +1456,13 @@
                         String message = "Version " + metaInfo.versionCode
                                 + " > installed version " + packageInfo.versionCode;
                         Log.w(TAG, "Package " + packageName + ": " + message);
-                        EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName, message);
+                        EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName, message);
                         continue;
                     }
 
                     if (!signaturesMatch(metaInfo.signatures, packageInfo)) {
                         Log.w(TAG, "Signature mismatch restoring " + packageName);
-                        EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
+                        EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
                                 "Signature mismatch");
                         continue;
                     }
@@ -1505,7 +1489,7 @@
                                     : IApplicationThread.BACKUP_MODE_RESTORE));
                     if (agent == null) {
                         Log.w(TAG, "Can't find backup agent for " + packageName);
-                        EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
+                        EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName,
                                 "Restore agent missing");
                         continue;
                     }
@@ -1536,7 +1520,7 @@
                 // if we get this far, report success to the observer
                 error = 0;
                 int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
-                EventLog.writeEvent(RESTORE_SUCCESS_EVENT, count, millis);
+                EventLog.writeEvent(EventLogTags.RESTORE_SUCCESS, count, millis);
             } catch (Exception e) {
                 Log.e(TAG, "Error in restore thread", e);
             } finally {
@@ -1594,7 +1578,7 @@
 
                 if (mTransport.getRestoreData(backupData) != BackupConstants.TRANSPORT_OK) {
                     Log.e(TAG, "Error getting restore data for " + packageName);
-                    EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT);
+                    EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
                     return;
                 }
 
@@ -1627,10 +1611,10 @@
                 //newStateName.renameTo(savedStateName);    // TODO: replace with this
 
                 int size = (int) backupDataName.length();
-                EventLog.writeEvent(RESTORE_PACKAGE_EVENT, packageName, size);
+                EventLog.writeEvent(EventLogTags.RESTORE_PACKAGE, packageName, size);
             } catch (Exception e) {
                 Log.e(TAG, "Error restoring data for " + packageName, e);
-                EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName, e.toString());
+                EventLog.writeEvent(EventLogTags.RESTORE_AGENT_FAILURE, packageName, e.toString());
 
                 // If the agent fails restore, it might have put the app's data
                 // into an incoherent state.  For consistency we wipe its data
@@ -1702,7 +1686,7 @@
                     }
 
                     Log.i(TAG, "Initializing (wiping) backup transport storage: " + transportName);
-                    EventLog.writeEvent(BACKUP_START_EVENT, transport.transportDirName());
+                    EventLog.writeEvent(EventLogTags.BACKUP_START, transport.transportDirName());
                     long startRealtime = SystemClock.elapsedRealtime();
                     int status = transport.initializeDevice();
 
@@ -1714,9 +1698,9 @@
                     if (status == BackupConstants.TRANSPORT_OK) {
                         Log.i(TAG, "Device init successful");
                         int millis = (int) (SystemClock.elapsedRealtime() - startRealtime);
-                        EventLog.writeEvent(BACKUP_INITIALIZE_EVENT);
+                        EventLog.writeEvent(EventLogTags.BACKUP_INITIALIZE);
                         resetBackupState(new File(mBaseStateDir, transport.transportDirName()));
-                        EventLog.writeEvent(BACKUP_SUCCESS_EVENT, 0, millis);
+                        EventLog.writeEvent(EventLogTags.BACKUP_SUCCESS, 0, millis);
                         synchronized (mQueueLock) {
                             recordInitPendingLocked(false, transportName);
                         }
@@ -1724,7 +1708,7 @@
                         // If this didn't work, requeue this one and try again
                         // after a suitable interval
                         Log.e(TAG, "Transport error in initializeDevice()");
-                        EventLog.writeEvent(BACKUP_TRANSPORT_FAILURE_EVENT, "(initialize)");
+                        EventLog.writeEvent(EventLogTags.BACKUP_TRANSPORT_FAILURE, "(initialize)");
                         synchronized (mQueueLock) {
                             recordInitPendingLocked(true, transportName);
                         }
@@ -1757,7 +1741,7 @@
         // Record that we need a backup pass for the caller.  Since multiple callers
         // may share a uid, we need to note all candidates within that uid and schedule
         // a backup pass for each of them.
-        EventLog.writeEvent(BACKUP_DATA_CHANGED_EVENT, packageName);
+        EventLog.writeEvent(EventLogTags.BACKUP_DATA_CHANGED, packageName);
 
         // If the caller does not hold the BACKUP permission, it can only request a
         // backup of its own data.
@@ -2103,7 +2087,7 @@
                 }
                 if (mRestoreSets == null) { // valid transport; do the one-time fetch
                     mRestoreSets = mRestoreTransport.getAvailableRestoreSets();
-                    if (mRestoreSets == null) EventLog.writeEvent(RESTORE_TRANSPORT_FAILURE_EVENT);
+                    if (mRestoreSets == null) EventLog.writeEvent(EventLogTags.RESTORE_TRANSPORT_FAILURE);
                 }
                 return mRestoreSets;
             } catch (Exception e) {
diff --git a/services/java/com/android/server/BatteryService.java b/services/java/com/android/server/BatteryService.java
index bb36936..e98fa99 100644
--- a/services/java/com/android/server/BatteryService.java
+++ b/services/java/com/android/server/BatteryService.java
@@ -68,23 +68,19 @@
  */
 class BatteryService extends Binder {
     private static final String TAG = BatteryService.class.getSimpleName();
-    
+
     private static final boolean LOCAL_LOGV = false;
-    
-    static final int LOG_BATTERY_LEVEL = 2722;
-    static final int LOG_BATTERY_STATUS = 2723;
-    static final int LOG_BATTERY_DISCHARGE_STATUS = 2730;
-    
+
     static final int BATTERY_SCALE = 100;    // battery capacity is a percentage
 
     // Used locally for determining when to make a last ditch effort to log
     // discharge stats before the device dies.
-    private static final int CRITICAL_BATTERY_LEVEL = 4; 
+    private static final int CRITICAL_BATTERY_LEVEL = 4;
 
     private static final int DUMP_MAX_LENGTH = 24 * 1024;
     private static final String[] DUMPSYS_ARGS = new String[] { "--checkin", "-u" };
     private static final String BATTERY_STATS_SERVICE_NAME = "batteryinfo";
-    
+
     private static final String DUMPSYS_DATA_PATH = "/data/system/";
 
     // This should probably be exposed in the API, though it's not critical
@@ -92,7 +88,7 @@
 
     private final Context mContext;
     private final IBatteryStats mBatteryStats;
-    
+
     private boolean mAcOnline;
     private boolean mUsbOnline;
     private int mBatteryStatus;
@@ -117,12 +113,12 @@
 
     private int mPlugType;
     private int mLastPlugType = -1; // Extra state so we can detect first run
-    
+
     private long mDischargeStartTime;
     private int mDischargeStartLevel;
-    
+
     private boolean mSentLowBatteryBroadcast = false;
-    
+
     public BatteryService(Context context) {
         mContext = context;
         mBatteryStats = BatteryStatsService.getService();
@@ -219,20 +215,20 @@
                 mPlugType != mLastPlugType ||
                 mBatteryVoltage != mLastBatteryVoltage ||
                 mBatteryTemperature != mLastBatteryTemperature) {
-            
+
             if (mPlugType != mLastPlugType) {
                 if (mLastPlugType == BATTERY_PLUGGED_NONE) {
                     // discharging -> charging
-                    
+
                     // There's no value in this data unless we've discharged at least once and the
                     // battery level has changed; so don't log until it does.
                     if (mDischargeStartTime != 0 && mDischargeStartLevel != mBatteryLevel) {
                         dischargeDuration = SystemClock.elapsedRealtime() - mDischargeStartTime;
                         logOutlier = true;
-                        EventLog.writeEvent(LOG_BATTERY_DISCHARGE_STATUS, dischargeDuration,
+                        EventLog.writeEvent(EventLogTags.BATTERY_DISCHARGE, dischargeDuration,
                                 mDischargeStartLevel, mBatteryLevel);
                         // make sure we see a discharge event before logging again
-                        mDischargeStartTime = 0; 
+                        mDischargeStartTime = 0;
                     }
                 } else if (mPlugType == BATTERY_PLUGGED_NONE) {
                     // charging -> discharging or we just powered up
@@ -244,19 +240,19 @@
                     mBatteryHealth != mLastBatteryHealth ||
                     mBatteryPresent != mLastBatteryPresent ||
                     mPlugType != mLastPlugType) {
-                EventLog.writeEvent(LOG_BATTERY_STATUS,
+                EventLog.writeEvent(EventLogTags.BATTERY_STATUS,
                         mBatteryStatus, mBatteryHealth, mBatteryPresent ? 1 : 0,
                         mPlugType, mBatteryTechnology);
             }
             if (mBatteryLevel != mLastBatteryLevel ||
                     mBatteryVoltage != mLastBatteryVoltage ||
                     mBatteryTemperature != mLastBatteryTemperature) {
-                EventLog.writeEvent(LOG_BATTERY_LEVEL,
+                EventLog.writeEvent(EventLogTags.BATTERY_LEVEL,
                         mBatteryLevel, mBatteryVoltage, mBatteryTemperature);
             }
             if (mBatteryLevel != mLastBatteryLevel && mPlugType == BATTERY_PLUGGED_NONE) {
                 // If the battery level has changed and we are on battery, update the current level.
-                // This is used for discharge cycle tracking so this shouldn't be updated while the 
+                // This is used for discharge cycle tracking so this shouldn't be updated while the
                 // battery is charging.
                 try {
                     mBatteryStats.recordCurrentLevel(mBatteryLevel);
@@ -271,7 +267,7 @@
                 dischargeDuration = SystemClock.elapsedRealtime() - mDischargeStartTime;
                 logOutlier = true;
             }
-            
+
             final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE;
             final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE;
 
@@ -285,9 +281,9 @@
                 && mBatteryStatus != BatteryManager.BATTERY_STATUS_UNKNOWN
                 && mBatteryLevel <= mLowBatteryWarningLevel
                 && (oldPlugged || mLastBatteryLevel > mLowBatteryWarningLevel);
-            
+
             sendIntent();
-            
+
             // Separate broadcast is sent for power connected / not connected
             // since the standard intent will not wake any applications and some
             // applications may want to have smart behavior based on this.
@@ -311,12 +307,12 @@
                 statusIntent.setAction(Intent.ACTION_BATTERY_OKAY);
                 mContext.sendBroadcast(statusIntent);
             }
-            
+
             // This needs to be done after sendIntent() so that we get the lastest battery stats.
             if (logOutlier && dischargeDuration != 0) {
                 logOutlier(dischargeDuration);
             }
-            
+
             mLastBatteryStatus = mBatteryStatus;
             mLastBatteryHealth = mBatteryHealth;
             mLastBatteryPresent = mBatteryPresent;
@@ -337,7 +333,7 @@
         } catch (RemoteException e) {
             // Should never happen.
         }
-        
+
         int icon = getIcon(mBatteryLevel);
 
         intent.putExtra(BatteryManager.EXTRA_STATUS, mBatteryStatus);
@@ -353,8 +349,8 @@
 
         if (false) {
             Log.d(TAG, "updateBattery level:" + mBatteryLevel +
-                    " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus + 
-                    " health:" + mBatteryHealth +  " present:" + mBatteryPresent + 
+                    " scale:" + BATTERY_SCALE + " status:" + mBatteryStatus +
+                    " health:" + mBatteryHealth +  " present:" + mBatteryPresent +
                     " voltage: " + mBatteryVoltage +
                     " temperature: " + mBatteryTemperature +
                     " technology: " + mBatteryTechnology +
@@ -366,7 +362,7 @@
     }
 
     private final void logBatteryStats() {
-        
+
         IBinder batteryInfoService = ServiceManager.getService(BATTERY_STATS_SERVICE_NAME);
         if (batteryInfoService != null) {
             byte[] buffer = new byte[DUMP_MAX_LENGTH];
@@ -385,15 +381,15 @@
                 FileInputStream fileInputStream = new FileInputStream(dumpFile);
                 int nread = fileInputStream.read(buffer, 0, length);
                 if (nread > 0) {
-                    Checkin.logEvent(mContext.getContentResolver(), 
-                            Checkin.Events.Tag.BATTERY_DISCHARGE_INFO, 
+                    Checkin.logEvent(mContext.getContentResolver(),
+                            Checkin.Events.Tag.BATTERY_DISCHARGE_INFO,
                             new String(buffer, 0, nread));
-                    if (LOCAL_LOGV) Log.v(TAG, "dumped " + nread + "b from " + 
+                    if (LOCAL_LOGV) Log.v(TAG, "dumped " + nread + "b from " +
                             batteryInfoService + "to log");
                     if (LOCAL_LOGV) Log.v(TAG, "actual dump:" + new String(buffer, 0, nread));
                 }
             } catch (RemoteException e) {
-                Log.e(TAG, "failed to dump service '" + BATTERY_STATS_SERVICE_NAME + 
+                Log.e(TAG, "failed to dump service '" + BATTERY_STATS_SERVICE_NAME +
                         "':" + e);
             } catch (IOException e) {
                 Log.e(TAG, "failed to write dumpsys file: " +  e);
@@ -413,29 +409,29 @@
             }
         }
     }
-    
+
     private final void logOutlier(long duration) {
         ContentResolver cr = mContext.getContentResolver();
         String dischargeThresholdString = Settings.Gservices.getString(cr,
                 Settings.Gservices.BATTERY_DISCHARGE_THRESHOLD);
         String durationThresholdString = Settings.Gservices.getString(cr,
                 Settings.Gservices.BATTERY_DISCHARGE_DURATION_THRESHOLD);
-        
+
         if (dischargeThresholdString != null && durationThresholdString != null) {
             try {
                 long durationThreshold = Long.parseLong(durationThresholdString);
                 int dischargeThreshold = Integer.parseInt(dischargeThresholdString);
-                if (duration <= durationThreshold && 
+                if (duration <= durationThreshold &&
                         mDischargeStartLevel - mBatteryLevel >= dischargeThreshold) {
                     // If the discharge cycle is bad enough we want to know about it.
                     logBatteryStats();
                 }
-                if (LOCAL_LOGV) Log.v(TAG, "duration threshold: " + durationThreshold + 
+                if (LOCAL_LOGV) Log.v(TAG, "duration threshold: " + durationThreshold +
                         " discharge threshold: " + dischargeThreshold);
-                if (LOCAL_LOGV) Log.v(TAG, "duration: " + duration + " discharge: " + 
+                if (LOCAL_LOGV) Log.v(TAG, "duration: " + duration + " discharge: " +
                         (mDischargeStartLevel - mBatteryLevel));
             } catch (NumberFormatException e) {
-                Log.e(TAG, "Invalid DischargeThresholds GService string: " + 
+                Log.e(TAG, "Invalid DischargeThresholds GService string: " +
                         durationThresholdString + " or " + dischargeThresholdString);
                 return;
             }
@@ -458,7 +454,7 @@
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                 != PackageManager.PERMISSION_GRANTED) {
-            
+
             pw.println("Permission Denial: can't dump Battery service from from pid="
                     + Binder.getCallingPid()
                     + ", uid=" + Binder.getCallingUid());
diff --git a/services/java/com/android/server/ConnectivityService.java b/services/java/com/android/server/ConnectivityService.java
index a91635e..676e5f6 100644
--- a/services/java/com/android/server/ConnectivityService.java
+++ b/services/java/com/android/server/ConnectivityService.java
@@ -56,9 +56,6 @@
     private static final boolean DBG = true;
     private static final String TAG = "ConnectivityService";
 
-    // Event log tags (must be in sync with event-log-tags)
-    private static final int EVENTLOG_CONNECTIVITY_STATE_CHANGED = 50020;
-
     // how long to wait before switching back to a radio's default network
     private static final int RESTORE_DEFAULT_NETWORK_DELAY = 1 * 60 * 1000;
     // system property that can override the above value
@@ -1230,7 +1227,7 @@
                     int eventLogParam = (info.getType() & 0x7) |
                             ((info.getDetailedState().ordinal() & 0x3f) << 3) |
                             (info.getSubtype() << 9);
-                    EventLog.writeEvent(EVENTLOG_CONNECTIVITY_STATE_CHANGED,
+                    EventLog.writeEvent(EventLogTags.CONNECTIVITY_STATE_CHANGED,
                             eventLogParam);
 
                     if (info.getDetailedState() ==
diff --git a/services/java/com/android/server/DeviceStorageMonitorService.java b/services/java/com/android/server/DeviceStorageMonitorService.java
index 57af029..8e54c6e 100644
--- a/services/java/com/android/server/DeviceStorageMonitorService.java
+++ b/services/java/com/android/server/DeviceStorageMonitorService.java
@@ -63,9 +63,6 @@
     private static final int LOW_MEMORY_NOTIFICATION_ID = 1;
     private static final int DEFAULT_THRESHOLD_PERCENTAGE = 10;
     private static final int DEFAULT_FREE_STORAGE_LOG_INTERVAL_IN_MINUTES = 12*60; //in minutes
-    private static final int EVENT_LOG_STORAGE_BELOW_THRESHOLD = 2744;
-    private static final int EVENT_LOG_LOW_STORAGE_NOTIFICATION = 2745;
-    private static final int EVENT_LOG_FREE_STORAGE_LEFT = 2746;
     private static final long DEFAULT_DISK_FREE_CHANGE_REPORTING_THRESHOLD = 2 * 1024 * 1024; // 2MB
     private static final long DEFAULT_CHECK_INTERVAL = MONITOR_INTERVAL*60*1000;
     private long mFreeMem;  // on /data
@@ -159,7 +156,7 @@
                 // ignore; report -1
             }
             mCacheFileStats.restat(CACHE_PATH);
-            EventLog.writeEvent(EVENT_LOG_FREE_STORAGE_LEFT,
+            EventLog.writeEvent(EventLogTags.FREE_STORAGE_LEFT,
                                 mFreeMem, mFreeSystem, mFreeCache);
         }
         // Read the reporting threshold from Gservices
@@ -170,7 +167,7 @@
         long delta = mFreeMem - mLastReportedFreeMem;
         if (delta > threshold || delta < -threshold) {
             mLastReportedFreeMem = mFreeMem;
-            EventLog.writeEvent(EVENT_LOG_STORAGE_BELOW_THRESHOLD, mFreeMem);
+            EventLog.writeEvent(EventLogTags.FREE_STORAGE_CHANGED, mFreeMem);
         }
     }
 
@@ -292,7 +289,7 @@
     private final void sendNotification() {
         if(localLOGV) Log.i(TAG, "Sending low memory notification");
         //log the event to event log with the amount of free storage(in bytes) left on the device
-        EventLog.writeEvent(EVENT_LOG_LOW_STORAGE_NOTIFICATION, mFreeMem);
+        EventLog.writeEvent(EventLogTags.LOW_STORAGE, mFreeMem);
         //  Pack up the values and broadcast them to everyone
         Intent lowMemIntent = new Intent(Intent.ACTION_MANAGE_PACKAGE_STORAGE);
         lowMemIntent.putExtra("memory", mFreeMem);
diff --git a/services/java/com/android/server/EventLogTags.logtags b/services/java/com/android/server/EventLogTags.logtags
new file mode 100644
index 0000000..5429c0c
--- /dev/null
+++ b/services/java/com/android/server/EventLogTags.logtags
@@ -0,0 +1,139 @@
+# See system/core/logcat/event.logtags for a description of the format of this file.
+
+option java_package com.android.server
+
+# ---------------------------
+# BatteryService.java
+# ---------------------------
+2722 battery_level (level|1|6),(voltage|1|1),(temperature|1|1)
+2723 battery_status (status|1|5),(health|1|5),(present|1|5),(plugged|1|5),(technology|3)
+# This is logged when battery goes from discharging to charging.
+# It lets us count the total amount of time between charges and the discharge level
+2730 battery_discharge (duration|2|3),(minLevel|1|6),(maxLevel|1|6)
+
+
+# ---------------------------
+# PowerManagerService.java
+# ---------------------------
+# This is logged when the device is being forced to sleep (typically by
+# the user pressing the power button).
+2724 power_sleep_requested (wakeLocksCleared|1|1)
+# This is logged when the screen on broadcast has completed
+2725 power_screen_broadcast_send (wakelockCount|1|1)
+# This is logged when the screen broadcast has completed
+2726 power_screen_broadcast_done (on|1|5),(broadcastDuration|2|3),(wakelockCount|1|1)
+# This is logged when the screen on broadcast has completed
+2727 power_screen_broadcast_stop (which|1|5),(wakelockCount|1|1)
+# This is logged when the screen is turned on or off.
+2728 power_screen_state (offOrOn|1|5),(becauseOfUser|1|5),(totalTouchDownTime|2|3),(touchCycles|1|1)
+# This is logged when the partial wake lock (keeping the device awake
+# regardless of whether the screen is off) is acquired or released.
+2729 power_partial_wake_state (releasedorAcquired|1|5),(tag|3)
+
+#
+# Leave IDs through 2739 for more power logs (2730 used by battery_discharge above)
+#
+
+
+# ---------------------------
+# DeviceStorageMonitoryService.java
+# ---------------------------
+# The disk space free on the /data partition, in bytes
+2744 free_storage_changed (data|2|2)
+# Device low memory notification and disk space free on the /data partition, in bytes at that time
+2745 low_storage (data|2|2)
+# disk space free on the /data, /system, and /cache partitions in bytes
+2746 free_storage_left (data|2|2),(system|2|2),(cache|2|2)
+
+
+# ---------------------------
+# NotificationManagerService.java
+# ---------------------------
+# when a NotificationManager.notify is called
+2750 notification_enqueue (pkg|3),(id|1|5),(notification|3)
+# when someone tries to cancel a notification, the notification manager sometimes
+# calls this with flags too
+2751 notification_cancel (pkg|3),(id|1|5),(required_flags|1)
+# when someone tries to cancel all of the notifications for a particular package
+2752 notification_cancel_all (pkg|3),(required_flags|1)
+
+
+# ---------------------------
+# Watchdog.java
+# ---------------------------
+2802 watchdog (Service|3)
+2803 watchdog_proc_pss (Process|3),(Pid|1|5),(Pss|1|2)
+2804 watchdog_soft_reset (Process|3),(Pid|1|5),(MaxPss|1|2),(Pss|1|2),(Skip|3)
+2805 watchdog_hard_reset (Process|3),(Pid|1|5),(MaxPss|1|2),(Pss|1|2)
+2806 watchdog_pss_stats (EmptyPss|1|2),(EmptyCount|1|1),(BackgroundPss|1|2),(BackgroundCount|1|1),(ServicePss|1|2),(ServiceCount|1|1),(VisiblePss|1|2),(VisibleCount|1|1),(ForegroundPss|1|2),(ForegroundCount|1|1),(NoPssCount|1|1)
+2807 watchdog_proc_stats (DeathsInOne|1|1),(DeathsInTwo|1|1),(DeathsInThree|1|1),(DeathsInFour|1|1),(DeathsInFive|1|1)
+2808 watchdog_scheduled_reboot (Now|2|1),(Interval|1|3),(StartTime|1|3),(Window|1|3),(Skip|3)
+2809 watchdog_meminfo (MemFree|1|2),(Buffers|1|2),(Cached|1|2),(Active|1|2),(Inactive|1|2),(AnonPages|1|2),(Mapped|1|2),(Slab|1|2),(SReclaimable|1|2),(SUnreclaim|1|2),(PageTables|1|2)
+2810 watchdog_vmstat (runtime|2|3),(pgfree|1|1),(pgactivate|1|1),(pgdeactivate|1|1),(pgfault|1|1),(pgmajfault|1|1)
+2811 watchdog_requested_reboot (NoWait|1|1),(ScheduleInterval|1|3),(RecheckInterval|1|3),(StartTime|1|3),(Window|1|3),(MinScreenOff|1|3),(MinNextAlarm|1|3)
+
+
+# ---------------------------
+# BackupManagerService.java
+# ---------------------------
+2820 backup_data_changed (Package|3)
+2821 backup_start (Transport|3)
+2822 backup_transport_failure (Package|3)
+2823 backup_agent_failure (Package|3),(Message|3)
+2824 backup_package (Package|3),(Size|1|2)
+2825 backup_success (Packages|1|1),(Time|1|3)
+2826 backup_reset (Transport|3)
+2827 backup_initialize
+2830 restore_start (Transport|3),(Source|2|5)
+2831 restore_transport_failure
+2832 restore_agent_failure (Package|3),(Message|3)
+2833 restore_package (Package|3),(Size|1|2)
+2834 restore_success (Packages|1|1),(Time|1|3)
+
+
+# ---------------------------
+# SystemServer.java
+# ---------------------------
+# SystemServer.run() starts:
+3010 boot_progress_system_run (time|2|3)
+
+
+# ---------------------------
+# PackageManagerService.java
+# ---------------------------
+# Package Manager starts:
+3060 boot_progress_pms_start (time|2|3)
+# Package Manager .apk scan starts:
+3070 boot_progress_pms_system_scan_start (time|2|3)
+# Package Manager .apk scan starts:
+3080 boot_progress_pms_data_scan_start (time|2|3)
+# Package Manager .apk scan ends:
+3090 boot_progress_pms_scan_end (time|2|3)
+# Package Manager ready:
+3100 boot_progress_pms_ready (time|2|3)
+# + check activity_launch_time for Home app
+
+
+# ---------------------------
+# WindowManagerService.java
+# ---------------------------
+# Out of memory for surfaces.
+31000 wm_no_surface_memory (Window|3),(PID|1|5),(Operation|3)
+
+
+# ---------------------------
+# InputMethodManagerService.java
+# ---------------------------
+# Re-connecting to input method service because we haven't received its interface
+32000 imf_force_reconnect_ime (IME|4),(Time Since Connect|2|3),(Showing|1|1)
+
+
+# ---------------------------
+# ConnectivityService.java
+# ---------------------------
+# Connectivity state changed:
+# [31-13] Reserved for future use
+# [12- 9] Network subtype (for mobile network, as defined by TelephonyManager)
+# [ 8- 3] Detailed state ordinal (as defined by NetworkInfo.DetailedState)
+# [ 2- 0] Network type (as defined by ConnectivityManager)
+50020 connectivity_state_changed (custom|1|5)
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index e2e0ba9..a64cb1a 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -1,12 +1,12 @@
 /*
  * Copyright (C) 2006-2008 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
@@ -89,24 +89,22 @@
     static final String TAG = "InputManagerService";
 
     static final int MSG_SHOW_IM_PICKER = 1;
-    
+
     static final int MSG_UNBIND_INPUT = 1000;
     static final int MSG_BIND_INPUT = 1010;
     static final int MSG_SHOW_SOFT_INPUT = 1020;
     static final int MSG_HIDE_SOFT_INPUT = 1030;
     static final int MSG_ATTACH_TOKEN = 1040;
     static final int MSG_CREATE_SESSION = 1050;
-    
+
     static final int MSG_START_INPUT = 2000;
     static final int MSG_RESTART_INPUT = 2010;
-    
+
     static final int MSG_UNBIND_METHOD = 3000;
     static final int MSG_BIND_METHOD = 3010;
-    
+
     static final long TIME_TO_RECONNECT = 10*1000;
-    
-    static final int LOG_IMF_FORCE_RECONNECT_IME = 32000;
-    
+
     final Context mContext;
     final Handler mHandler;
     final SettingsObserver mSettingsObserver;
@@ -115,9 +113,9 @@
     final IconData mInputMethodData;
     final IWindowManager mIWindowManager;
     final HandlerCaller mCaller;
-    
+
     final InputBindResult mNoBinding = new InputBindResult(null, null, -1);
-    
+
     // All known input methods.  mMethodMap also serves as the global
     // lock for this class.
     final ArrayList<InputMethodInfo> mMethodList
@@ -127,12 +125,12 @@
 
     final TextUtils.SimpleStringSplitter mStringColonSplitter
             = new TextUtils.SimpleStringSplitter(':');
-    
+
     class SessionState {
         final ClientState client;
         final IInputMethod method;
         final IInputMethodSession session;
-        
+
         @Override
         public String toString() {
             return "SessionState{uid " + client.uid + " pid " + client.pid
@@ -150,17 +148,17 @@
             session = _session;
         }
     }
-    
+
     class ClientState {
         final IInputMethodClient client;
         final IInputContext inputContext;
         final int uid;
         final int pid;
         final InputBinding binding;
-        
+
         boolean sessionRequested;
         SessionState curSession;
-        
+
         @Override
         public String toString() {
             return "ClientState{" + Integer.toHexString(
@@ -177,122 +175,122 @@
             binding = new InputBinding(null, inputContext.asBinder(), uid, pid);
         }
     }
-    
+
     final HashMap<IBinder, ClientState> mClients
             = new HashMap<IBinder, ClientState>();
-    
+
     /**
      * Set once the system is ready to run third party code.
      */
     boolean mSystemReady;
-    
+
     /**
      * Id of the currently selected input method.
      */
     String mCurMethodId;
-    
+
     /**
      * The current binding sequence number, incremented every time there is
      * a new bind performed.
      */
     int mCurSeq;
-    
+
     /**
      * The client that is currently bound to an input method.
      */
     ClientState mCurClient;
-    
+
     /**
      * The last window token that gained focus.
      */
     IBinder mCurFocusedWindow;
-    
+
     /**
      * The input context last provided by the current client.
      */
     IInputContext mCurInputContext;
-    
+
     /**
      * The attributes last provided by the current client.
      */
     EditorInfo mCurAttribute;
-    
+
     /**
      * The input method ID of the input method service that we are currently
      * connected to or in the process of connecting to.
      */
     String mCurId;
-    
+
     /**
      * Set to true if our ServiceConnection is currently actively bound to
      * a service (whether or not we have gotten its IBinder back yet).
      */
     boolean mHaveConnection;
-    
+
     /**
      * Set if the client has asked for the input method to be shown.
      */
     boolean mShowRequested;
-    
+
     /**
      * Set if we were explicitly told to show the input method.
      */
     boolean mShowExplicitlyRequested;
-    
+
     /**
      * Set if we were forced to be shown.
      */
     boolean mShowForced;
-    
+
     /**
      * Set if we last told the input method to show itself.
      */
     boolean mInputShown;
-    
+
     /**
      * The Intent used to connect to the current input method.
      */
     Intent mCurIntent;
-    
+
     /**
      * The token we have made for the currently active input method, to
      * identify it in the future.
      */
     IBinder mCurToken;
-    
+
     /**
      * If non-null, this is the input method service we are currently connected
      * to.
      */
     IInputMethod mCurMethod;
-    
+
     /**
      * Time that we last initiated a bind to the input method, to determine
      * if we should try to disconnect and reconnect to it.
      */
     long mLastBindTime;
-    
+
     /**
      * Have we called mCurMethod.bindInput()?
      */
     boolean mBoundToMethod;
-    
+
     /**
      * Currently enabled session.  Only touched by service thread, not
      * protected by a lock.
      */
     SessionState mEnabledSession;
-    
+
     /**
      * True if the screen is on.  The value is true initially.
      */
     boolean mScreenOn = true;
-    
+
     AlertDialog.Builder mDialogBuilder;
     AlertDialog mSwitchingDialog;
     InputMethodInfo[] mIms;
     CharSequence[] mItems;
-    
+
     class SettingsObserver extends ContentObserver {
         SettingsObserver(Handler handler) {
             super(handler);
@@ -300,14 +298,14 @@
             resolver.registerContentObserver(Settings.Secure.getUriFor(
                     Settings.Secure.DEFAULT_INPUT_METHOD), false, this);
         }
-        
+
         @Override public void onChange(boolean selfChange) {
             synchronized (mMethodMap) {
                 updateFromSettingsLocked();
             }
         }
     }
-    
+
     class ScreenOnOffReceiver extends android.content.BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {
@@ -333,13 +331,13 @@
             }
         }
     }
-    
+
     class PackageReceiver extends android.content.BroadcastReceiver {
         @Override
         public void onReceive(Context context, Intent intent) {
             synchronized (mMethodMap) {
                 buildInputMethodListLocked(mMethodList, mMethodMap);
-                
+
                 InputMethodInfo curIm = null;
                 String curInputMethodId = Settings.Secure.getString(context
                         .getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
@@ -351,9 +349,9 @@
                         }
                     }
                 }
-                
+
                 boolean changed = false;
-                
+
                 Uri uri = intent.getData();
                 String pkg = uri != null ? uri.getSchemeSpecificPart() : null;
                 if (curIm != null && curIm.getPackageName().equals(pkg)) {
@@ -377,27 +375,27 @@
                                     curInputMethodId);
                         }
                     }
-                    
+
                 } else if (curIm == null) {
                     // We currently don't have a default input method... is
                     // one now available?
                     changed = chooseNewDefaultIME();
                 }
-                
+
                 if (changed) {
                     updateFromSettingsLocked();
                 }
             }
         }
     }
-    
+
     class MethodCallback extends IInputMethodCallback.Stub {
         final IInputMethod mMethod;
-        
+
         MethodCallback(IInputMethod method) {
             mMethod = method;
         }
-        
+
         public void finishedEvent(int seq, boolean handled) throws RemoteException {
         }
 
@@ -405,7 +403,7 @@
             onSessionCreated(mMethod, session);
         }
     }
-    
+
     public InputMethodManagerService(Context context, StatusBarService statusBar) {
         mContext = context;
         mHandler = new Handler(this);
@@ -416,7 +414,7 @@
                 handleMessage(msg);
             }
         });
-        
+
         IntentFilter packageFilt = new IntentFilter();
         packageFilt.addAction(Intent.ACTION_PACKAGE_ADDED);
         packageFilt.addAction(Intent.ACTION_PACKAGE_CHANGED);
@@ -424,13 +422,13 @@
         packageFilt.addAction(Intent.ACTION_PACKAGE_RESTARTED);
         packageFilt.addDataScheme("package");
         mContext.registerReceiver(new PackageReceiver(), packageFilt);
-        
+
         IntentFilter screenOnOffFilt = new IntentFilter();
         screenOnOffFilt.addAction(Intent.ACTION_SCREEN_ON);
         screenOnOffFilt.addAction(Intent.ACTION_SCREEN_OFF);
         screenOnOffFilt.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
         mContext.registerReceiver(new ScreenOnOffReceiver(), screenOnOffFilt);
-        
+
         buildInputMethodListLocked(mMethodList, mMethodMap);
 
         final String enabledStr = Settings.Secure.getString(
@@ -471,12 +469,12 @@
                         Settings.Secure.DEFAULT_INPUT_METHOD, defIm.getId());
             }
         }
-        
+
         mStatusBar = statusBar;
         mInputMethodData = IconData.makeIcon("ime", null, 0, 0, 0);
         mInputMethodIcon = statusBar.addIcon(mInputMethodData, null);
         statusBar.setIconVisibility(mInputMethodIcon, false);
-        
+
         mSettingsObserver = new SettingsObserver(mHandler);
         updateFromSettingsLocked();
     }
@@ -508,7 +506,7 @@
             }
         }
     }
-    
+
     public List<InputMethodInfo> getInputMethodList() {
         synchronized (mMethodMap) {
             return new ArrayList<InputMethodInfo>(mMethodList);
@@ -523,14 +521,14 @@
 
     List<InputMethodInfo> getEnabledInputMethodListLocked() {
         final ArrayList<InputMethodInfo> res = new ArrayList<InputMethodInfo>();
-        
+
         final String enabledStr = Settings.Secure.getString(
                 mContext.getContentResolver(),
                 Settings.Secure.ENABLED_INPUT_METHODS);
         if (enabledStr != null) {
             final TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
             splitter.setString(enabledStr);
-            
+
             while (splitter.hasNext()) {
                 InputMethodInfo info = mMethodMap.get(splitter.next());
                 if (info != null) {
@@ -538,7 +536,7 @@
                 }
             }
         }
-        
+
         return res;
     }
 
@@ -549,13 +547,13 @@
                     inputContext, uid, pid));
         }
     }
-    
+
     public void removeClient(IInputMethodClient client) {
         synchronized (mMethodMap) {
             mClients.remove(client.asBinder());
         }
     }
-    
+
     void executeOrSendMessage(IInterface target, Message msg) {
          if (target.asBinder() instanceof Binder) {
              mCaller.sendMessage(msg);
@@ -564,7 +562,7 @@
              msg.recycle();
          }
     }
-    
+
     void unbindCurrentClientLocked() {
         if (mCurClient != null) {
             if (DEBUG) Log.v(TAG, "unbindCurrentInputLocked: client = "
@@ -579,7 +577,7 @@
             executeOrSendMessage(mCurClient.client, mCaller.obtainMessageIO(
                     MSG_UNBIND_METHOD, mCurSeq, mCurClient.client));
             mCurClient.sessionRequested = false;
-            
+
             // Call setActive(false) on the old client
             try {
                 mCurClient.client.setActive(false);
@@ -588,11 +586,11 @@
                         + mCurClient.pid + " uid " + mCurClient.uid);
             }
             mCurClient = null;
-            
+
             hideInputMethodMenuLocked();
         }
     }
-    
+
     private int getImeShowFlags() {
         int flags = 0;
         if (mShowForced) {
@@ -603,7 +601,7 @@
         }
         return flags;
     }
-    
+
     private int getAppShowFlags() {
         int flags = 0;
         if (mShowForced) {
@@ -613,7 +611,7 @@
         }
         return flags;
     }
-    
+
     InputBindResult attachNewInputLocked(boolean initial, boolean needResult) {
         if (!mBoundToMethod) {
             executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
@@ -636,7 +634,7 @@
                 ? new InputBindResult(session.session, mCurId, mCurSeq)
                 : null;
     }
-    
+
     InputBindResult startInputLocked(IInputMethodClient client,
             IInputContext inputContext, EditorInfo attribute,
             boolean initial, boolean needResult) {
@@ -644,13 +642,13 @@
         if (mCurMethodId == null) {
             return mNoBinding;
         }
-        
+
         ClientState cs = mClients.get(client.asBinder());
         if (cs == null) {
             throw new IllegalArgumentException("unknown client "
                     + client.asBinder());
         }
-        
+
         try {
             if (!mIWindowManager.inputMethodClientHasFocus(cs.client)) {
                 // Check with the window manager to make sure this client actually
@@ -664,7 +662,7 @@
             }
         } catch (RemoteException e) {
         }
-        
+
         if (mCurClient != cs) {
             // If the client is changing, we need to switch over to the new
             // one.
@@ -682,14 +680,14 @@
                 }
             }
         }
-        
+
         // Bump up the sequence for this client and attach it.
         mCurSeq++;
         if (mCurSeq <= 0) mCurSeq = 1;
         mCurClient = cs;
         mCurInputContext = inputContext;
         mCurAttribute = attribute;
-        
+
         // Check if the input method is changing.
         if (mCurId != null && mCurId.equals(mCurMethodId)) {
             if (cs.curSession != null) {
@@ -720,33 +718,33 @@
                     // to see if we can get back in touch with the service.
                     return new InputBindResult(null, mCurId, mCurSeq);
                 } else {
-                    EventLog.writeEvent(LOG_IMF_FORCE_RECONNECT_IME, mCurMethodId,
-                            SystemClock.uptimeMillis()-mLastBindTime, 0);
+                    EventLog.writeEvent(EventLogTags.IMF_FORCE_RECONNECT_IME,
+                            mCurMethodId, SystemClock.uptimeMillis()-mLastBindTime, 0);
                 }
             }
         }
-        
+
         return startInputInnerLocked();
     }
-    
+
     InputBindResult startInputInnerLocked() {
         if (mCurMethodId == null) {
             return mNoBinding;
         }
-        
+
         if (!mSystemReady) {
             // If the system is not yet ready, we shouldn't be running third
             // party code.
             return new InputBindResult(null, mCurMethodId, mCurSeq);
         }
-        
+
         InputMethodInfo info = mMethodMap.get(mCurMethodId);
         if (info == null) {
             throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
         }
-        
+
         unbindCurrentMethodLocked(false);
-        
+
         mCurIntent = new Intent(InputMethod.SERVICE_INTERFACE);
         mCurIntent.setComponent(info.getComponent());
         mCurIntent.putExtra(Intent.EXTRA_CLIENT_LABEL,
@@ -772,7 +770,7 @@
         }
         return null;
     }
-    
+
     public InputBindResult startInput(IInputMethodClient client,
             IInputContext inputContext, EditorInfo attribute,
             boolean initial, boolean needResult) {
@@ -786,10 +784,10 @@
             }
         }
     }
-    
+
     public void finishInput(IInputMethodClient client) {
     }
-    
+
     public void onServiceConnected(ComponentName name, IBinder service) {
         synchronized (mMethodMap) {
             if (mCurIntent != null && name.equals(mCurIntent.getComponent())) {
@@ -830,13 +828,13 @@
             }
         }
     }
-    
+
     void unbindCurrentMethodLocked(boolean reportToClient) {
         if (mHaveConnection) {
             mContext.unbindService(this);
             mHaveConnection = false;
         }
-        
+
         if (mCurToken != null) {
             try {
                 if (DEBUG) Log.v(TAG, "Removing window token: " + mCurToken);
@@ -845,16 +843,16 @@
             }
             mCurToken = null;
         }
-        
+
         mCurId = null;
         clearCurMethodLocked();
-        
+
         if (reportToClient && mCurClient != null) {
             executeOrSendMessage(mCurClient.client, mCaller.obtainMessageIO(
                     MSG_UNBIND_METHOD, mCurSeq, mCurClient.client));
         }
     }
-    
+
     void clearCurMethodLocked() {
         if (mCurMethod != null) {
             for (ClientState cs : mClients.values()) {
@@ -865,7 +863,7 @@
         }
         mStatusBar.setIconVisibility(mInputMethodIcon, false);
     }
-    
+
     public void onServiceDisconnected(ComponentName name) {
         synchronized (mMethodMap) {
             if (DEBUG) Log.v(TAG, "Service disconnected: " + name
@@ -893,7 +891,7 @@
                 Log.w(TAG, "Ignoring setInputMethod of token: " + token);
                 return;
             }
-            
+
             synchronized (mMethodMap) {
                 if (iconId == 0) {
                     if (DEBUG) Log.d(TAG, "hide the small icon for the input method");
@@ -932,17 +930,17 @@
             unbindCurrentMethodLocked(true);
         }
     }
-    
+
     void setInputMethodLocked(String id) {
         InputMethodInfo info = mMethodMap.get(id);
         if (info == null) {
             throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
         }
-        
+
         if (id.equals(mCurMethodId)) {
             return;
         }
-        
+
         final long ident = Binder.clearCallingIdentity();
         try {
             mCurMethodId = id;
@@ -959,7 +957,7 @@
             Binder.restoreCallingIdentity(ident);
         }
     }
-    
+
     public boolean showSoftInput(IInputMethodClient client, int flags,
             ResultReceiver resultReceiver) {
         long ident = Binder.clearCallingIdentity();
@@ -979,7 +977,7 @@
                         return false;
                     }
                 }
-    
+
                 if (DEBUG) Log.v(TAG, "Client requesting input be shown");
                 return showCurrentInputLocked(flags, resultReceiver);
             }
@@ -987,7 +985,7 @@
             Binder.restoreCallingIdentity(ident);
         }
     }
-    
+
     boolean showCurrentInputLocked(int flags, ResultReceiver resultReceiver) {
         mShowRequested = true;
         if ((flags&InputMethodManager.SHOW_IMPLICIT) == 0) {
@@ -997,11 +995,11 @@
             mShowExplicitlyRequested = true;
             mShowForced = true;
         }
-        
+
         if (!mSystemReady) {
             return false;
         }
-        
+
         boolean res = false;
         if (mCurMethod != null) {
             executeOrSendMessage(mCurMethod, mCaller.obtainMessageIOO(
@@ -1015,15 +1013,15 @@
             // we have been sitting here too long with a connection to the
             // service and no interface received, so let's disconnect/connect
             // to try to prod things along.
-            EventLog.writeEvent(LOG_IMF_FORCE_RECONNECT_IME, mCurMethodId,
+            EventLog.writeEvent(EventLogTags.IMF_FORCE_RECONNECT_IME, mCurMethodId,
                     SystemClock.uptimeMillis()-mLastBindTime,1);
             mContext.unbindService(this);
             mContext.bindService(mCurIntent, this, Context.BIND_AUTO_CREATE);
         }
-        
+
         return res;
     }
-    
+
     public boolean hideSoftInput(IInputMethodClient client, int flags,
             ResultReceiver resultReceiver) {
         long ident = Binder.clearCallingIdentity();
@@ -1043,7 +1041,7 @@
                         return false;
                     }
                 }
-    
+
                 if (DEBUG) Log.v(TAG, "Client requesting input be hidden");
                 return hideCurrentInputLocked(flags, resultReceiver);
             }
@@ -1051,7 +1049,7 @@
             Binder.restoreCallingIdentity(ident);
         }
     }
-    
+
     boolean hideCurrentInputLocked(int flags, ResultReceiver resultReceiver) {
         if ((flags&InputMethodManager.HIDE_IMPLICIT_ONLY) != 0
                 && (mShowExplicitlyRequested || mShowForced)) {
@@ -1078,7 +1076,7 @@
         mShowForced = false;
         return res;
     }
-    
+
     public void windowGainedFocus(IInputMethodClient client, IBinder windowToken,
             boolean viewHasFocus, boolean isTextEditor, int softInputMode,
             boolean first, int windowFlags) {
@@ -1091,7 +1089,7 @@
                         + " softInputMode=#" + Integer.toHexString(softInputMode)
                         + " first=" + first + " flags=#"
                         + Integer.toHexString(windowFlags));
-                
+
                 if (mCurClient == null || client == null
                         || mCurClient.client.asBinder() != client.asBinder()) {
                     try {
@@ -1105,13 +1103,13 @@
                     } catch (RemoteException e) {
                     }
                 }
-    
+
                 if (mCurFocusedWindow == windowToken) {
                     Log.w(TAG, "Window already focused, ignoring focus gain of: " + client);
                     return;
                 }
                 mCurFocusedWindow = windowToken;
-                
+
                 switch (softInputMode&WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE) {
                     case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED:
                         if (!isTextEditor || (softInputMode &
@@ -1166,7 +1164,7 @@
             Binder.restoreCallingIdentity(ident);
         }
     }
-    
+
     public void showInputMethodPickerFromClient(IInputMethodClient client) {
         synchronized (mMethodMap) {
             if (mCurClient == null || client == null
@@ -1216,7 +1214,7 @@
             }
         }
     }
-    
+
     public void showMySoftInput(IBinder token, int flags) {
         synchronized (mMethodMap) {
             if (token == null || mCurToken != token) {
@@ -1251,16 +1249,16 @@
             }
         }
     }
-    
+
     public boolean handleMessage(Message msg) {
         HandlerCaller.SomeArgs args;
         switch (msg.what) {
             case MSG_SHOW_IM_PICKER:
                 showInputMethodMenu();
                 return true;
-            
+
             // ---------------------------------------------------------
-                
+
             case MSG_UNBIND_INPUT:
                 try {
                     ((IInputMethod)msg.obj).unbindInput();
@@ -1308,7 +1306,7 @@
                 }
                 return true;
             // ---------------------------------------------------------
-                
+
             case MSG_START_INPUT:
                 args = (HandlerCaller.SomeArgs)msg.obj;
                 try {
@@ -1329,9 +1327,9 @@
                 } catch (RemoteException e) {
                 }
                 return true;
-                
+
             // ---------------------------------------------------------
-                
+
             case MSG_UNBIND_METHOD:
                 try {
                     ((IInputMethodClient)msg.obj).onUnbindMethod(msg.arg1);
@@ -1373,13 +1371,13 @@
             HashMap<String, InputMethodInfo> map) {
         list.clear();
         map.clear();
-        
+
         PackageManager pm = mContext.getPackageManager();
 
         List<ResolveInfo> services = pm.queryIntentServices(
                 new Intent(InputMethod.SERVICE_INTERFACE),
                 PackageManager.GET_META_DATA);
-        
+
         for (int i = 0; i < services.size(); ++i) {
             ResolveInfo ri = services.get(i);
             ServiceInfo si = ri.serviceInfo;
@@ -1407,7 +1405,7 @@
                 if (DEBUG) {
                     Log.d(TAG, "Found a third-party input method " + p);
                 }
-                
+
             } catch (XmlPullParserException e) {
                 Log.w(TAG, "Unable to load input method " + compName, e);
             } catch (IOException e) {
@@ -1423,24 +1421,24 @@
             }
         }
     }
-    
+
     // ----------------------------------------------------------------------
-    
+
     void showInputMethodMenu() {
         if (DEBUG) Log.v(TAG, "Show switching menu");
 
         hideInputMethodMenu();
-        
+
         final Context context = mContext;
-        
+
         final PackageManager pm = context.getPackageManager();
-        
+
         String lastInputMethodId = Settings.Secure.getString(context
                 .getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
         if (DEBUG) Log.v(TAG, "Current IME: " + lastInputMethodId);
-        
+
         final List<InputMethodInfo> immis = getEnabledInputMethodList();
-        
+
         int N = (immis == null ? 0 : immis.size());
 
         mItems = new CharSequence[N];
@@ -1465,7 +1463,7 @@
                 hideInputMethodMenu();
             }
         };
-        
+
         TypedArray a = context.obtainStyledAttributes(null,
                 com.android.internal.R.styleable.DialogPreference,
                 com.android.internal.R.attr.alertDialogStyle, 0);
@@ -1479,7 +1477,7 @@
                 .setIcon(a.getDrawable(
                         com.android.internal.R.styleable.DialogPreference_dialogTitle));
         a.recycle();
-        
+
         mDialogBuilder.setSingleChoiceItems(mItems, checkedItem,
                 new AlertDialog.OnClickListener() {
                     public void onClick(DialogInterface dialog, int which) {
@@ -1498,13 +1496,13 @@
             mSwitchingDialog.show();
         }
     }
-    
+
     void hideInputMethodMenu() {
         synchronized (mMethodMap) {
             hideInputMethodMenuLocked();
         }
     }
-    
+
     void hideInputMethodMenuLocked() {
         if (DEBUG) Log.v(TAG, "Hide switching menu");
 
@@ -1512,14 +1510,14 @@
             mSwitchingDialog.dismiss();
             mSwitchingDialog = null;
         }
-        
+
         mDialogBuilder = null;
         mItems = null;
         mIms = null;
     }
-    
+
     // ----------------------------------------------------------------------
-    
+
     public boolean setInputMethodEnabled(String id, boolean enabled) {
         synchronized (mMethodMap) {
             if (mContext.checkCallingOrSelfPermission(
@@ -1529,7 +1527,7 @@
                         "Requires permission "
                         + android.Manifest.permission.WRITE_SECURE_SETTINGS);
             }
-            
+
             long ident = Binder.clearCallingIdentity();
             try {
                 // Make sure this is a valid input method.
@@ -1539,12 +1537,12 @@
                         throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
                     }
                 }
-                
+
                 StringBuilder builder = new StringBuilder(256);
-                
+
                 boolean removed = false;
                 String firstId = null;
-                
+
                 // Look through the currently enabled input methods.
                 String enabledStr = Settings.Secure.getString(mContext.getContentResolver(),
                         Settings.Secure.ENABLED_INPUT_METHODS);
@@ -1573,7 +1571,7 @@
                         }
                     }
                 }
-                
+
                 if (!enabled) {
                     if (!removed) {
                         // We are disabling the input method but it is already
@@ -1596,17 +1594,17 @@
                     // Previous state was enabled.
                     return true;
                 }
-                
+
                 // Add in the newly enabled input method.
                 if (enabledStr == null || enabledStr.length() == 0) {
                     enabledStr = id;
                 } else {
                     enabledStr = enabledStr + ':' + id;
                 }
-                
+
                 Settings.Secure.putString(mContext.getContentResolver(),
                         Settings.Secure.ENABLED_INPUT_METHODS, enabledStr);
-                
+
                 // Previous state was disabled.
                 return false;
             } finally {
@@ -1616,12 +1614,12 @@
     }
 
     // ----------------------------------------------------------------------
-    
+
     @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
                 != PackageManager.PERMISSION_GRANTED) {
-            
+
             pw.println("Permission Denial: can't dump InputMethodManager from from pid="
                     + Binder.getCallingPid()
                     + ", uid=" + Binder.getCallingUid());
@@ -1630,9 +1628,9 @@
 
         IInputMethod method;
         ClientState client;
-        
+
         final Printer p = new PrintWriterPrinter(pw);
-        
+
         synchronized (mMethodMap) {
             p.println("Current Input Method Manager state:");
             int N = mMethodList.size();
@@ -1669,7 +1667,7 @@
                     + " mInputShown=" + mInputShown);
             p.println("  mSystemReady=" + mSystemReady + " mScreenOn=" + mScreenOn);
         }
-        
+
         if (client != null) {
             p.println(" ");
             pw.flush();
@@ -1679,7 +1677,7 @@
                 p.println("Input method client dead: " + e);
             }
         }
-        
+
         if (method != null) {
             p.println(" ");
             pw.flush();
diff --git a/services/java/com/android/server/NotificationManagerService.java b/services/java/com/android/server/NotificationManagerService.java
index 147580b..436a60e 100755
--- a/services/java/com/android/server/NotificationManagerService.java
+++ b/services/java/com/android/server/NotificationManagerService.java
@@ -75,8 +75,8 @@
 
     private static final int LONG_DELAY = 3500; // 3.5 seconds
     private static final int SHORT_DELAY = 2000; // 2 seconds
-    
-    private static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250}; 
+
+    private static final long[] DEFAULT_VIBRATE_PATTERN = {0, 250, 250, 250};
 
     private static final int DEFAULT_STREAM_TYPE = AudioManager.STREAM_NOTIFICATION;
 
@@ -108,7 +108,7 @@
     private boolean mAdbEnabled = false;
     private boolean mAdbNotificationShown = false;
     private Notification mAdbNotification;
-    
+
     private final ArrayList<NotificationRecord> mNotificationList =
             new ArrayList<NotificationRecord>();
 
@@ -127,11 +127,6 @@
     private static final int BATTERY_BLINK_ON = 125;
     private static final int BATTERY_BLINK_OFF = 2875;
 
-    // Tag IDs for EventLog.
-    private static final int EVENT_LOG_ENQUEUE = 2750;
-    private static final int EVENT_LOG_CANCEL = 2751;
-    private static final int EVENT_LOG_CANCEL_ALL = 2752;
-
     private static String idDebugString(Context baseContext, String packageName, int id) {
         Context c = null;
 
@@ -191,7 +186,7 @@
                     + " ledOnMS=" + notification.ledOnMS
                     + " ledOffMS=" + notification.ledOffMS);
         }
-        
+
         @Override
         public final String toString()
         {
@@ -221,11 +216,11 @@
         void update(int duration) {
             this.duration = duration;
         }
-        
+
         void dump(PrintWriter pw, String prefix) {
             pw.println(prefix + this);
         }
-        
+
         @Override
         public final String toString()
         {
@@ -354,7 +349,7 @@
         SettingsObserver(Handler handler) {
             super(handler);
         }
-        
+
         void observe() {
             ContentResolver resolver = mContext.getContentResolver();
             resolver.registerContentObserver(Settings.Secure.getUriFor(
@@ -422,7 +417,7 @@
         filter.addAction(Intent.ACTION_SCREEN_ON);
         filter.addAction(Intent.ACTION_SCREEN_OFF);
         mContext.registerReceiver(mIntentReceiver, filter);
-        
+
         SettingsObserver observer = new SettingsObserver(mHandler);
         observer.observe();
     }
@@ -621,12 +616,12 @@
             Notification notification, int[] idOut)
     {
         checkIncomingCall(pkg);
-        
+
         // This conditional is a dirty hack to limit the logging done on
         //     behalf of the download manager without affecting other apps.
         if (!pkg.equals("com.android.providers.downloads")
                 || Log.isLoggable("DownloadManager", Log.VERBOSE)) {
-            EventLog.writeEvent(EVENT_LOG_ENQUEUE, pkg, id, notification.toString());
+            EventLog.writeEvent(EventLogTags.NOTIFICATION_ENQUEUE, pkg, id, notification.toString());
         }
 
         if (pkg == null || notification == null) {
@@ -660,20 +655,20 @@
                         old.notification.flags&Notification.FLAG_FOREGROUND_SERVICE;
                 }
             }
-            
+
             // Ensure if this is a foreground service that the proper additional
             // flags are set.
             if ((notification.flags&Notification.FLAG_FOREGROUND_SERVICE) != 0) {
                 notification.flags |= Notification.FLAG_ONGOING_EVENT
                         | Notification.FLAG_NO_CLEAR;
             }
-            
+
             if (notification.icon != 0) {
                 IconData icon = IconData.makeIcon(null, pkg, notification.icon,
                                                     notification.iconLevel,
                                                     notification.number);
                 CharSequence truncatedTicker = notification.tickerText;
-                
+
                 // TODO: make this restriction do something smarter like never fill
                 // more than two screens.  "Why would anyone need more than 80 characters." :-/
                 final int maxTickerLen = 80;
@@ -738,7 +733,7 @@
                 .getSystemService(Context.AUDIO_SERVICE);
                 // sound
                 final boolean useDefaultSound =
-                    (notification.defaults & Notification.DEFAULT_SOUND) != 0; 
+                    (notification.defaults & Notification.DEFAULT_SOUND) != 0;
                 if (useDefaultSound || notification.sound != null) {
                     Uri uri;
                     if (useDefaultSound) {
@@ -769,12 +764,12 @@
 
                 // vibrate
                 final boolean useDefaultVibrate =
-                    (notification.defaults & Notification.DEFAULT_VIBRATE) != 0; 
+                    (notification.defaults & Notification.DEFAULT_VIBRATE) != 0;
                 if ((useDefaultVibrate || notification.vibrate != null)
                         && audioManager.shouldVibrate(AudioManager.VIBRATE_TYPE_NOTIFICATION)) {
                     mVibrateNotification = r;
 
-                    mVibrator.vibrate(useDefaultVibrate ? DEFAULT_VIBRATE_PATTERN 
+                    mVibrator.vibrate(useDefaultVibrate ? DEFAULT_VIBRATE_PATTERN
                                                         : notification.vibrate,
                               ((notification.flags & Notification.FLAG_INSISTENT) != 0) ? 0: -1);
                 }
@@ -869,24 +864,24 @@
 
     /**
      * Cancels a notification ONLY if it has all of the {@code mustHaveFlags}
-     * and none of the {@code mustNotHaveFlags}. 
+     * and none of the {@code mustNotHaveFlags}.
      */
     private void cancelNotification(String pkg, String tag, int id, int mustHaveFlags,
             int mustNotHaveFlags) {
-        EventLog.writeEvent(EVENT_LOG_CANCEL, pkg, id, mustHaveFlags);
+        EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL, pkg, id, mustHaveFlags);
 
         synchronized (mNotificationList) {
             int index = indexOfNotificationLocked(pkg, tag, id);
             if (index >= 0) {
                 NotificationRecord r = mNotificationList.get(index);
-                
+
                 if ((r.notification.flags & mustHaveFlags) != mustHaveFlags) {
                     return;
                 }
                 if ((r.notification.flags & mustNotHaveFlags) != 0) {
                     return;
                 }
-                
+
                 mNotificationList.remove(index);
 
                 cancelNotificationLocked(r);
@@ -901,7 +896,7 @@
      */
     void cancelAllNotificationsInt(String pkg, int mustHaveFlags,
             int mustNotHaveFlags) {
-        EventLog.writeEvent(EVENT_LOG_CANCEL_ALL, pkg, mustHaveFlags);
+        EventLog.writeEvent(EventLogTags.NOTIFICATION_CANCEL_ALL, pkg, mustHaveFlags);
 
         synchronized (mNotificationList) {
             final int N = mNotificationList.size();
@@ -927,7 +922,7 @@
         }
     }
 
-    
+
     public void cancelNotification(String pkg, int id) {
         cancelNotificationWithTag(pkg, null /* tag */, id);
     }
@@ -942,7 +937,7 @@
 
     public void cancelAllNotifications(String pkg) {
         checkIncomingCall(pkg);
-        
+
         // Calling from user space, don't allow the canceling of actively
         // running foreground services.
         cancelAllNotificationsInt(pkg, 0, Notification.FLAG_FOREGROUND_SERVICE);
@@ -964,7 +959,7 @@
             throw new SecurityException("Unknown package " + pkg);
         }
     }
-    
+
     void cancelAll() {
         synchronized (mNotificationList) {
             final int N = mNotificationList.size();
@@ -1103,14 +1098,14 @@
                             intent, 0);
 
                     mAdbNotification.setLatestEventInfo(mContext, title, message, pi);
-                    
+
                     mAdbNotificationShown = true;
                     notificationManager.notify(
                             com.android.internal.R.string.adb_active_notification_title,
                             mAdbNotification);
                 }
             }
-            
+
         } else if (mAdbNotificationShown) {
             NotificationManager notificationManager = (NotificationManager) mContext
                     .getSystemService(Context.NOTIFICATION_SERVICE);
@@ -1138,7 +1133,7 @@
                     + ", uid=" + Binder.getCallingUid());
             return;
         }
-        
+
         pw.println("Current Notification Manager state:");
 
         int N;
@@ -1152,7 +1147,7 @@
                 }
                 pw.println("  ");
             }
-            
+
         }
 
         synchronized (mNotificationList) {
@@ -1164,7 +1159,7 @@
                 }
                 pw.println("  ");
             }
-            
+
             N = mLights.size();
             if (N > 0) {
                 pw.println("  Lights List:");
@@ -1173,7 +1168,7 @@
                 }
                 pw.println("  ");
             }
-            
+
             pw.println("  mSoundNotification=" + mSoundNotification);
             pw.println("  mSound=" + mSound);
             pw.println("  mVibrateNotification=" + mVibrateNotification);
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 9382146..3320a53 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -135,12 +135,6 @@
     static final int SCAN_UPDATE_SIGNATURE = 1<<3;
     static final int SCAN_FORWARD_LOCKED = 1<<4;
     static final int SCAN_NEW_INSTALL = 1<<5;
-    
-    static final int LOG_BOOT_PROGRESS_PMS_START = 3060;
-    static final int LOG_BOOT_PROGRESS_PMS_SYSTEM_SCAN_START = 3070;
-    static final int LOG_BOOT_PROGRESS_PMS_DATA_SCAN_START = 3080;
-    static final int LOG_BOOT_PROGRESS_PMS_SCAN_END = 3090;
-    static final int LOG_BOOT_PROGRESS_PMS_READY = 3100;
 
     final HandlerThread mHandlerThread = new HandlerThread("PackageManager",
             Process.THREAD_PRIORITY_BACKGROUND);
@@ -149,7 +143,7 @@
     final int mSdkVersion = Build.VERSION.SDK_INT;
     final String mSdkCodename = "REL".equals(Build.VERSION.CODENAME)
             ? null : Build.VERSION.CODENAME;
-    
+
     final Context mContext;
     final boolean mFactoryTest;
     final boolean mNoDexOpt;
@@ -175,7 +169,7 @@
     // Used for priviledge escalation.  MUST NOT BE CALLED WITH mPackages
     // LOCK HELD.  Can be called with mInstallLock held.
     final Installer mInstaller;
-    
+
     final File mFrameworkDir;
     final File mSystemAppDir;
     final File mAppInstallDir;
@@ -184,14 +178,14 @@
     // Directory containing the private parts (e.g. code and non-resource assets) of forward-locked
     // apps.
     final File mDrmAppPrivateInstallDir;
-    
+
     // ----------------------------------------------------------------
-    
+
     // Lock for state used when installing and doing other long running
     // operations.  Methods that must be called with this lock held have
     // the prefix "LI".
     final Object mInstallLock = new Object();
-    
+
     // These are the directories in the 3rd party applications installed dir
     // that we have currently loaded packages from.  Keys are the application's
     // installed zip file (absolute codePath), and values are Package.
@@ -205,7 +199,7 @@
     final int[] mOutPermissions = new int[3];
 
     // ----------------------------------------------------------------
-    
+
     // Keys are String (package name), values are Package.  This also serves
     // as the lock for the global state.  Methods that must be called with
     // this lock held have the prefix "LP".
@@ -223,19 +217,19 @@
     // etc/permissions.xml file.
     final SparseArray<HashSet<String>> mSystemPermissions =
             new SparseArray<HashSet<String>>();
-    
+
     // These are the built-in shared libraries that were read from the
     // etc/permissions.xml file.
     final HashMap<String, String> mSharedLibraries = new HashMap<String, String>();
-    
+
     // Temporary for building the final shared libraries for an .apk.
     String[] mTmpSharedLibraries = null;
-    
+
     // These are the features this devices supports that were read from the
     // etc/permissions.xml file.
     final HashMap<String, FeatureInfo> mAvailableFeatures =
             new HashMap<String, FeatureInfo>();
-    
+
     // All available activities, for your resolving pleasure.
     final ActivityIntentResolver mActivities =
             new ActivityIntentResolver();
@@ -266,7 +260,7 @@
 
     // Broadcast actions that are only available to the system.
     final HashSet<String> mProtectedBroadcasts = new HashSet<String>();
-    
+
     boolean mSystemReady;
     boolean mSafeMode;
     boolean mHasSystemUidErrors;
@@ -344,7 +338,7 @@
             count++;
             i++;
         }
-        
+
         String[] res = new String[count];
         i=0;
         count = 0;
@@ -358,15 +352,15 @@
         res[count] = str.substring(lastI, str.length());
         return res;
     }
-    
+
     public PackageManagerService(Context context, boolean factoryTest) {
-        EventLog.writeEvent(LOG_BOOT_PROGRESS_PMS_START,
+        EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_START,
                 SystemClock.uptimeMillis());
-        
+
         if (mSdkVersion <= 0) {
             Log.w(TAG, "**** ro.build.version.sdk not set!");
         }
-        
+
         mContext = context;
         mFactoryTest = factoryTest;
         mNoDexOpt = "eng".equals(SystemProperties.get("ro.build.type"));
@@ -399,7 +393,7 @@
             mDefParseFlags = 0;
             mSeparateProcesses = null;
         }
-        
+
         Installer installer = new Installer();
         // Little hacky thing to check if installd is here, to determine
         // whether we are running on the simulator and thus need to take
@@ -419,7 +413,7 @@
         synchronized (mPackages) {
             mHandlerThread.start();
             mHandler = new PackageHandler(mHandlerThread.getLooper());
-            
+
             File dataDir = Environment.getDataDirectory();
             mAppDataDir = new File(dataDir, "data");
             mDrmAppPrivateInstallDir = new File(dataDir, "app-private");
@@ -438,24 +432,24 @@
 
             mRestoredSettings = mSettings.readLP();
             long startTime = SystemClock.uptimeMillis();
-            
-            EventLog.writeEvent(LOG_BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,
+
+            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SYSTEM_SCAN_START,
                     startTime);
-            
+
             int scanMode = SCAN_MONITOR;
             if (mNoDexOpt) {
                 Log.w(TAG, "Running ENG build: no pre-dexopt!");
-                scanMode |= SCAN_NO_DEX; 
+                scanMode |= SCAN_NO_DEX;
             }
-            
+
             final HashSet<String> libFiles = new HashSet<String>();
-            
+
             mFrameworkDir = new File(Environment.getRootDirectory(), "framework");
             mDalvikCacheDir = new File(dataDir, "dalvik-cache");
-            
+
             if (mInstaller != null) {
                 boolean didDexOpt = false;
-                
+
                 /**
                  * Out of paranoia, ensure that everything in the boot class
                  * path has been dexed.
@@ -479,7 +473,7 @@
                 } else {
                     Log.w(TAG, "No BOOTCLASSPATH found!");
                 }
-                
+
                 /**
                  * Also ensure all external libraries have had dexopt run on them.
                  */
@@ -500,11 +494,11 @@
                         }
                     }
                 }
-                
+
                 // Gross hack for now: we know this file doesn't contain any
                 // code, so don't dexopt it to avoid the resulting log spew.
                 libFiles.add(mFrameworkDir.getPath() + "/framework-res.apk");
-                
+
                 /**
                  * And there are a number of commands implemented in Java, which
                  * we currently need to do the dexopt on so that they can be
@@ -535,7 +529,7 @@
                         }
                     }
                 }
-                
+
                 if (didDexOpt) {
                     // If we had to do a dexopt of one of the previous
                     // things, then something on the system has changed.
@@ -555,7 +549,7 @@
                     }
                 }
             }
-            
+
             mFrameworkInstallObserver = new AppDirObserver(
                 mFrameworkDir.getPath(), OBSERVER_EVENTS, true);
             mFrameworkInstallObserver.startWatching();
@@ -581,8 +575,8 @@
             }
             //delete tmp files
             deleteTempPackageFiles();
-            
-            EventLog.writeEvent(LOG_BOOT_PROGRESS_PMS_DATA_SCAN_START,
+
+            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_DATA_SCAN_START,
                     SystemClock.uptimeMillis());
             mAppInstallObserver = new AppDirObserver(
                 mAppInstallDir.getPath(), OBSERVER_EVENTS, false);
@@ -594,7 +588,7 @@
             mDrmAppInstallObserver.startWatching();
             scanDirLI(mDrmAppPrivateInstallDir, 0, scanMode | SCAN_FORWARD_LOCKED);
 
-            EventLog.writeEvent(LOG_BOOT_PROGRESS_PMS_SCAN_END,
+            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_SCAN_END,
                     SystemClock.uptimeMillis());
             Log.i(TAG, "Time to scan packages: "
                     + ((SystemClock.uptimeMillis()-startTime)/1000f)
@@ -604,9 +598,9 @@
 
             mSettings.writeLP();
 
-            EventLog.writeEvent(LOG_BOOT_PROGRESS_PMS_READY,
+            EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_PMS_READY,
                     SystemClock.uptimeMillis());
-            
+
             // Now after opening every single application zip, make sure they
             // are all flushed.  Not really needed, but keeps things nice and
             // tidy.
@@ -662,7 +656,7 @@
             if (f.getPath().endsWith("etc/permissions/platform.xml")) {
                 continue;
             }
-            
+
             if (!f.getPath().endsWith(".xml")) {
                 Log.i(TAG, "Non-xml file " + f + " in " + libraryDir + " directory, ignoring");
                 continue;
@@ -674,12 +668,12 @@
 
             readPermissionsFromXml(f);
         }
-        
+
         // Read permissions from .../etc/permissions/platform.xml last so it will take precedence
         final File permFile = new File(Environment.getRootDirectory(),
                 "etc/permissions/platform.xml");
         readPermissionsFromXml(permFile);
-        
+
         StringBuilder sb = new StringBuilder(128);
         sb.append("Libs:");
         Iterator<String> it = mSharedLibraries.keySet().iterator();
@@ -691,7 +685,7 @@
             sb.append(mSharedLibraries.get(name));
         }
         Log.i(TAG, sb.toString());
-        
+
         sb.setLength(0);
         sb.append("Features:");
         it = mAvailableFeatures.keySet().iterator();
@@ -701,8 +695,8 @@
         }
         Log.i(TAG, sb.toString());
     }
-    
-    private void readPermissionsFromXml(File permFile) {        
+
+    private void readPermissionsFromXml(File permFile) {
         FileReader permReader = null;
         try {
             permReader = new FileReader(permFile);
@@ -746,7 +740,7 @@
                     }
                     perm = perm.intern();
                     readPermission(parser, perm);
-                    
+
                 } else if ("assign-permission".equals(name)) {
                     String perm = parser.getAttributeValue(null, "name");
                     if (perm == null) {
@@ -778,7 +772,7 @@
                     }
                     perms.add(perm);
                     XmlUtils.skipCurrentTag(parser);
-                    
+
                 } else if ("library".equals(name)) {
                     String lname = parser.getAttributeValue(null, "name");
                     String lfile = parser.getAttributeValue(null, "file");
@@ -794,7 +788,7 @@
                     }
                     XmlUtils.skipCurrentTag(parser);
                     continue;
-                    
+
                 } else if ("feature".equals(name)) {
                     String fname = parser.getAttributeValue(null, "name");
                     if (fname == null) {
@@ -808,7 +802,7 @@
                     }
                     XmlUtils.skipCurrentTag(parser);
                     continue;
-                    
+
                 } else {
                     XmlUtils.skipCurrentTag(parser);
                     continue;
@@ -967,14 +961,14 @@
                     }
                 }
             }
-            
+
             if (out.size() > 0) {
                 return out;
             }
             return mPermissionGroups.containsKey(group) ? out : null;
         }
     }
-    
+
     public PermissionGroupInfo getPermissionGroupInfo(String name, int flags) {
         synchronized (mPackages) {
             return PackageParser.generatePermissionGroupInfo(
@@ -993,7 +987,7 @@
             return out;
         }
     }
-    
+
     private ApplicationInfo generateApplicationInfoFromSettingsLP(String packageName, int flags) {
         PackageSetting ps = mSettings.mPackages.get(packageName);
         if(ps != null) {
@@ -1008,7 +1002,7 @@
         }
         return null;
     }
-    
+
     private PackageInfo generatePackageInfoFromSettingsLP(String packageName, int flags) {
         PackageSetting ps = mSettings.mPackages.get(packageName);
         if(ps != null) {
@@ -1020,7 +1014,7 @@
         }
         return null;
     }
-    
+
     public ApplicationInfo getApplicationInfo(String packageName, int flags) {
         synchronized (mPackages) {
             PackageParser.Package p = mPackages.get(packageName);
@@ -1040,8 +1034,8 @@
         }
         return null;
     }
-    
-    
+
+
     public void freeStorageAndNotify(final long freeStorageSize, final IPackageDataObserver observer) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.CLEAR_APP_CACHE, null);
@@ -1094,7 +1088,7 @@
             }
         });
     }
-    
+
     public ActivityInfo getActivityInfo(ComponentName component, int flags) {
         synchronized (mPackages) {
             PackageParser.Activity a = mActivities.mActivities.get(component);
@@ -1133,7 +1127,7 @@
         }
         return null;
     }
-    
+
     public String[] getSystemSharedLibraryNames() {
         Set<String> libSet;
         synchronized (mPackages) {
@@ -1171,7 +1165,7 @@
             return mAvailableFeatures.containsKey(name);
         }
     }
-    
+
     public int checkPermission(String permName, String pkgName) {
         synchronized (mPackages) {
             PackageParser.Package p = mPackages.get(pkgName);
@@ -1290,7 +1284,7 @@
             return mProtectedBroadcasts.contains(actionName);
         }
     }
-    
+
     public int checkSignatures(String pkg1, String pkg2) {
         synchronized (mPackages) {
             PackageParser.Package p1 = mPackages.get(pkg1);
@@ -1395,7 +1389,7 @@
         }
         return null;
     }
-    
+
     public int getUidForSharedUser(String sharedUserName) {
         if(sharedUserName == null) {
             return -1;
@@ -1721,7 +1715,7 @@
             }
             return list;
         }
-        
+
         synchronized (mPackages) {
             String pkgName = intent.getPackage();
             if (pkgName == null) {
@@ -1779,7 +1773,7 @@
             return null;
         }
     }
-    
+
     public List<PackageInfo> getInstalledPackages(int flags) {
         ArrayList<PackageInfo> finalList = new ArrayList<PackageInfo>();
 
@@ -2001,7 +1995,7 @@
         }
         return true;
     }
-    
+
     /*
      *  Scan a package and return the newly parsed package.
      *  Returns null in case of errors and the error code is stored in mLastScanError
@@ -2080,7 +2074,7 @@
         return processName;
     }
 
-    private boolean verifySignaturesLP(PackageSetting pkgSetting, 
+    private boolean verifySignaturesLP(PackageSetting pkgSetting,
             PackageParser.Package pkg, int parseFlags, boolean updateSignature) {
         if (pkg.mSignatures != null) {
             if (!pkgSetting.signatures.updateSignatures(pkg.mSignatures,
@@ -2106,12 +2100,12 @@
         }
         return true;
     }
-    
+
     public boolean performDexOpt(String packageName) {
         if (!mNoDexOpt) {
             return false;
         }
-        
+
         PackageParser.Package p;
         synchronized (mPackages) {
             p = mPackages.get(packageName);
@@ -2123,11 +2117,11 @@
             return performDexOptLI(p, false) == DEX_OPT_PERFORMED;
         }
     }
-    
+
     static final int DEX_OPT_SKIPPED = 0;
     static final int DEX_OPT_PERFORMED = 1;
     static final int DEX_OPT_FAILED = -1;
-    
+
     private int performDexOptLI(PackageParser.Package pkg, boolean forceDex) {
         boolean performed = false;
         if ((pkg.applicationInfo.flags&ApplicationInfo.FLAG_HAS_CODE) != 0 && mInstaller != null) {
@@ -2135,7 +2129,7 @@
             int ret = 0;
             try {
                 if (forceDex || dalvik.system.DexFile.isDexOptNeeded(path)) {
-                    ret = mInstaller.dexopt(path, pkg.applicationInfo.uid, 
+                    ret = mInstaller.dexopt(path, pkg.applicationInfo.uid,
                             !pkg.mForwardLocked);
                     pkg.mDidDexOpt = true;
                     performed = true;
@@ -2152,10 +2146,10 @@
                 return DEX_OPT_FAILED;
             }
         }
-        
+
         return performed ? DEX_OPT_PERFORMED : DEX_OPT_SKIPPED;
     }
-    
+
     private PackageParser.Package scanPackageLI(
         File scanFile, File destCodeFile, File destResourceFile,
         PackageParser.Package pkg, int parseFlags, int scanMode) {
@@ -2181,7 +2175,7 @@
                     mLastScanError = PackageManager.INSTALL_FAILED_DUPLICATE_PACKAGE;
                     return null;
                 }
-    
+
                 // Set up information for our fall-back user intent resolution
                 // activity.
                 mPlatformPackage = pkg;
@@ -2218,9 +2212,9 @@
 
         SharedUserSetting suid = null;
         PackageSetting pkgSetting = null;
-        
+
         boolean removeExisting = false;
-        
+
         synchronized (mPackages) {
             // Check all shared libraries and map to their actual file path.
             if (pkg.usesLibraries != null || pkg.usesOptionalLibraries != null) {
@@ -2259,7 +2253,7 @@
                     System.arraycopy(mTmpSharedLibraries, 0,
                             pkg.usesLibraryFiles, 0, num);
                 }
-                
+
                 if (pkg.reqFeatures != null) {
                     N = pkg.reqFeatures.size();
                     for (int i=0; i<N; i++) {
@@ -2268,7 +2262,7 @@
                             // Don't care.
                             continue;
                         }
-                        
+
                         if (fi.name != null) {
                             if (mAvailableFeatures.get(fi.name) == null) {
                                 Log.e(TAG, "Package " + pkg.packageName
@@ -2281,7 +2275,7 @@
                     }
                 }
             }
-            
+
             if (pkg.mSharedUserId != null) {
                 suid = mSettings.getSharedUserLP(pkg.mSharedUserId,
                         pkg.applicationInfo.flags, true);
@@ -2309,11 +2303,11 @@
             if(mSettings.mDisabledSysPackages.get(pkg.packageName) != null) {
                 pkg.applicationInfo.flags |= ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
             }
-        
+
             pkg.applicationInfo.uid = pkgSetting.userId;
             pkg.mExtras = pkgSetting;
-    
-            if (!verifySignaturesLP(pkgSetting, pkg, parseFlags, 
+
+            if (!verifySignaturesLP(pkgSetting, pkg, parseFlags,
                     (scanMode&SCAN_UPDATE_SIGNATURE) != 0)) {
                 if ((parseFlags&PackageParser.PARSE_IS_SYSTEM) == 0) {
                     mLastScanError = PackageManager.INSTALL_FAILED_UPDATE_INCOMPATIBLE;
@@ -2336,7 +2330,7 @@
                 }
                 removeExisting = true;
             }
-            
+
             // Verify that this new package doesn't have any content providers
             // that conflict with existing packages.  Only do this if the
             // package isn't already installed, since we don't want to break
@@ -2378,7 +2372,7 @@
                     + " signature changed: existing data removed.");
             mLastScanError = PackageManager.INSTALL_SUCCEEDED;
         }
-        
+
         long scanFileTime = scanFile.lastModified();
         final boolean forceDex = (scanMode&SCAN_FORCE_DEX) != 0;
         final boolean scanFileNewer = forceDex || scanFileTime != pkgSetting.getTimeStamp();
@@ -2417,7 +2411,7 @@
                                         + pkg.applicationInfo.uid + "; old data erased";
                                 reportSettingsProblem(Log.WARN, msg);
                                 recovered = true;
-                                
+
                                 // And now re-install the app.
                                 ret = mInstaller.install(pkgName, pkg.applicationInfo.uid,
                                         pkg.applicationInfo.uid);
@@ -2430,7 +2424,7 @@
                                     return null;
                                 }
                             }
-                        } 
+                        }
                         if (!recovered) {
                             mHasSystemUidErrors = true;
                         }
@@ -2499,7 +2493,7 @@
 
             pkg.mForwardLocked = (scanMode&SCAN_FORWARD_LOCKED) != 0;
             pkg.mScanPath = path;
-            
+
             if ((scanMode&SCAN_NO_DEX) == 0) {
                 if (performDexOptLI(pkg, forceDex) == DEX_OPT_FAILED) {
                     mLastScanError = PackageManager.INSTALL_FAILED_DEXOPT;
@@ -2507,7 +2501,7 @@
                 }
             }
         }
-        
+
         if (mFactoryTest && pkg.requestedPermissions.contains(
                 android.Manifest.permission.FACTORY_TEST)) {
             pkg.applicationInfo.flags |= ApplicationInfo.FLAG_FACTORY_TEST;
@@ -2591,7 +2585,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Providers: " + r);
             }
-    
+
             N = pkg.services.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2611,7 +2605,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Services: " + r);
             }
-    
+
             N = pkg.receivers.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2631,7 +2625,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Receivers: " + r);
             }
-    
+
             N = pkg.activities.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2651,7 +2645,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Activities: " + r);
             }
-    
+
             N = pkg.permissionGroups.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2685,7 +2679,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Permission Groups: " + r);
             }
-    
+
             N = pkg.permissions.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2746,7 +2740,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Permissions: " + r);
             }
-    
+
             N = pkg.instrumentation.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -2768,17 +2762,17 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Instrumentation: " + r);
             }
-    
+
             if (pkg.protectedBroadcasts != null) {
                 N = pkg.protectedBroadcasts.size();
                 for (i=0; i<N; i++) {
                     mProtectedBroadcasts.add(pkg.protectedBroadcasts.get(i));
                 }
             }
-            
+
             pkgSetting.setTimeStamp(scanFileTime);
         }
-        
+
         return pkg;
     }
 
@@ -2847,7 +2841,7 @@
             // file name must start with libPrefix, i.e. "lib"
             int lastSlash = entryName.lastIndexOf('/');
 
-            if (lastSlash < 0 || 
+            if (lastSlash < 0 ||
                 !entryName.regionMatches(lastSlash+1, libPrefix, 0, libPrefixLen) ) {
                 continue;
             }
@@ -2967,12 +2961,12 @@
 
         synchronized (mPackages) {
             clearPackagePreferredActivitiesLP(pkg.packageName);
-    
+
             mPackages.remove(pkg.applicationInfo.packageName);
             if (pkg.mPath != null) {
                 mAppDirs.remove(pkg.mPath);
             }
-    
+
             PackageSetting ps = (PackageSetting)pkg.mExtras;
             if (ps != null && ps.sharedUser != null) {
                 // XXX don't do this until the data is removed.
@@ -2983,7 +2977,7 @@
                     }
                 }
             }
-    
+
             int N = pkg.providers.size();
             StringBuilder r = null;
             int i;
@@ -2992,7 +2986,7 @@
                 mProvidersByComponent.remove(new ComponentName(p.info.packageName,
                         p.info.name));
                 if (p.info.authority == null) {
-                    
+
                     /* The is another ContentProvider with this authority when
                      * this app was installed so this authority is null,
                      * Ignore it as we don't have to unregister the provider.
@@ -3021,7 +3015,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Providers: " + r);
             }
-    
+
             N = pkg.services.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -3039,7 +3033,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Services: " + r);
             }
-    
+
             N = pkg.receivers.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -3057,7 +3051,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Receivers: " + r);
             }
-    
+
             N = pkg.activities.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -3075,7 +3069,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Activities: " + r);
             }
-    
+
             N = pkg.permissions.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -3109,7 +3103,7 @@
             if (r != null) {
                 if (Config.LOGD) Log.d(TAG, "  Permissions: " + r);
             }
-    
+
             N = pkg.instrumentation.size();
             r = null;
             for (i=0; i<N; i++) {
@@ -3180,7 +3174,7 @@
             grantPermissionsLP(pkg, false);
         }
     }
-    
+
     private void grantPermissionsLP(PackageParser.Package pkg, boolean replace) {
         final PackageSetting ps = (PackageSetting)pkg.mExtras;
         if (ps == null) {
@@ -3188,7 +3182,7 @@
         }
         final GrantedPermissions gp = ps.sharedUser != null ? ps.sharedUser : ps;
         boolean addedPermission = false;
-        
+
         if (replace) {
             ps.permissionsFixed = false;
             if (gp == ps) {
@@ -3196,11 +3190,11 @@
                 gp.gids = mGlobalGids;
             }
         }
-        
+
         if (gp.gids == null) {
             gp.gids = mGlobalGids;
         }
-       
+
         final int N = pkg.requestedPermissions.size();
         for (int i=0; i<N; i++) {
             String name = pkg.requestedPermissions.get(i);
@@ -3228,7 +3222,7 @@
                         if ((pkg.applicationInfo.flags&ApplicationInfo.FLAG_SYSTEM) != 0) {
                             // For updated system applications, the signatureOrSystem permission
                             // is granted only if it had been defined by the original application.
-                            if ((pkg.applicationInfo.flags 
+                            if ((pkg.applicationInfo.flags
                                     & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)  != 0) {
                                 PackageSetting sysPs = mSettings.getDisabledSystemPkg(pkg.packageName);
                                 if(sysPs.grantedPermissions.contains(perm)) {
@@ -3296,7 +3290,7 @@
                         + " in package " + pkg.packageName);
             }
         }
-        
+
         if ((addedPermission || replace) && !ps.permissionsFixed &&
                 ((ps.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) ||
                 ((ps.pkgFlags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0)){
@@ -3392,7 +3386,7 @@
             }
             return true;
         }
-        
+
         @Override
         protected ResolveInfo newResult(PackageParser.ActivityIntentInfo info,
                 int match) {
@@ -3542,7 +3536,7 @@
             }
             return true;
         }
-        
+
         @Override
         protected ResolveInfo newResult(PackageParser.ServiceIntentInfo filter,
                 int match) {
@@ -3743,14 +3737,14 @@
             final Uri packageURI, final IPackageInstallObserver observer, final int flags) {
         installPackage(packageURI, observer, flags, null);
     }
-    
+
     /* Called when a downloaded package installation has been confirmed by the user */
     public void installPackage(
             final Uri packageURI, final IPackageInstallObserver observer, final int flags,
             final String installerPackageName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.INSTALL_PACKAGES, null);
-        
+
         // Queue up an async operation since the package installation may take a little while.
         mHandler.post(new Runnable() {
             public void run() {
@@ -3806,12 +3800,12 @@
         int returnCode;
         PackageRemovedInfo removedInfo;
     }
-    
+
     /*
      * Install a non-existing package.
      */
     private void installNewPackageLI(String pkgName,
-            File tmpPackageFile, 
+            File tmpPackageFile,
             String destFilePath, File destPackageFile, File destResourceFile,
             PackageParser.Package pkg, boolean forwardLocked, boolean newInstall,
             String installerPackageName, PackageInstalledInfo res) {
@@ -3821,7 +3815,7 @@
         synchronized(mPackages) {
             if (mPackages.containsKey(pkgName) || mAppDirs.containsKey(destFilePath)) {
                 // Don't allow installation over an existing package with the same name.
-                Log.w(TAG, "Attempt to re-install " + pkgName 
+                Log.w(TAG, "Attempt to re-install " + pkgName
                         + " without first uninstalling.");
                 res.returnCode = PackageManager.INSTALL_FAILED_ALREADY_EXISTS;
                 return;
@@ -3836,7 +3830,7 @@
         PackageParser.Package newPackage = scanPackageLI(tmpPackageFile, destPackageFile,
                 destResourceFile, pkg, 0,
                 SCAN_MONITOR | SCAN_FORCE_DEX
-                | SCAN_UPDATE_SIGNATURE 
+                | SCAN_UPDATE_SIGNATURE
                 | (forwardLocked ? SCAN_FORWARD_LOCKED : 0)
                 | (newInstall ? SCAN_NEW_INSTALL : 0));
         if (newPackage == null) {
@@ -3845,9 +3839,9 @@
                 res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
             }
         } else {
-            updateSettingsLI(pkgName, tmpPackageFile, 
+            updateSettingsLI(pkgName, tmpPackageFile,
                     destFilePath, destPackageFile,
-                    destResourceFile, pkg, 
+                    destResourceFile, pkg,
                     newPackage,
                     true,
                     forwardLocked,
@@ -3867,9 +3861,9 @@
             }
         }
     }
-    
+
     private void replacePackageLI(String pkgName,
-            File tmpPackageFile, 
+            File tmpPackageFile,
             String destFilePath, File destPackageFile, File destResourceFile,
             PackageParser.Package pkg, boolean forwardLocked, boolean newInstall,
             String installerPackageName, PackageInstalledInfo res) {
@@ -3887,7 +3881,7 @@
         boolean sysPkg = ((oldPackage.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
         if(sysPkg) {
             replaceSystemPackageLI(oldPackage,
-                    tmpPackageFile, destFilePath, 
+                    tmpPackageFile, destFilePath,
                     destPackageFile, destResourceFile, pkg, forwardLocked,
                     newInstall, installerPackageName, res);
         } else {
@@ -3896,9 +3890,9 @@
                     newInstall, installerPackageName, res);
         }
     }
-    
+
     private void replaceNonSystemPackageLI(PackageParser.Package deletedPackage,
-            File tmpPackageFile, 
+            File tmpPackageFile,
             String destFilePath, File destPackageFile, File destResourceFile,
             PackageParser.Package pkg, boolean forwardLocked, boolean newInstall,
             String installerPackageName, PackageInstalledInfo res) {
@@ -3906,12 +3900,12 @@
         String pkgName = deletedPackage.packageName;
         boolean deletedPkg = true;
         boolean updatedSettings = false;
-        
+
         String oldInstallerPackageName = null;
         synchronized (mPackages) {
             oldInstallerPackageName = mSettings.getInstallerPackageName(pkgName);
         }
-        
+
         int parseFlags = PackageManager.INSTALL_REPLACE_EXISTING;
         // First delete the existing package while retaining the data directory
         if (!deletePackageLI(pkgName, false, PackageManager.DONT_DELETE_DATA,
@@ -3925,7 +3919,7 @@
             newPackage = scanPackageLI(tmpPackageFile, destPackageFile,
                     destResourceFile, pkg, parseFlags,
                     SCAN_MONITOR | SCAN_FORCE_DEX
-                    | SCAN_UPDATE_SIGNATURE 
+                    | SCAN_UPDATE_SIGNATURE
                     | (forwardLocked ? SCAN_FORWARD_LOCKED : 0)
                     | (newInstall ? SCAN_NEW_INSTALL : 0));
             if (newPackage == null) {
@@ -3934,12 +3928,12 @@
                     res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
                 }
             } else {
-                updateSettingsLI(pkgName, tmpPackageFile, 
+                updateSettingsLI(pkgName, tmpPackageFile,
                         destFilePath, destPackageFile,
-                        destResourceFile, pkg, 
+                        destResourceFile, pkg,
                         newPackage,
                         true,
-                        forwardLocked,  
+                        forwardLocked,
                         installerPackageName,
                         res);
                 updatedSettings = true;
@@ -4007,9 +4001,9 @@
             }
         }
     }
-    
+
     private void replaceSystemPackageLI(PackageParser.Package deletedPackage,
-            File tmpPackageFile, 
+            File tmpPackageFile,
             String destFilePath, File destPackageFile, File destResourceFile,
             PackageParser.Package pkg, boolean forwardLocked, boolean newInstall,
             String installerPackageName, PackageInstalledInfo res) {
@@ -4027,7 +4021,7 @@
         PackageSetting oldPkgSetting;
         synchronized (mPackages) {
             oldPkg = mPackages.get(packageName);
-            oldPkgSetting = mSettings.mPackages.get(packageName);  
+            oldPkgSetting = mSettings.mPackages.get(packageName);
             if((oldPkg == null) || (oldPkg.applicationInfo == null) ||
                     (oldPkgSetting == null)) {
                 Log.w(TAG, "Could'nt find package:"+packageName+" information");
@@ -4048,7 +4042,7 @@
         newPackage = scanPackageLI(tmpPackageFile, destPackageFile,
                 destResourceFile, pkg, parseFlags,
                 SCAN_MONITOR | SCAN_FORCE_DEX
-                | SCAN_UPDATE_SIGNATURE 
+                | SCAN_UPDATE_SIGNATURE
                 | (forwardLocked ? SCAN_FORWARD_LOCKED : 0)
                 | (newInstall ? SCAN_NEW_INSTALL : 0));
         if (newPackage == null) {
@@ -4057,9 +4051,9 @@
                 res.returnCode = PackageManager.INSTALL_FAILED_INVALID_APK;
             }
         } else {
-            updateSettingsLI(packageName, tmpPackageFile, 
+            updateSettingsLI(packageName, tmpPackageFile,
                     destFilePath, destPackageFile,
-                    destResourceFile, pkg, 
+                    destResourceFile, pkg,
                     newPackage,
                     true,
                     forwardLocked,
@@ -4083,7 +4077,7 @@
                 removePackageLI(newPackage, true);
             }
             // Add back the old system package
-            scanPackageLI(oldPkgSetting.codePath, oldPkgSetting.codePath, 
+            scanPackageLI(oldPkgSetting.codePath, oldPkgSetting.codePath,
                     oldPkgSetting.resourcePath,
                     oldPkg, parseFlags,
                     SCAN_MONITOR
@@ -4099,14 +4093,14 @@
             }
         }
     }
-   
-    private void updateSettingsLI(String pkgName, File tmpPackageFile, 
+
+    private void updateSettingsLI(String pkgName, File tmpPackageFile,
             String destFilePath, File destPackageFile,
-            File destResourceFile, 
-            PackageParser.Package pkg, 
+            File destResourceFile,
+            PackageParser.Package pkg,
             PackageParser.Package newPackage,
             boolean replacingExistingPackage,
-            boolean forwardLocked,  
+            boolean forwardLocked,
             String installerPackageName, PackageInstalledInfo res) {
         synchronized (mPackages) {
             //write settings. the installStatus will be incomplete at this stage.
@@ -4133,8 +4127,8 @@
             Log.e(TAG, "Couldn't move package file to: " + destPackageFile);
             res.returnCode =  PackageManager.INSTALL_FAILED_INSUFFICIENT_STORAGE;
         } else {
-            res.returnCode = setPermissionsLI(pkgName, newPackage, destFilePath, 
-                    destResourceFile, 
+            res.returnCode = setPermissionsLI(pkgName, newPackage, destFilePath,
+                    destResourceFile,
                     forwardLocked);
             if(res.returnCode != PackageManager.INSTALL_SUCCEEDED) {
                 return;
@@ -4160,7 +4154,7 @@
             mSettings.writeLP();
         }
     }
-    
+
     private File getFwdLockedResource(String pkgName) {
         final String publicZipFileName = pkgName + ".zip";
         return new File(mAppInstallDir, publicZipFileName);
@@ -4277,7 +4271,7 @@
                 res.returnCode = pp.getParseError();
                 break main_flow;
             }
-            
+
             synchronized (mPackages) {
                 //check if installing already existing package
                 if ((pFlags&PackageManager.INSTALL_REPLACE_EXISTING) != 0
@@ -4285,16 +4279,16 @@
                     replacingExistingPackage = true;
                 }
             }
-            
+
             if(replacingExistingPackage) {
                 replacePackageLI(pkgName,
-                        tmpPackageFile, 
+                        tmpPackageFile,
                         destFilePath, destPackageFile, destResourceFile,
                         pkg, forwardLocked, newInstall, installerPackageName,
                         res);
             } else {
                 installNewPackageLI(pkgName,
-                        tmpPackageFile, 
+                        tmpPackageFile,
                         destFilePath, destPackageFile, destResourceFile,
                         pkg, forwardLocked, newInstall, installerPackageName,
                         res);
@@ -4305,7 +4299,7 @@
             }
         }
     }
-    
+
     private int setPermissionsLI(String pkgName,
             PackageParser.Package newPackage,
             String destFilePath,
@@ -4406,7 +4400,7 @@
         }
         outZipStream.flush();
     }
-    
+
     private void deleteTempPackageFiles() {
         FilenameFilter filter = new FilenameFilter() {
             public boolean accept(File dir, String name) {
@@ -4462,13 +4456,13 @@
             } //end run
         });
     }
-    
+
     /**
      *  This method is an internal method that could be get invoked either
      *  to delete an installed package or to clean up a failed installation.
      *  After deleting an installed package, a broadcast is sent to notify any
      *  listeners that the package has been installed. For cleaning up a failed
-     *  installation, the broadcast is not necessary since the package's 
+     *  installation, the broadcast is not necessary since the package's
      *  installation wouldn't have sent the initial broadcast either
      *  The key steps in deleting a package are
      *  deleting the package information in internal structures like mPackages,
@@ -4486,7 +4480,7 @@
         synchronized (mInstallLock) {
             res = deletePackageLI(packageName, deleteCodeAndResources, flags, info);
         }
-        
+
         if(res && sendBroadCast) {
             boolean systemUpdate = info.isRemovedPackageSystemUpdate;
             info.sendBroadcast(deleteCodeAndResources, systemUpdate);
@@ -4526,14 +4520,14 @@
             }
         }
     }
-    
+
     /*
      * This method deletes the package from internal data structures. If the DONT_DELETE_DATA
      * flag is not set, the data directory is removed as well.
-     * make sure this flag is set for partially installed apps. If not its meaningless to 
+     * make sure this flag is set for partially installed apps. If not its meaningless to
      * delete a partially installed application.
      */
-    private void removePackageDataLI(PackageParser.Package p, PackageRemovedInfo outInfo, 
+    private void removePackageDataLI(PackageParser.Package p, PackageRemovedInfo outInfo,
             int flags) {
         String packageName = p.packageName;
         if (outInfo != null) {
@@ -4574,7 +4568,7 @@
             mSettings.writeLP ();
         }
     }
-    
+
     /*
      * Tries to delete system package.
      */
@@ -4626,7 +4620,7 @@
         PackageParser.Package newPkg = scanPackageLI(ps.codePath, ps.codePath, ps.resourcePath,
                 PackageParser.PARSE_MUST_BE_APK | PackageParser.PARSE_IS_SYSTEM,
                 SCAN_MONITOR);
-        
+
         if (newPkg == null) {
             Log.w(TAG, "Failed to restore system package:"+p.packageName+" with error:" + mLastScanError);
             return false;
@@ -4667,7 +4661,7 @@
             }
         }
     }
-    
+
     private boolean deleteInstalledPackageLI(PackageParser.Package p,
             boolean deleteCodeAndResources, int flags, PackageRemovedInfo outInfo) {
         ApplicationInfo applicationInfo = p.applicationInfo;
@@ -4689,7 +4683,7 @@
         }
         return true;
     }
-    
+
     /*
      * This method handles package deletion in general
      */
@@ -4718,7 +4712,7 @@
             Log.w(TAG, "Package named '" + packageName +"' doesn't exist.");
             return false;
         }
-        
+
         if (dataOnly) {
             // Delete application data first
             removePackageDataLI(p, outInfo, flags);
@@ -4738,7 +4732,7 @@
         Log.i(TAG, "Removing non-system package:"+p.packageName);
         return deleteInstalledPackageLI (p, deleteCodeAndResources, flags, outInfo);
     }
-    
+
     public void clearApplicationUserData(final String packageName,
             final IPackageDataObserver observer) {
         mContext.enforceCallingOrSelfPermission(
@@ -4769,7 +4763,7 @@
             } //end run
         });
     }
-    
+
     private boolean clearApplicationUserDataLI(String packageName) {
         if (packageName == null) {
             Log.w(TAG, "Attempt to delete null packageName.");
@@ -4928,7 +4922,7 @@
         return true;
     }
 
-        
+
     public void addPackageToPreferred(String packageName) {
         mContext.enforceCallingOrSelfPermission(
                 android.Manifest.permission.SET_PREFERRED_APPLICATIONS, null);
@@ -5156,7 +5150,7 @@
         extras.putStringArray(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST, nameList);
         extras.putBoolean(Intent.EXTRA_DONT_KILL_APP, killFlag);
         extras.putInt(Intent.EXTRA_UID, packageUid);
-        sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,  packageName, extras);   
+        sendPackageBroadcast(Intent.ACTION_PACKAGE_CHANGED,  packageName, extras);
     }
 
     public String getInstallerPackageName(String packageName) {
@@ -5168,7 +5162,7 @@
             return pkg.installerPackageName;
         }
     }
-    
+
     public int getApplicationEnabledSetting(String appPackageName) {
         synchronized (mPackages) {
             PackageSetting pkg = mSettings.mPackages.get(appPackageName);
@@ -5230,7 +5224,7 @@
         buf.append(']');
         return buf.toString();
     }
-    
+
     @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
@@ -5286,31 +5280,31 @@
                         pw.print("    targetSdk="); pw.println(ps.pkg.applicationInfo.targetSdkVersion);
                         pw.print("    supportsScreens=[");
                         boolean first = true;
-                        if ((ps.pkg.applicationInfo.flags & 
+                        if ((ps.pkg.applicationInfo.flags &
                                 ApplicationInfo.FLAG_SUPPORTS_NORMAL_SCREENS) != 0) {
                             if (!first) pw.print(", ");
                             first = false;
                             pw.print("medium");
                         }
-                        if ((ps.pkg.applicationInfo.flags & 
+                        if ((ps.pkg.applicationInfo.flags &
                                 ApplicationInfo.FLAG_SUPPORTS_LARGE_SCREENS) != 0) {
                             if (!first) pw.print(", ");
                             first = false;
                             pw.print("large");
                         }
-                        if ((ps.pkg.applicationInfo.flags & 
+                        if ((ps.pkg.applicationInfo.flags &
                                 ApplicationInfo.FLAG_SUPPORTS_SMALL_SCREENS) != 0) {
                             if (!first) pw.print(", ");
                             first = false;
                             pw.print("small");
                         }
-                        if ((ps.pkg.applicationInfo.flags & 
+                        if ((ps.pkg.applicationInfo.flags &
                                 ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS) != 0) {
                             if (!first) pw.print(", ");
                             first = false;
                             pw.print("resizeable");
                         }
-                        if ((ps.pkg.applicationInfo.flags & 
+                        if ((ps.pkg.applicationInfo.flags &
                                 ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES) != 0) {
                             if (!first) pw.print(", ");
                             first = false;
@@ -5643,7 +5637,7 @@
                 mSignatures[i] = sigs[i];
             }
         }
-        
+
         @Override
         public String toString() {
             StringBuffer buf = new StringBuffer(128);
@@ -5829,17 +5823,17 @@
 
     static class GrantedPermissions {
         int pkgFlags;
-        
+
         HashSet<String> grantedPermissions = new HashSet<String>();
         int[] gids;
-        
+
         HashSet<String> loadedPermissions = new HashSet<String>();
-        
+
         GrantedPermissions(int pkgFlags) {
             this.pkgFlags = pkgFlags & ApplicationInfo.FLAG_SYSTEM;
         }
     }
-    
+
     /**
      * Settings base class for pending and resolved classes.
      */
@@ -5856,14 +5850,14 @@
         PackageSignatures signatures = new PackageSignatures();
 
         boolean permissionsFixed;
-        
+
         /* Explicitly disabled components */
         HashSet<String> disabledComponents = new HashSet<String>(0);
         /* Explicitly enabled components */
         HashSet<String> enabledComponents = new HashSet<String>(0);
         int enabled = COMPONENT_ENABLED_STATE_DEFAULT;
         int installStatus = PKG_INSTALL_COMPLETE;
-        
+
         /* package name of the app that installed this package */
         String installerPackageName;
 
@@ -5881,19 +5875,19 @@
         public void setInstallerPackageName(String packageName) {
             installerPackageName = packageName;
         }
-        
+
         String getInstallerPackageName() {
             return installerPackageName;
         }
-        
+
         public void setInstallStatus(int newStatus) {
             installStatus = newStatus;
         }
-        
+
         public int getInstallStatus() {
             return installStatus;
         }
-        
+
         public void setTimeStamp(long newStamp) {
             if (newStamp != timeStamp) {
                 timeStamp = newStamp;
@@ -5905,11 +5899,11 @@
             timeStamp = newStamp;
             timeStampString = newStampStr;
         }
-        
+
         public long getTimeStamp() {
             return timeStamp;
         }
-        
+
         public String getTimeStampStr() {
             return timeStampString;
         }
@@ -5918,7 +5912,7 @@
             grantedPermissions = base.grantedPermissions;
             gids = base.gids;
             loadedPermissions = base.loadedPermissions;
-            
+
             timeStamp = base.timeStamp;
             timeStampString = base.timeStampString;
             signatures = base.signatures;
@@ -5967,7 +5961,7 @@
                 int pVersionCode, int pkgFlags) {
             super(name, codePath, resourcePath, pVersionCode, pkgFlags);
         }
-        
+
         @Override
         public String toString() {
             return "PackageSetting{"
@@ -5989,7 +5983,7 @@
             super(_pkgFlags);
             name = _name;
         }
-        
+
         @Override
         public String toString() {
             return "SharedUserSetting{"
@@ -6009,7 +6003,7 @@
         // List of replaced system applications
         final HashMap<String, PackageSetting> mDisabledSysPackages =
             new HashMap<String, PackageSetting>();
-        
+
         // The user's preferred activities associated with particular intent
         // filters.
         private final IntentResolver<PreferredActivity, PreferredActivity> mPreferredActivities =
@@ -6084,7 +6078,7 @@
                     resourcePath, pkg.mVersionCode, pkgFlags, create, add);
             return p;
         }
-        
+
         PackageSetting peekPackageLP(String name) {
             return mPackages.get(name);
             /*
@@ -6095,7 +6089,7 @@
             return null;
             */
         }
-        
+
         void setInstallStatus(String pkgName, int status) {
             PackageSetting p = mPackages.get(pkgName);
             if(p != null) {
@@ -6104,7 +6098,7 @@
                 }
             }
         }
-        
+
         void setInstallerPackageName(String pkgName,
                 String installerPkgName) {
             PackageSetting p = mPackages.get(pkgName);
@@ -6112,17 +6106,17 @@
                 p.setInstallerPackageName(installerPkgName);
             }
         }
-        
+
         String getInstallerPackageName(String pkgName) {
             PackageSetting p = mPackages.get(pkgName);
-            return (p == null) ? null : p.getInstallerPackageName(); 
+            return (p == null) ? null : p.getInstallerPackageName();
         }
 
         int getInstallStatus(String pkgName) {
             PackageSetting p = mPackages.get(pkgName);
             if(p != null) {
                 return p.getInstallStatus();
-            } 
+            }
             return -1;
         }
 
@@ -6166,7 +6160,7 @@
             }
             return removePackageLP(name);
         }
-        
+
         PackageSetting enableSystemPackageLP(String name) {
             PackageSetting p = mDisabledSysPackages.get(name);
             if(p == null) {
@@ -6182,7 +6176,7 @@
             mDisabledSysPackages.remove(name);
             return ret;
         }
-        
+
         PackageSetting addPackageLP(String name, File codePath,
                 File resourcePath, int uid, int vc, int pkgFlags) {
             PackageSetting p = mPackages.get(name);
@@ -6303,7 +6297,7 @@
                     return null;
                 }
                 if (add) {
-                    // Finish adding new package by adding it and updating shared 
+                    // Finish adding new package by adding it and updating shared
                     // user preferences
                     addPackageSettingLP(p, name, sharedUser);
                 }
@@ -6479,7 +6473,7 @@
                 mOtherUserIds.remove(uid);
             }
         }
-        
+
         void writeLP() {
             //Debug.startMethodTracing("/data/system/packageprof", 8 * 1024 * 1024);
 
@@ -6528,7 +6522,7 @@
                 for (PackageSetting pkg : mPackages.values()) {
                     writePackage(serializer, pkg);
                 }
-                
+
                 for (PackageSetting pkg : mDisabledSysPackages.values()) {
                     writeDisabledSysPackage(serializer, pkg);
                 }
@@ -6587,8 +6581,8 @@
             }
             //Debug.stopMethodTracing();
         }
-       
-        void writeDisabledSysPackage(XmlSerializer serializer, final PackageSetting pkg) 
+
+        void writeDisabledSysPackage(XmlSerializer serializer, final PackageSetting pkg)
         throws java.io.IOException {
             serializer.startTag(null, "updated-package");
             serializer.attribute(null, "name", pkg.name);
@@ -6625,8 +6619,8 @@
             serializer.endTag(null, "perms");
             serializer.endTag(null, "updated-package");
         }
-        
-        void writePackage(XmlSerializer serializer, final PackageSetting pkg) 
+
+        void writePackage(XmlSerializer serializer, final PackageSetting pkg)
         throws java.io.IOException {
             serializer.startTag(null, "package");
             serializer.attribute(null, "name", pkg.name);
@@ -6691,10 +6685,10 @@
                 }
                 serializer.endTag(null, "enabled-components");
             }
-            
+
             serializer.endTag(null, "package");
         }
-        
+
         void writePermission(XmlSerializer serializer, BasePermission bp)
                 throws XmlPullParserException, java.io.IOException {
             if (bp.type != BasePermission.TYPE_BUILTIN
@@ -6745,7 +6739,7 @@
             }
             return ret;
         }
-        
+
         boolean readLP() {
             FileInputStream str = null;
             if (mBackupSettingsFilename.exists()) {
@@ -6938,7 +6932,7 @@
                 XmlUtils.skipCurrentTag(parser);
             }
         }
-        
+
         private void readDisabledSysPackageLP(XmlPullParser parser)
         throws XmlPullParserException, IOException {
             String name = parser.getAttributeValue(null, "name");
@@ -6955,11 +6949,11 @@
                 } catch (NumberFormatException e) {
                 }
             }
-            
+
             int pkgFlags = 0;
             pkgFlags |= ApplicationInfo.FLAG_SYSTEM;
-            PackageSetting ps = new PackageSetting(name, 
-                    new File(codePathStr), 
+            PackageSetting ps = new PackageSetting(name,
+                    new File(codePathStr),
                     new File(resourcePathStr), versionCode, pkgFlags);
             String timeStampStr = parser.getAttributeValue(null, "ts");
             if (timeStampStr != null) {
@@ -6998,7 +6992,7 @@
             }
             mDisabledSysPackages.put(name, ps);
         }
-        
+
         private void readPackageLP(XmlPullParser parser)
                 throws XmlPullParserException, IOException {
             String name = null;
@@ -7060,7 +7054,7 @@
                             "Error in package manager settings: <package> has no codePath at "
                             + parser.getPositionDescription());
                 } else if (userId > 0) {
-                    packageSetting = addPackageLP(name.intern(), new File(codePathStr), 
+                    packageSetting = addPackageLP(name.intern(), new File(codePathStr),
                             new File(resourcePathStr), userId, versionCode, pkgFlags);
                     if (DEBUG_SETTINGS) Log.i(TAG, "Reading package " + name
                             + ": userId=" + userId + " pkg=" + packageSetting);
@@ -7128,7 +7122,7 @@
                         packageSetting.installStatus = PKG_INSTALL_COMPLETE;
                     }
                 }
-                
+
                 int outerDepth = parser.getDepth();
                 int type;
                 while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
@@ -7373,7 +7367,7 @@
             mUserIds.add(obj);
             return FIRST_APPLICATION_UID + N;
         }
-        
+
         public PackageSetting getDisabledSystemPkg(String name) {
             synchronized(mPackages) {
                 PackageSetting ps = mDisabledSysPackages.get(name);
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index 6e769c7..e11c312 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -133,7 +133,7 @@
     static final boolean ANIMATE_SCREEN_LIGHTS = true;
     static final boolean ANIMATE_BUTTON_LIGHTS = false;
     static final boolean ANIMATE_KEYBOARD_LIGHTS = false;
-    
+
     static final int ANIM_STEPS = 60/4;
     // Slower animation for autobrightness changes
     static final int AUTOBRIGHTNESS_ANIM_STEPS = 60;
@@ -144,14 +144,7 @@
     static final int INITIAL_SCREEN_BRIGHTNESS = 255;
     static final int INITIAL_BUTTON_BRIGHTNESS = Power.BRIGHTNESS_OFF;
     static final int INITIAL_KEYBOARD_BRIGHTNESS = Power.BRIGHTNESS_OFF;
-    
-    static final int LOG_POWER_SLEEP_REQUESTED = 2724;
-    static final int LOG_POWER_SCREEN_BROADCAST_SEND = 2725;
-    static final int LOG_POWER_SCREEN_BROADCAST_DONE = 2726;
-    static final int LOG_POWER_SCREEN_BROADCAST_STOP = 2727;
-    static final int LOG_POWER_SCREEN_STATE = 2728;
-    static final int LOG_POWER_PARTIAL_WAKE_STATE = 2729;
-    
+
     private final int MY_UID;
 
     private boolean mDoneBooting = false;
@@ -419,7 +412,7 @@
 
         // assume nothing is on yet
         mUserState = mPowerState = 0;
-        
+
         // Add ourself to the Watchdog monitors.
         Watchdog.getInstance().addMonitor(this);
     }
@@ -447,7 +440,7 @@
             }
         };
         mHandlerThread.start();
-        
+
         synchronized (mHandlerThread) {
             while (!mInitComplete) {
                 try {
@@ -458,7 +451,7 @@
             }
         }
     }
-    
+
     void initInThread() {
         mHandler = new Handler();
 
@@ -686,7 +679,7 @@
             if (newlock) {
                 mPartialCount++;
                 if (mPartialCount == 1) {
-                    if (LOG_PARTIAL_WL) EventLog.writeEvent(LOG_POWER_PARTIAL_WAKE_STATE, 1, tag);
+                    if (LOG_PARTIAL_WL) EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE, 1, tag);
                 }
             }
             Power.acquireWakeLock(Power.PARTIAL_WAKE_LOCK,PARTIAL_NAME);
@@ -731,7 +724,7 @@
         if (wl == null) {
             return;
         }
-        
+
         if (mSpew) {
             Log.d(TAG, "releaseWakeLock flags=0x"
                     + Integer.toHexString(wl.flags) + " tag=" + wl.tag);
@@ -748,7 +741,7 @@
         else if ((wl.flags & LOCK_MASK) == PowerManager.PARTIAL_WAKE_LOCK) {
             mPartialCount--;
             if (mPartialCount == 0) {
-                if (LOG_PARTIAL_WL) EventLog.writeEvent(LOG_POWER_PARTIAL_WAKE_STATE, 0, wl.tag);
+                if (LOG_PARTIAL_WL) EventLog.writeEvent(EventLogTags.POWER_PARTIAL_WAKE_STATE, 0, wl.tag);
                 Power.releaseWakeLock(PARTIAL_NAME);
             }
         } else if ((wl.flags & LOCK_MASK) == PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK) {
@@ -855,7 +848,7 @@
 
             int oldCumulativeTimeout = oldPokey & POKE_LOCK_TIMEOUT_MASK;
             int newCumulativeTimeout = pokey & POKE_LOCK_TIMEOUT_MASK;
-            
+
             if (oldCumulativeTimeout != newCumulativeTimeout) {
                 setScreenOffTimeoutsLocked();
                 // reset the countdown timer, but use the existing nextState so it doesn't
@@ -958,7 +951,7 @@
         mScreenBrightness.dump(pw, "  mScreenBrightness: ");
         mKeyboardBrightness.dump(pw, "  mKeyboardBrightness: ");
         mButtonBrightness.dump(pw, "  mButtonBrightness: ");
-        
+
         int N = mLocks.size();
         pw.println();
         pw.println("mLocks.size=" + N + ":");
@@ -976,7 +969,7 @@
             pw.println("  " + type + " '" + wl.tag + "'" + acquireCausesWakeup
                     + activated + " (minState=" + wl.minState + ")");
         }
-        
+
         pw.println();
         pw.println("mPokeLocks.size=" + mPokeLocks.size() + ":");
         for (PokeLock p: mPokeLocks.values()) {
@@ -1106,7 +1099,7 @@
             index = -1;
             // The wake lock was being held, but we're not actually going to do any
             // broadcasts, so release the wake lock.
-            EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_STOP, 1, mBroadcastWakeLock.mCount);
+            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_STOP, 1, mBroadcastWakeLock.mCount);
             mBroadcastWakeLock.release();
         }
 
@@ -1117,7 +1110,7 @@
             // We always increment the ref count for each notification in the queue
             // and always decrement when that notification is handled.
             mBroadcastWakeLock.acquire();
-            EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_SEND, mBroadcastWakeLock.mCount);
+            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_SEND, mBroadcastWakeLock.mCount);
             mHandler.post(mNotificationTask);
         }
     }
@@ -1141,7 +1134,7 @@
                 }
                 if (value == 1) {
                     mScreenOnStart = SystemClock.uptimeMillis();
-                    
+
                     policy.screenTurnedOn();
                     try {
                         ActivityManagerNative.getDefault().wakingUp();
@@ -1157,7 +1150,7 @@
                                 mScreenOnBroadcastDone, mHandler, 0, null, null);
                     } else {
                         synchronized (mLocks) {
-                            EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_STOP, 2,
+                            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_STOP, 2,
                                     mBroadcastWakeLock.mCount);
                             mBroadcastWakeLock.release();
                         }
@@ -1165,7 +1158,7 @@
                 }
                 else if (value == 0) {
                     mScreenOffStart = SystemClock.uptimeMillis();
-                    
+
                     policy.screenTurnedOff(why);
                     try {
                         ActivityManagerNative.getDefault().goingToSleep();
@@ -1178,7 +1171,7 @@
                                 mScreenOffBroadcastDone, mHandler, 0, null, null);
                     } else {
                         synchronized (mLocks) {
-                            EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_STOP, 3,
+                            EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_STOP, 3,
                                     mBroadcastWakeLock.mCount);
                             mBroadcastWakeLock.release();
                         }
@@ -1197,7 +1190,7 @@
     private BroadcastReceiver mScreenOnBroadcastDone = new BroadcastReceiver() {
         public void onReceive(Context context, Intent intent) {
             synchronized (mLocks) {
-                EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_DONE, 1,
+                EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_DONE, 1,
                         SystemClock.uptimeMillis() - mScreenOnStart, mBroadcastWakeLock.mCount);
                 mBroadcastWakeLock.release();
             }
@@ -1208,7 +1201,7 @@
     private BroadcastReceiver mScreenOffBroadcastDone = new BroadcastReceiver() {
         public void onReceive(Context context, Intent intent) {
             synchronized (mLocks) {
-                EventLog.writeEvent(LOG_POWER_SCREEN_BROADCAST_DONE, 0,
+                EventLog.writeEvent(EventLogTags.POWER_SCREEN_BROADCAST_DONE, 0,
                         SystemClock.uptimeMillis() - mScreenOffStart, mBroadcastWakeLock.mCount);
                 mBroadcastWakeLock.release();
             }
@@ -1492,7 +1485,7 @@
                     mLastTouchDown = 0;
                     mTotalTouchDownTime = 0;
                     mTouchCycles = 0;
-                    EventLog.writeEvent(LOG_POWER_SCREEN_STATE, 1, reason,
+                    EventLog.writeEvent(EventLogTags.POWER_SCREEN_STATE, 1, reason,
                             mTotalTouchDownTime, mTouchCycles);
                     if (err == 0) {
                         mPowerState |= SCREEN_ON_BIT;
@@ -1522,12 +1515,12 @@
             }
         }
     }
-    
+
     private int screenOffFinishedAnimatingLocked(int reason) {
         // I don't think we need to check the current state here because all of these
-        // Power.setScreenState and sendNotificationLocked can both handle being 
+        // Power.setScreenState and sendNotificationLocked can both handle being
         // called multiple times in the same state. -joeo
-        EventLog.writeEvent(LOG_POWER_SCREEN_STATE, 0, reason, mTotalTouchDownTime, mTouchCycles);
+        EventLog.writeEvent(EventLogTags.POWER_SCREEN_STATE, 0, reason, mTotalTouchDownTime, mTouchCycles);
         mLastTouchDown = 0;
         int err = setScreenStateLocked(false);
         if (err == 0) {
@@ -1551,14 +1544,14 @@
         if (difference == 0) {
             return;
         }
-        
+
         int offMask = 0;
         int dimMask = 0;
         int onMask = 0;
 
         int preferredBrightness = getPreferredBrightness();
         boolean startAnimation = false;
-        
+
         if ((difference & KEYBOARD_BRIGHT_BIT) != 0) {
             if (ANIMATE_KEYBOARD_LIGHTS) {
                 if ((newState & KEYBOARD_BRIGHT_BIT) == 0) {
@@ -1697,7 +1690,7 @@
             mHandler.removeCallbacks(mLightAnimator);
             mHandler.post(mLightAnimator);
         }
-        
+
         if (offMask != 0) {
             //Log.i(TAG, "Setting brightess off: " + offMask);
             setLightBrightness(offMask, Power.BRIGHTNESS_OFF);
@@ -1739,24 +1732,24 @@
 
     class BrightnessState {
         final int mask;
-        
+
         boolean initialized;
         int targetValue;
         float curValue;
         float delta;
         boolean animating;
-        
+
         BrightnessState(int m) {
             mask = m;
         }
-        
+
         public void dump(PrintWriter pw, String prefix) {
             pw.println(prefix + "animating=" + animating
                     + " targetValue=" + targetValue
                     + " curValue=" + curValue
                     + " delta=" + delta);
         }
-        
+
         boolean setTargetLocked(int target, int stepsToTarget, int initialValue,
                 int nominalCurrentValue) {
             if (!initialized) {
@@ -1779,7 +1772,7 @@
             animating = true;
             return true;
         }
-        
+
         boolean stepLocked() {
             if (!animating) return false;
             if (false && mSpew) {
@@ -1814,7 +1807,7 @@
             return more;
         }
     }
-    
+
     private class LightAnimator implements Runnable {
         public void run() {
             synchronized (mLocks) {
@@ -1832,7 +1825,7 @@
             }
         }
     }
-    
+
     private int getPreferredBrightness() {
         try {
             if (mScreenBrightnessOverride >= 0) {
@@ -1992,7 +1985,7 @@
                     } finally {
                         Binder.restoreCallingIdentity(ident);
                     }
-                    
+
                     mWakeLockState = mLocks.reactivateScreenLocksLocked();
                     setPowerState(mUserState | mWakeLockState, noChangeLights,
                             WindowManagerPolicy.OFF_BECAUSE_OF_USER);
@@ -2129,7 +2122,7 @@
             goToSleepLocked(time, WindowManagerPolicy.OFF_BECAUSE_OF_USER);
         }
     }
-    
+
     /**
      * Reboot the device immediately, passing 'reason' (may be null)
      * to the underlying __reboot system call.  Should not return.
@@ -2159,7 +2152,7 @@
                     numCleared++;
                 }
             }
-            EventLog.writeEvent(LOG_POWER_SLEEP_REQUESTED, numCleared);
+            EventLog.writeEvent(EventLogTags.POWER_SLEEP_REQUESTED, numCleared);
             mStillNeedSleepNotification = true;
             mUserState = SCREEN_OFF;
             setPowerState(SCREEN_OFF, false, reason);
@@ -2175,7 +2168,7 @@
             return SystemClock.elapsedRealtime() - mScreenOffTime;
         }
     }
-    
+
     public void setKeyboardVisibility(boolean visible) {
         synchronized (mLocks) {
             if (mSpew) {
@@ -2345,7 +2338,7 @@
             }
             return result;
         }
-        
+
         int reactivateScreenLocksLocked()
         {
             int result = 0;
@@ -2378,7 +2371,7 @@
         }
         return mPolicy;
     }
-    
+
     void systemReady() {
         mSensorManager = new SensorManager(mHandlerThread.getLooper());
         mProximitySensor = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index a0a9a93..73f930d 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -70,7 +70,7 @@
 
     @Override
     public void run() {
-        EventLog.writeEvent(LOG_BOOT_PROGRESS_SYSTEM_RUN,
+        EventLog.writeEvent(EventLogTags.BOOT_PROGRESS_SYSTEM_RUN,
             SystemClock.uptimeMillis());
 
         ActivityManagerService.prepareTraceFile(false);     // create dir
@@ -387,7 +387,7 @@
             } catch (RemoteException e) {
             }
         }
-        
+
         // It is now time to start up the app processes...
 
         if (notification != null) {
@@ -411,7 +411,7 @@
         final AppWidgetService appWidgetF = appWidget;
         final WallpaperManagerService wallpaperF = wallpaper;
         final InputMethodManagerService immF = imm;
-        
+
         // We now tell the activity manager it is okay to run third party
         // code.  It will call back into us once it has gotten to the state
         // where third party code can really run (but before it has actually
@@ -421,7 +421,7 @@
                 .systemReady(new Runnable() {
             public void run() {
                 Log.i(TAG, "Making services ready");
-                
+
                 if (batteryF != null) batteryF.systemReady();
                 if (connectivityF != null) connectivityF.systemReady();
                 if (dockF != null) dockF.systemReady();
@@ -429,13 +429,13 @@
 
                 // It is now okay to let the various system services start their
                 // third party code...
-                
+
                 if (appWidgetF != null) appWidgetF.systemReady(safeMode);
                 if (wallpaperF != null) wallpaperF.systemReady();
                 if (immF != null) immF.systemReady();
             }
         });
-        
+
         Looper.loop();
         Log.d(TAG, "System ServerThread is exiting!");
     }
diff --git a/services/java/com/android/server/Watchdog.java b/services/java/com/android/server/Watchdog.java
index 68bf4fb..2ff9100 100644
--- a/services/java/com/android/server/Watchdog.java
+++ b/services/java/com/android/server/Watchdog.java
@@ -52,16 +52,6 @@
     static final int GLOBAL_PSS = 2719;
 
     static final int TIME_TO_WAIT = DB ? 15*1000 : 60*1000;
-    static final int EVENT_LOG_TAG = 2802;
-    static final int EVENT_LOG_PROC_PSS_TAG = 2803;
-    static final int EVENT_LOG_SOFT_RESET_TAG = 2804;
-    static final int EVENT_LOG_HARD_RESET_TAG = 2805;
-    static final int EVENT_LOG_PSS_STATS_TAG = 2806;
-    static final int EVENT_LOG_PROC_STATS_TAG = 2807;
-    static final int EVENT_LOG_SCHEDULED_REBOOT_TAG = 2808;
-    static final int EVENT_LOG_MEMINFO_TAG = 2809;
-    static final int EVENT_LOG_VMSTAT_TAG = 2810;
-    static final int EVENT_LOG_REQUESTED_REBOOT_TAG = 2811;
 
     static final int MEMCHECK_DEFAULT_INTERVAL = DB ? 30 : 30*60; // 30 minutes
     static final int MEMCHECK_DEFAULT_LOG_REALTIME_INTERVAL = DB ? 60 : 2*60*60;      // 2 hours
@@ -188,7 +178,7 @@
             } else {
                 mState = STATE_HARD;
             }
-            EventLog.writeEvent(EVENT_LOG_PROC_PSS_TAG, mProcessName, pid, mLastPss);
+            EventLog.writeEvent(EventLogTags.WATCHDOG_PROC_PSS, mProcessName, pid, mLastPss);
 
             if (mState == STATE_OK) {
                 // Memory is good, don't recover.
@@ -197,7 +187,7 @@
 
             if (mState == STATE_HARD) {
                 // Memory is really bad, kill right now.
-                EventLog.writeEvent(EVENT_LOG_HARD_RESET_TAG, mProcessName, pid,
+                EventLog.writeEvent(EventLogTags.WATCHDOG_HARD_RESET, mProcessName, pid,
                         mHardThreshold, mLastPss);
                 return mEnabled;
             }
@@ -212,7 +202,7 @@
             } else {
                 skipReason = shouldWeBeBrutalLocked(curTime);
             }
-            EventLog.writeEvent(EVENT_LOG_SOFT_RESET_TAG, mProcessName, pid,
+            EventLog.writeEvent(EventLogTags.WATCHDOG_SOFT_RESET, mProcessName, pid,
                     mSoftThreshold, mLastPss, skipReason != null ? skipReason : "");
             if (skipReason != null) {
                 mNeedScheduledCheck = true;
@@ -348,7 +338,7 @@
             mReqMinScreenOff = intent.getIntExtra("minScreenOff", -1);
             mReqMinNextAlarm = intent.getIntExtra("minNextAlarm", -1);
             mReqRecheckInterval = intent.getIntExtra("recheckInterval", -1);
-            EventLog.writeEvent(EVENT_LOG_REQUESTED_REBOOT_TAG,
+            EventLog.writeEvent(EventLogTags.WATCHDOG_REQUESTED_REBOOT,
                     mReqRebootNoWait ? 1 : 0, mReqRebootInterval,
                             mReqRecheckInterval, mReqRebootStartTime,
                     mReqRebootWindow, mReqMinScreenOff, mReqMinNextAlarm);
@@ -561,21 +551,21 @@
     void logGlobalMemory() {
         PssStats stats = mPssStats;
         mActivity.collectPss(stats);
-        EventLog.writeEvent(EVENT_LOG_PSS_STATS_TAG,
+        EventLog.writeEvent(EventLogTags.WATCHDOG_PSS_STATS,
                 stats.mEmptyPss, stats.mEmptyCount,
                 stats.mBackgroundPss, stats.mBackgroundCount,
                 stats.mServicePss, stats.mServiceCount,
                 stats.mVisiblePss, stats.mVisibleCount,
                 stats.mForegroundPss, stats.mForegroundCount,
                 stats.mNoPssCount);
-        EventLog.writeEvent(EVENT_LOG_PROC_STATS_TAG,
+        EventLog.writeEvent(EventLogTags.WATCHDOG_PROC_STATS,
                 stats.mProcDeaths[0], stats.mProcDeaths[1], stats.mProcDeaths[2],
                 stats.mProcDeaths[3], stats.mProcDeaths[4]);
         Process.readProcLines("/proc/meminfo", mMemInfoFields, mMemInfoSizes);
         for (int i=0; i<mMemInfoSizes.length; i++) {
             mMemInfoSizes[i] *= 1024;
         }
-        EventLog.writeEvent(EVENT_LOG_MEMINFO_TAG,
+        EventLog.writeEvent(EventLogTags.WATCHDOG_MEMINFO,
                 (int)mMemInfoSizes[0], (int)mMemInfoSizes[1], (int)mMemInfoSizes[2],
                 (int)mMemInfoSizes[3], (int)mMemInfoSizes[4],
                 (int)mMemInfoSizes[5], (int)mMemInfoSizes[6], (int)mMemInfoSizes[7],
@@ -589,7 +579,7 @@
             mVMStatSizes[i] -= mPrevVMStatSizes[i];
             mPrevVMStatSizes[i] = v;
         }
-        EventLog.writeEvent(EVENT_LOG_VMSTAT_TAG, dur,
+        EventLog.writeEvent(EventLogTags.WATCHDOG_VMSTAT, dur,
                 (int)mVMStatSizes[0], (int)mVMStatSizes[1], (int)mVMStatSizes[2],
                 (int)mVMStatSizes[3], (int)mVMStatSizes[4]);
     }
@@ -635,7 +625,7 @@
                     (now-mBootTime) >= (rebootIntervalMillis-rebootWindowMillis)) {
                 if (fromAlarm && rebootWindowMillis <= 0) {
                     // No reboot window -- just immediately reboot.
-                    EventLog.writeEvent(EVENT_LOG_SCHEDULED_REBOOT_TAG, now,
+                    EventLog.writeEvent(EventLogTags.WATCHDOG_SCHEDULED_REBOOT, now,
                             (int)rebootIntervalMillis, (int)rebootStartTime*1000,
                             (int)rebootWindowMillis, "");
                     rebootSystem("Checkin scheduled forced");
@@ -649,7 +639,7 @@
                             now, rebootStartTime);
                 } else if (now < (realStartTime+rebootWindowMillis)) {
                     String doit = shouldWeBeBrutalLocked(now);
-                    EventLog.writeEvent(EVENT_LOG_SCHEDULED_REBOOT_TAG, now,
+                    EventLog.writeEvent(EventLogTags.WATCHDOG_SCHEDULED_REBOOT, now,
                             (int)rebootInterval, (int)rebootStartTime*1000,
                             (int)rebootWindowMillis, doit != null ? doit : "");
                     if (doit == null) {
@@ -838,7 +828,7 @@
             // First send a SIGQUIT so that we can see where it was hung. Then
             // kill this process so that the system will restart.
             String name = (mCurrentMonitor != null) ? mCurrentMonitor.getClass().getName() : "null";
-            EventLog.writeEvent(EVENT_LOG_TAG, name);
+            EventLog.writeEvent(EventLogTags.WATCHDOG, name);
             Process.sendSignal(Process.myPid(), Process.SIGNAL_QUIT);
 
             // Wait a bit longer before killing so we can make sure that the stacks are captured.
diff --git a/services/java/com/android/server/WindowManagerService.java b/services/java/com/android/server/WindowManagerService.java
index 05d340e..df011a2 100644
--- a/services/java/com/android/server/WindowManagerService.java
+++ b/services/java/com/android/server/WindowManagerService.java
@@ -152,8 +152,6 @@
     static final boolean BLUR = true;
     static final boolean localLOGV = DEBUG;
 
-    static final int LOG_WM_NO_SURFACE_MEMORY = 31000;
-
     /** How long to wait for subsequent key repeats, in milliseconds */
     static final int KEY_REPEAT_DELAY = 50;
 
@@ -193,7 +191,7 @@
     static final int INJECT_FAILED = 0;
     static final int INJECT_SUCCEEDED = 1;
     static final int INJECT_NO_PERMISSION = -1;
-    
+
     static final int UPDATE_FOCUS_NORMAL = 0;
     static final int UPDATE_FOCUS_WILL_ASSIGN_LAYERS = 1;
     static final int UPDATE_FOCUS_PLACING_SURFACES = 2;
@@ -309,13 +307,13 @@
      * animation.  It will be used for the next exit animation.
      */
     AppWindowToken mLastEnterAnimToken;
-    
+
     /**
      * These were the layout params used to retrieve the last enter animation.
      * They will be used for the next exit animation.
      */
     LayoutParams mLastEnterAnimParams;
-    
+
     /**
      * Z-ordered (bottom-most first) list of all Window objects.
      */
@@ -422,7 +420,7 @@
     final ArrayList<WindowState> mInputMethodDialogs = new ArrayList<WindowState>();
 
     final ArrayList<WindowToken> mWallpaperTokens = new ArrayList<WindowToken>();
-    
+
     // If non-null, this is the currently visible window that is associated
     // with the wallpaper.
     WindowState mWallpaperTarget = null;
@@ -447,7 +445,7 @@
     static final long WALLPAPER_TIMEOUT = 150;
     // Time we wait after a timeout before trying to wait again.
     static final long WALLPAPER_TIMEOUT_RECOVERY = 10000;
-    
+
     AppWindowToken mFocusedApp = null;
 
     PowerManagerService mPowerManager;
@@ -463,7 +461,7 @@
     Session mHoldingScreenOn;
 
     boolean mTurnOnScreen;
-    
+
     /**
      * Whether the UI is currently running in touch mode (not showing
      * navigational focus because the user is directly pressing the screen).
@@ -570,7 +568,7 @@
         if (MEASURE_LATENCY) {
             lt = new LatencyTimer(100, 1000);
         }
-        
+
         mContext = context;
         mHaveInputMethods = haveInputMethods;
         mLimitedAlphaCompositing = context.getResources().getBoolean(
@@ -728,7 +726,7 @@
                             i--;
                             break;
                         }
-                        
+
                         // We haven't reached the token yet; if this token
                         // is not going to the bottom and has windows, we can
                         // use it as an anchor for when we do reach the token.
@@ -1247,16 +1245,16 @@
                 || mUpperWallpaperTarget != null
                 || mLowerWallpaperTarget != null;
     }
-    
+
     static final int ADJUST_WALLPAPER_LAYERS_CHANGED = 1<<1;
     static final int ADJUST_WALLPAPER_VISIBILITY_CHANGED = 1<<2;
-    
+
     int adjustWallpaperWindowsLocked() {
         int changed = 0;
-        
+
         final int dw = mDisplay.getWidth();
         final int dh = mDisplay.getHeight();
-        
+
         // First find top-most window that has asked to be on top of the
         // wallpaper; all wallpapers go behind it.
         final ArrayList localmWindows = mWindows;
@@ -1332,19 +1330,19 @@
                 return 0;
             }
         }
-        
+
         if (mWallpaperTarget != foundW) {
             if (DEBUG_WALLPAPER) {
                 Log.v(TAG, "New wallpaper target: " + foundW
                         + " oldTarget: " + mWallpaperTarget);
             }
-            
+
             mLowerWallpaperTarget = null;
             mUpperWallpaperTarget = null;
-            
+
             WindowState oldW = mWallpaperTarget;
             mWallpaperTarget = foundW;
-            
+
             // Now what is happening...  if the current and new targets are
             // animating, then we are in our super special mode!
             if (foundW != null && oldW != null) {
@@ -1367,7 +1365,7 @@
                                     + "=" + oldW + "; new#" + foundI
                                     + "=" + foundW);
                         }
-                        
+
                         // Set the new target correctly.
                         if (foundW.mAppToken != null && foundW.mAppToken.hiddenRequested) {
                             if (DEBUG_WALLPAPER) {
@@ -1375,7 +1373,7 @@
                             }
                             mWallpaperTarget = oldW;
                         }
-                        
+
                         // Now set the upper and lower wallpaper targets
                         // correctly, and make sure that we are positioning
                         // the wallpaper below the lower.
@@ -1399,7 +1397,7 @@
                     }
                 }
             }
-            
+
         } else if (mLowerWallpaperTarget != null) {
             // Is it time to stop animating?
             boolean lowerAnimating = mLowerWallpaperTarget.mAnimation != null
@@ -1416,25 +1414,25 @@
                 mUpperWallpaperTarget = null;
             }
         }
-        
+
         boolean visible = foundW != null;
         if (visible) {
             // The window is visible to the compositor...  but is it visible
             // to the user?  That is what the wallpaper cares about.
             visible = isWallpaperVisible(foundW);
             if (DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper visibility: " + visible);
-            
+
             // If the wallpaper target is animating, we may need to copy
             // its layer adjustment.  Only do this if we are not transfering
             // between two wallpaper targets.
             mWallpaperAnimLayerAdjustment =
                     (mLowerWallpaperTarget == null && foundW.mAppToken != null)
                     ? foundW.mAppToken.animLayerAdjustment : 0;
-            
+
             final int maxLayer = mPolicy.getMaxWallpaperLayer()
                     * TYPE_LAYER_MULTIPLIER
                     + TYPE_LAYER_OFFSET;
-            
+
             // Now w is the window we are supposed to be behind...  but we
             // need to be sure to also be behind any of its attached windows,
             // AND any starting window associated with it, AND below the
@@ -1455,7 +1453,7 @@
         } else {
             if (DEBUG_WALLPAPER) Log.v(TAG, "No wallpaper target");
         }
-        
+
         if (foundW == null && topCurW != null) {
             // There is no wallpaper target, so it goes at the bottom.
             // We will assume it is the same place as last time, if known.
@@ -1466,7 +1464,7 @@
             // what is below it for later.
             foundW = foundI > 0 ? (WindowState)localmWindows.get(foundI-1) : null;
         }
-        
+
         if (visible) {
             if (mWallpaperTarget.mWallpaperX >= 0) {
                 mLastWallpaperX = mWallpaperTarget.mWallpaperX;
@@ -1477,7 +1475,7 @@
                 mLastWallpaperYStep = mWallpaperTarget.mWallpaperYStep;
             }
         }
-        
+
         // Start stepping backwards from here, ensuring that our wallpaper windows
         // are correctly placed.
         int curTokenIndex = mWallpaperTokens.size();
@@ -1491,16 +1489,16 @@
                 // correct size.
                 mLayoutNeeded = true;
             }
-            
+
             int curWallpaperIndex = token.windows.size();
             while (curWallpaperIndex > 0) {
                 curWallpaperIndex--;
                 WindowState wallpaper = token.windows.get(curWallpaperIndex);
-                
+
                 if (visible) {
                     updateWallpaperOffsetLocked(wallpaper, dw, dh, false);
                 }
-                
+
                 // First, make sure the client has the current visibility
                 // state.
                 if (wallpaper.mWallpaperVisible != visible) {
@@ -1513,11 +1511,11 @@
                     } catch (RemoteException e) {
                     }
                 }
-                
+
                 wallpaper.mAnimLayer = wallpaper.mLayer + mWallpaperAnimLayerAdjustment;
                 if (DEBUG_LAYERS || DEBUG_WALLPAPER) Log.v(TAG, "Wallpaper win "
                         + wallpaper + " anim layer: " + wallpaper.mAnimLayer);
-                
+
                 // First, if this window is at the current index, then all
                 // is well.
                 if (wallpaper == foundW) {
@@ -1526,7 +1524,7 @@
                             ? (WindowState)localmWindows.get(foundI-1) : null;
                     continue;
                 }
-                
+
                 // The window didn't match...  the current wallpaper window,
                 // wherever it is, is in the wrong place, so make sure it is
                 // not in the list.
@@ -1539,17 +1537,17 @@
                         foundI--;
                     }
                 }
-                
+
                 // Now stick it in.
                 if (DEBUG_WALLPAPER || DEBUG_WINDOW_MOVEMENT) Log.v(TAG,
                         "Moving wallpaper " + wallpaper
                         + " from " + oldIndex + " to " + foundI);
-                
+
                 localmWindows.add(foundI, wallpaper);
                 changed |= ADJUST_WALLPAPER_LAYERS_CHANGED;
             }
         }
-        
+
         return changed;
     }
 
@@ -1591,7 +1589,7 @@
             wallpaperWin.mWallpaperXStep = wpxs;
             rawChanged = true;
         }
-        
+
         float wpy = mLastWallpaperY >= 0 ? mLastWallpaperY : 0.5f;
         float wpys = mLastWallpaperYStep >= 0 ? mLastWallpaperYStep : -1.0f;
         int availh = wallpaperWin.mFrame.bottom-wallpaperWin.mFrame.top-dh;
@@ -1607,7 +1605,7 @@
             wallpaperWin.mWallpaperYStep = wpys;
             rawChanged = true;
         }
-        
+
         if (rawChanged) {
             try {
                 if (DEBUG_WALLPAPER) Log.v(TAG, "Report new wp offset "
@@ -1644,10 +1642,10 @@
             } catch (RemoteException e) {
             }
         }
-        
+
         return changed;
     }
-    
+
     void wallpaperOffsetsComplete(IBinder window) {
         synchronized (mWindowMap) {
             if (mWaitingOnWallpaper != null &&
@@ -1657,13 +1655,13 @@
             }
         }
     }
-    
+
     boolean updateWallpaperOffsetLocked(WindowState changingTarget, boolean sync) {
         final int dw = mDisplay.getWidth();
         final int dh = mDisplay.getHeight();
-        
+
         boolean changed = false;
-        
+
         WindowState target = mWallpaperTarget;
         if (target != null) {
             if (target.mWallpaperX >= 0) {
@@ -1677,7 +1675,7 @@
                 mLastWallpaperY = changingTarget.mWallpaperY;
             }
         }
-        
+
         int curTokenIndex = mWallpaperTokens.size();
         while (curTokenIndex > 0) {
             curTokenIndex--;
@@ -1694,15 +1692,15 @@
                 }
             }
         }
-        
+
         return changed;
     }
-    
+
     void updateWallpaperVisibilityLocked() {
         final boolean visible = isWallpaperVisible(mWallpaperTarget);
         final int dw = mDisplay.getWidth();
         final int dh = mDisplay.getHeight();
-        
+
         int curTokenIndex = mWallpaperTokens.size();
         while (curTokenIndex > 0) {
             curTokenIndex--;
@@ -1713,7 +1711,7 @@
                 // correct size.
                 mLayoutNeeded = true;
             }
-            
+
             int curWallpaperIndex = token.windows.size();
             while (curWallpaperIndex > 0) {
                 curWallpaperIndex--;
@@ -1721,7 +1719,7 @@
                 if (visible) {
                     updateWallpaperOffsetLocked(wallpaper, dw, dh, false);
                 }
-                
+
                 if (wallpaper.mWallpaperVisible != visible) {
                     wallpaper.mWallpaperVisible = visible;
                     try {
@@ -1735,7 +1733,7 @@
             }
         }
     }
-    
+
     void sendPointerToWallpaperLocked(WindowState srcWin,
             MotionEvent pointer, long eventTime) {
         int curTokenIndex = mWallpaperTokens.size();
@@ -1773,7 +1771,7 @@
             }
         }
     }
-    
+
     public int addWindow(Session session, IWindow client,
             WindowManager.LayoutParams attrs, int viewVisibility,
             Rect outContentInsets) {
@@ -2080,7 +2078,7 @@
             e.fillInStackTrace();
             Log.w(TAG, "Removing window " + win, e);
         }
-        
+
         mPolicy.removeWindowLw(win);
         win.removeLocked();
 
@@ -2137,7 +2135,7 @@
         } else if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) {
             adjustWallpaperWindowsLocked();
         }
-        
+
         if (!mInLayout) {
             assignLayersLocked();
             mLayoutNeeded = true;
@@ -2217,7 +2215,7 @@
             }
         }
     }
-    
+
     void wallpaperCommandComplete(IBinder window, Bundle result) {
         synchronized (mWindowMap) {
             if (mWaitingOnWallpaper != null &&
@@ -2227,7 +2225,7 @@
             }
         }
     }
-    
+
     public Bundle sendWindowWallpaperCommandLocked(WindowState window,
             String action, int x, int y, int z, Bundle extras, boolean sync) {
         if (window == mWallpaperTarget || window == mLowerWallpaperTarget
@@ -2250,15 +2248,15 @@
                     }
                 }
             }
-            
+
             if (doWait) {
                 // XXX Need to wait for result.
             }
         }
-        
+
         return null;
     }
-    
+
     public int relayoutWindow(Session session, IWindow client,
             WindowManager.LayoutParams attrs, int requestedWidth,
             int requestedHeight, int viewVisibility, boolean insetsPending,
@@ -2319,7 +2317,7 @@
 
             boolean wallpaperMayMove = win.mViewVisibility != viewVisibility
                     && (win.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0;
-            
+
             win.mRelayoutCalled = true;
             final int oldVisibility = win.mViewVisibility;
             win.mViewVisibility = viewVisibility;
@@ -2417,7 +2415,7 @@
                         }
                     }
                 }
-                
+
                 if (win.mSurface == null || (win.getAttrs().flags
                         & WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING) == 0
                         || win.mSurfacePendingDestroy) {
@@ -3014,7 +3012,7 @@
                 "updateOrientationFromAppTokens()")) {
             throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
         }
-        
+
         Configuration config;
         long ident = Binder.clearCallingIdentity();
         config = updateOrientationFromAppTokensUnchecked(currentConfig,
@@ -3207,7 +3205,7 @@
             mNextAppTransitionExit = exitAnim;
         }
     }
-    
+
     public void executeAppTransition() {
         if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                 "executeAppTransition()")) {
@@ -3375,7 +3373,7 @@
                     return;
                 }
             }
-            
+
             mStartingIconInTransition = true;
             wtoken.startingData = new StartingData(
                     pkg, theme, nonLocalizedLabel,
@@ -3543,14 +3541,14 @@
                     mOpeningApps.add(wtoken);
                     wtoken.startingDisplayed = false;
                     wtoken.startingMoved = false;
-                    
+
                     // If the token is currently hidden (should be the
                     // common case), then we need to set up to wait for
                     // its windows to be ready.
                     if (wtoken.hidden) {
                         wtoken.allDrawn = false;
                         wtoken.waitingToShow = true;
-    
+
                         if (wtoken.clientHidden) {
                             // In the case where we are making an app visible
                             // but holding off for a transition, we still need
@@ -3564,7 +3562,7 @@
                     }
                 } else {
                     mClosingApps.add(wtoken);
-                    
+
                     // If the token is currently visible (should be the
                     // common case), then set up to wait for it to be hidden.
                     if (!wtoken.hidden) {
@@ -4008,7 +4006,7 @@
                     }
                 }
             }
-            
+
             if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
                 moveAppWindowsLocked(tokens, mAppTokens.size());
             }
@@ -4041,7 +4039,7 @@
                     pos++;
                 }
             }
-            
+
             if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) {
                 moveAppWindowsLocked(tokens, 0);
             }
@@ -4126,7 +4124,7 @@
             }
         }
     }
-    
+
     static float fixScale(float scale) {
         if (scale < 0) scale = 0;
         else if (scale > 20) scale = 20;
@@ -4745,7 +4743,7 @@
             orientation = Configuration.ORIENTATION_LANDSCAPE;
         }
         config.orientation = orientation;
-        
+
         DisplayMetrics dm = new DisplayMetrics();
         mDisplay.getMetrics(dm);
         CompatibilityInfo.updateCompatibleScreenFrame(dm, orientation, mCompatibleScreenFrame);
@@ -4780,7 +4778,7 @@
                     mScreenLayout = Configuration.SCREENLAYOUT_SIZE_LARGE;
                 } else {
                     mScreenLayout = Configuration.SCREENLAYOUT_SIZE_NORMAL;
-                    
+
                     // If this screen is wider than normal HVGA, or taller
                     // than FWVGA, then for old apps we want to run in size
                     // compatibility mode.
@@ -4788,7 +4786,7 @@
                         mScreenLayout |= Configuration.SCREENLAYOUT_COMPAT_NEEDED;
                     }
                 }
-                
+
                 // Is this a long screen?
                 if (((longSize*3)/5) >= (shortSize-1)) {
                     // Anything wider than WVGA (5:3) is considering to be long.
@@ -4799,7 +4797,7 @@
             }
         }
         config.screenLayout = mScreenLayout;
-        
+
         config.keyboardHidden = Configuration.KEYBOARDHIDDEN_NO;
         config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO;
         mPolicy.adjustConfigurationLw(config);
@@ -4879,7 +4877,7 @@
 
         Object targetObj = mKeyWaiter.waitForNextEventTarget(null, qev,
                 ev, true, false, pid, uid);
-        
+
         if (MEASURE_LATENCY) {
             lt.sample("3 Last dispatch finished ", System.nanoTime() - qev.whenNano);
         }
@@ -4933,7 +4931,7 @@
 
         final long eventTime = ev.getEventTime();
         final long eventTimeNano = ev.getEventTimeNano();
-        
+
         //Log.i(TAG, "Sending " + ev + " to " + target);
 
         if (uid != 0 && uid != target.mSession.mUid) {
@@ -4950,7 +4948,7 @@
                 return INJECT_NO_PERMISSION;
             }
         }
-        
+
         if (MEASURE_LATENCY) {
             lt.sample("4 in dispatchPointer     ", System.nanoTime() - eventTimeNano);
         }
@@ -5054,7 +5052,7 @@
                 ev.recycle();
                 return INJECT_SUCCEEDED;
             }
-            
+
             if (qev != null && action == MotionEvent.ACTION_MOVE) {
                 mKeyWaiter.bindTargetWindowLocked(target,
                         KeyWaiter.RETURN_PENDING_POINTER, qev);
@@ -5079,13 +5077,13 @@
                         mKeyWaiter.mOutsideTouchTargets = null;
                     }
                 }
-                
+
                 // If we are on top of the wallpaper, then the wallpaper also
                 // gets to see this movement.
                 if (mWallpaperTarget == target || mSendingPointersToWallpaper) {
                     sendPointerToWallpaperLocked(null, ev, eventTime);
                 }
-                
+
                 final Rect frame = target.mFrame;
                 ev.offsetLocation(-(float)frame.left, -(float)frame.top);
                 mKeyWaiter.bindTargetWindowLocked(target);
@@ -5098,7 +5096,7 @@
             if (DEBUG_INPUT || DEBUG_FOCUS || WindowManagerPolicy.WATCH_POINTER) {
                 Log.v(TAG, "Delivering pointer " + qev + " to " + target);
             }
-            
+
             if (MEASURE_LATENCY) {
                 lt.sample("6 before svr->client ipc ", System.nanoTime() - eventTimeNano);
             }
@@ -5219,7 +5217,7 @@
         if (event.getRepeatCount() > 0 && mQueue.hasKeyUpEvent(event)) {
             return INJECT_SUCCEEDED;
         }
-        
+
         WindowState focus = (WindowState)focusObj;
 
         if (DEBUG_INPUT) Log.v(
@@ -5704,7 +5702,7 @@
                 final int repeatCount = nextKey.getRepeatCount();
                 final boolean down = nextKey.getAction() != KeyEvent.ACTION_UP;
                 boolean dispatch = mKeyWaiter.checkShouldDispatchKey(keycode);
-                
+
                 if (!dispatch) {
                     if (callingUid == 0 ||
                             mContext.checkPermission(
@@ -5736,7 +5734,7 @@
                                 callingPid, callingUid)
                                 == PackageManager.PERMISSION_GRANTED) {
                     if (mPolicy.interceptKeyTi(focus,
-                            keycode, nextKey.getMetaState(), down, repeatCount, 
+                            keycode, nextKey.getMetaState(), down, repeatCount,
                             nextKey.getFlags())) {
                         return CONSUMED_EVENT_TOKEN;
                     }
@@ -5967,7 +5965,7 @@
             MotionEvent res = null;
             QueuedEvent qev = null;
             WindowState win = null;
-            
+
             synchronized (this) {
                 if (DEBUG_INPUT) Log.v(
                     TAG, "finishedKey: client=" + client.asBinder()
@@ -6011,7 +6009,7 @@
                         res.offsetLocation(-win.mFrame.left, -win.mFrame.top);
                     }
                 }
-                
+
                 if (res != null && returnWhat == RETURN_PENDING_POINTER) {
                     synchronized (mWindowMap) {
                         if (mWallpaperTarget == win || mSendingPointersToWallpaper) {
@@ -6020,7 +6018,7 @@
                     }
                 }
             }
-            
+
             return res;
         }
 
@@ -6703,11 +6701,11 @@
                 }
             }
         }
-        
+
         public void wallpaperOffsetsComplete(IBinder window) {
             WindowManagerService.this.wallpaperOffsetsComplete(window);
         }
-        
+
         public Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
                 int z, Bundle extras, boolean sync) {
             synchronized(mWindowMap) {
@@ -6721,11 +6719,11 @@
                 }
             }
         }
-        
+
         public void wallpaperCommandComplete(IBinder window, Bundle result) {
             WindowManagerService.this.wallpaperCommandComplete(window, result);
         }
-        
+
         void windowAddedLocked() {
             if (mSurfaceSession == null) {
                 if (localLOGV) Log.v(
@@ -6920,7 +6918,7 @@
         // Wallpaper windows: pixels offset based on above variables.
         int mXOffset;
         int mYOffset;
-        
+
         // This is set after IWindowSession.relayout() has been called at
         // least once for the window.  It allows us to detect the situation
         // where we don't yet have a surface, but should have one soon, so
@@ -7103,7 +7101,7 @@
 
             // Now make sure the window fits in the overall display.
             Gravity.applyDisplay(mAttrs.gravity, df, frame);
-            
+
             // Make sure the content and visible frames are inside of the
             // final window frame.
             if (content.left < frame.left) content.left = frame.left;
@@ -7131,7 +7129,7 @@
                 updateWallpaperOffsetLocked(this, mDisplay.getWidth(),
                         mDisplay.getHeight(), false);
             }
-            
+
             if (localLOGV) {
                 //if ("com.google.android.youtube".equals(mAttrs.packageName)
                 //        && mAttrs.type == WindowManager.LayoutParams.TYPE_APPLICATION_PANEL) {
@@ -7334,7 +7332,7 @@
                     WindowState c = (WindowState)mChildWindows.get(i);
                     c.mAttachedHidden = true;
                 }
-                
+
                 if (mReportDestroySurface) {
                     mReportDestroySurface = false;
                     mSurfacePendingDestroy = true;
@@ -7345,7 +7343,7 @@
                     } catch (RemoteException e) {
                     }
                 }
-                
+
                 try {
                     if (DEBUG_VISIBILITY) {
                         RuntimeException e = new RuntimeException();
@@ -7365,7 +7363,7 @@
                         + " surface " + mSurface + " session " + mSession
                         + ": " + e.toString());
                 }
-                
+
                 mSurface = null;
             }
         }
@@ -7443,7 +7441,7 @@
                 if (mAttrs.type != TYPE_APPLICATION_STARTING
                         && mAppToken != null) {
                     mAppToken.firstWindowDrawn = true;
-                    
+
                     if (mAppToken.startingData != null) {
                         if (DEBUG_STARTING_WINDOW || DEBUG_ANIM) Log.v(TAG,
                                 "Finish starting " + mToken
@@ -7633,7 +7631,7 @@
             Transformation appTransformation =
                     (mAppToken != null && mAppToken.hasTransformation)
                     ? mAppToken.transformation : null;
-            
+
             // Wallpapers are animated based on the "real" window they
             // are currently targeting.
             if (mAttrs.type == TYPE_WALLPAPER && mLowerWallpaperTarget == null
@@ -7656,7 +7654,7 @@
                     }
                 }
             }
-            
+
             if (selfTransformation || attachedTransformation != null
                     || appTransformation != null) {
                 // cache often used attributes locally
@@ -8191,19 +8189,19 @@
         // Set to true when this token is in a pending transaction where it
         // will be shown.
         boolean waitingToShow;
-        
+
         // Set to true when this token is in a pending transaction where it
         // will be hidden.
         boolean waitingToHide;
-        
+
         // Set to true when this token is in a pending transaction where its
         // windows will be put to the bottom of the list.
         boolean sendingToBottom;
-        
+
         // Set to true when this token is in a pending transaction where its
         // windows will be put to the top of the list.
         boolean sendingToTop;
-        
+
         WindowToken(IBinder _token, int type, boolean _explicit) {
             token = _token;
             windowType = type;
@@ -8534,7 +8532,7 @@
             }
             return null;
         }
-        
+
         void dump(PrintWriter pw, String prefix) {
             super.dump(pw, prefix);
             if (appToken != null) {
@@ -9050,7 +9048,7 @@
         int i;
         int lastWallpaper = -1;
         int numRemoved = 0;
-        
+
         // First remove all existing app windows.
         i=0;
         while (i < NW) {
@@ -9068,12 +9066,12 @@
             }
             i++;
         }
-        
+
         // The wallpaper window(s) typically live at the bottom of the stack,
         // so skip them before adding app tokens.
         lastWallpaper++;
         i = lastWallpaper;
-        
+
         // First add all of the exiting app tokens...  these are no longer
         // in the main app list, but still have windows shown.  We put them
         // in the back because now that the animation is over we no longer
@@ -9082,20 +9080,20 @@
         for (int j=0; j<NT; j++) {
             i = reAddAppWindowsLocked(i, mExitingAppTokens.get(j));
         }
-        
+
         // And add in the still active app tokens in Z order.
         NT = mAppTokens.size();
         for (int j=0; j<NT; j++) {
             i = reAddAppWindowsLocked(i, mAppTokens.get(j));
         }
-        
+
         i -= lastWallpaper;
         if (i != numRemoved) {
             Log.w(TAG, "Rebuild removed " + numRemoved
                     + " windows but added " + i);
         }
     }
-    
+
     private final void assignLayersLocked() {
         int N = mWindows.size();
         int curBaseLayer = 0;
@@ -9357,7 +9355,7 @@
                 mPolicy.beginAnimationLw(dw, dh);
 
                 final int N = mWindows.size();
-                
+
                 for (i=N-1; i>=0; i--) {
                     WindowState w = (WindowState)mWindows.get(i);
 
@@ -9373,7 +9371,7 @@
                                 wallpaperMayChange = true;
                             }
                         }
-                        
+
                         boolean wasAnimating = w.mAnimating;
                         if (w.stepAnimationLocked(currentTime, dw, dh)) {
                             animating = true;
@@ -9382,7 +9380,7 @@
                         if (wasAnimating && !w.mAnimating && mWallpaperTarget == w) {
                             wallpaperMayChange = true;
                         }
-                        
+
                         if (mPolicy.doesForceHide(w, attrs)) {
                             if (!wasAnimating && animating) {
                                 wallpaperForceHidingChanged = true;
@@ -9413,7 +9411,7 @@
                                 wallpaperMayChange = true;
                             }
                         }
-                        
+
                         mPolicy.animatingWindowLw(w, attrs);
                     }
 
@@ -9562,18 +9560,18 @@
                             }
                             mToTopApps.clear();
                         }
-                        
+
                         WindowState oldWallpaper = mWallpaperTarget;
-                        
+
                         adjustWallpaperWindowsLocked();
                         wallpaperMayChange = false;
-                        
+
                         // The top-most window will supply the layout params,
                         // and we will determine it below.
                         LayoutParams animLp = null;
                         AppWindowToken animToken = null;
                         int bestAnimLayer = -1;
-                        
+
                         if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
                                 "New wallpaper target=" + mWallpaperTarget
                                 + ", lower target=" + mLowerWallpaperTarget
@@ -9624,7 +9622,7 @@
                                 }
                             }
                         }
-                        
+
                         if (foundWallpapers == 3) {
                             if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
                                     "Wallpaper animation!");
@@ -9655,7 +9653,7 @@
                             if (DEBUG_APP_TRANSITIONS) Log.v(TAG,
                                     "New transit into wallpaper: " + transit);
                         }
-                        
+
                         if ((transit&WindowManagerPolicy.TRANSIT_ENTER_MASK) != 0) {
                             mLastEnterAnimToken = animToken;
                             mLastEnterAnimParams = animLp;
@@ -9664,7 +9662,7 @@
                             mLastEnterAnimToken = null;
                             mLastEnterAnimParams = null;
                         }
-                        
+
                         NN = mOpeningApps.size();
                         for (i=0; i<NN; i++) {
                             AppWindowToken wtoken = mOpeningApps.get(i);
@@ -9695,7 +9693,7 @@
                         }
 
                         mNextAppTransitionPackage = null;
-                        
+
                         mOpeningApps.clear();
                         mClosingApps.clear();
 
@@ -9712,7 +9710,7 @@
                         restart = true;
                     }
                 }
-                
+
                 if (!animating && mAppTransitionRunning) {
                     // We have finished the animation of an app transition.  To do
                     // this, we have delayed a lot of operations like showing and
@@ -9723,7 +9721,7 @@
                     mAppTransitionRunning = false;
                     // Clear information about apps that were moving.
                     mToBottomApps.clear();
-                    
+
                     rebuildAppWindowListLocked();
                     restart = true;
                     moveInputMethodWindowsIfNeededLocked(false);
@@ -9734,9 +9732,9 @@
                     // might have changed again.
                     focusMayChange = true;
                 }
-                
+
                 int adjResult = 0;
-                
+
                 if (wallpaperForceHidingChanged) {
                     // At this point, there was a window with a wallpaper that
                     // was force hiding other windows behind it, but now it
@@ -9771,13 +9769,13 @@
                         }
                     }
                 }
-                
+
                 if (wallpaperMayChange) {
                     if (DEBUG_WALLPAPER) Log.v(TAG,
                             "Wallpaper may change!  Adjusting");
                     adjResult = adjustWallpaperWindowsLocked();
                 }
-                
+
                 if ((adjResult&ADJUST_WALLPAPER_LAYERS_CHANGED) != 0) {
                     if (DEBUG_WALLPAPER) Log.v(TAG,
                             "Wallpaper layer changed: assigning layers + relayout");
@@ -9790,7 +9788,7 @@
                     restart = true;
                     mLayoutNeeded = true;
                 }
-                
+
                 if (focusMayChange) {
                     if (updateFocusedWindowLocked(UPDATE_FOCUS_PLACING_SURFACES)) {
                         restart = true;
@@ -9802,7 +9800,7 @@
                     restart = true;
                     performLayoutLockedInner();
                 }
-                
+
             } while (restart);
 
             // THIRD LOOP: Update the surfaces of all windows.
@@ -9817,7 +9815,7 @@
             boolean backgroundFillerShown = false;
 
             final int N = mWindows.size();
-            
+
             for (i=N-1; i>=0; i--) {
                 WindowState w = (WindowState)mWindows.get(i);
 
@@ -10067,7 +10065,7 @@
                 }
 
                 final boolean obscuredChanged = w.mObscured != obscured;
-                
+
                 // Update effect.
                 if (!(w.mObscured=obscured)) {
                     if (w.mSurface != null) {
@@ -10172,7 +10170,7 @@
                         }
                     }
                 }
-                
+
                 if (obscuredChanged && mWallpaperTarget == w) {
                     // This is the wallpaper target and its obscured state
                     // changed... make sure the current wallaper's visibility
@@ -10180,7 +10178,7 @@
                     updateWallpaperVisibilityLocked();
                 }
             }
-            
+
             if (backgroundFillerShown == false && mBackgroundFillerShown) {
                 mBackgroundFillerShown = false;
                 if (SHOW_TRANSACTIONS) Log.d(TAG, "hiding background filler");
@@ -10295,7 +10293,7 @@
         }
 
         boolean needRelayout = false;
-        
+
         if (!animating && mAppTransitionRunning) {
             // We have finished the animation of an app transition.  To do
             // this, we have delayed a lot of operations like showing and
@@ -10309,7 +10307,7 @@
             // Clear information about apps that were moving.
             mToBottomApps.clear();
         }
-        
+
         if (focusDisplayed) {
             mH.sendEmptyMessage(H.REPORT_LOSING_FOCUS);
         }
@@ -10339,7 +10337,7 @@
             Message m = mH.obtainMessage(H.HOLD_SCREEN_CHANGED, holdScreen);
             mH.sendMessage(m);
         }
-        
+
         if (mTurnOnScreen) {
             mPowerManager.userActivity(SystemClock.uptimeMillis(), false,
                     LocalPowerManager.BUTTON_EVENT, true);
@@ -10384,7 +10382,7 @@
     void reclaimSomeSurfaceMemoryLocked(WindowState win, String operation) {
         final Surface surface = win.mSurface;
 
-        EventLog.writeEvent(LOG_WM_NO_SURFACE_MEMORY, win.toString(),
+        EventLog.writeEvent(EventLogTags.WM_NO_SURFACE_MEMORY, win.toString(),
                 win.mSession.mPid, operation);
 
         if (mForceRemoves == null) {
@@ -10888,10 +10886,10 @@
     public void virtualKeyFeedback(KeyEvent event) {
         mPolicy.keyFeedbackFromInput(event);
     }
-    
+
     /**
      * DimAnimator class that controls the dim animation. This holds the surface and
-     * all state used for dim animation. 
+     * all state used for dim animation.
      */
     private static class DimAnimator {
         Surface mDimSurface;
@@ -10962,7 +10960,7 @@
                 mDimDeltaPerMs = (mDimTargetAlpha-mDimCurrentAlpha) / duration;
             }
         }
-            
+
         /**
          * Updating the surface's alpha. Returns true if the animation continues, or returns
          * false when the animation is finished and the dim surface is hidden.
@@ -10975,7 +10973,7 @@
                     mDimDeltaPerMs = (-mDimCurrentAlpha) / DEFAULT_DIM_DURATION;
                 }
             }
-            
+
             boolean animating = false;
             if (mLastDimAnimTime != 0) {
                 mDimCurrentAlpha += mDimDeltaPerMs