From ab5c49c7e7f5f61040650109a76f38a443fb852d Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Fri, 4 Dec 2009 10:31:43 -0800 Subject: 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. --- services/java/Android.mk | 3 +- .../com/android/server/BackupManagerService.java | 80 ++-- .../java/com/android/server/BatteryService.java | 74 ++-- .../com/android/server/ConnectivityService.java | 5 +- .../server/DeviceStorageMonitorService.java | 9 +- .../java/com/android/server/EventLogTags.logtags | 139 +++++++ .../android/server/InputMethodManagerService.java | 296 +++++++------- .../android/server/NotificationManagerService.java | 65 ++- .../com/android/server/PackageManagerService.java | 438 ++++++++++----------- .../com/android/server/PowerManagerService.java | 85 ++-- services/java/com/android/server/SystemServer.java | 12 +- services/java/com/android/server/Watchdog.java | 32 +- .../com/android/server/WindowManagerService.java | 284 +++++++------ 13 files changed, 802 insertions(+), 720 deletions(-) create mode 100644 services/java/com/android/server/EventLogTags.logtags (limited to 'services/java') diff --git a/services/java/Android.mk b/services/java/Android.mk index 5e912d6f3fd2..5c54e330e91b 100644 --- a/services/java/Android.mk +++ b/services/java/Android.mk @@ -5,7 +5,8 @@ LOCAL_PATH:= $(call my-dir) 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 c3b591ee64f9..3307932e928c 100644 --- a/services/java/com/android/server/BackupManagerService.java +++ b/services/java/com/android/server/BackupManagerService.java @@ -102,22 +102,6 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { : 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { //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 @@ class BackupManagerService extends IBackupManager.Stub { } 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 @@ class BackupManagerService extends IBackupManager.Stub { 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { // 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 @@ class BackupManagerService extends IBackupManager.Stub { } 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 bb369366837d..e98fa99835a9 100644 --- a/services/java/com/android/server/BatteryService.java +++ b/services/java/com/android/server/BatteryService.java @@ -68,23 +68,19 @@ import java.io.PrintWriter; */ 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 @@ class BatteryService extends Binder { private final Context mContext; private final IBatteryStats mBatteryStats; - + private boolean mAcOnline; private boolean mUsbOnline; private int mBatteryStatus; @@ -117,12 +113,12 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { dischargeDuration = SystemClock.elapsedRealtime() - mDischargeStartTime; logOutlier = true; } - + final boolean plugged = mPlugType != BATTERY_PLUGGED_NONE; final boolean oldPlugged = mLastPlugType != BATTERY_PLUGGED_NONE; @@ -285,9 +281,9 @@ class BatteryService extends Binder { && 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 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { } catch (RemoteException e) { // Should never happen. } - + int icon = getIcon(mBatteryLevel); intent.putExtra(BatteryManager.EXTRA_STATUS, mBatteryStatus); @@ -353,8 +349,8 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { } 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 @@ class BatteryService extends Binder { 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 @@ class BatteryService extends Binder { } } } - + 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 @@ class BatteryService extends Binder { 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 a91635e74321..676e5f66f8f3 100644 --- a/services/java/com/android/server/ConnectivityService.java +++ b/services/java/com/android/server/ConnectivityService.java @@ -56,9 +56,6 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 @@ public class ConnectivityService extends IConnectivityManager.Stub { 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 57af02953415..8e54c6edabe4 100644 --- a/services/java/com/android/server/DeviceStorageMonitorService.java +++ b/services/java/com/android/server/DeviceStorageMonitorService.java @@ -63,9 +63,6 @@ class DeviceStorageMonitorService extends Binder { 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 @@ class DeviceStorageMonitorService extends Binder { // 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 @@ class DeviceStorageMonitorService extends Binder { 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 @@ class DeviceStorageMonitorService extends Binder { 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 000000000000..5429c0c72c93 --- /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 e2e0ba9cc0b9..a64cb1acd1a2 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 mMethodList @@ -127,12 +125,12 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub binding = new InputBinding(null, inputContext.asBinder(), uid, pid); } } - + final HashMap mClients = new HashMap(); - + /** * 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub onSessionCreated(mMethod, session); } } - + public InputMethodManagerService(Context context, StatusBarService statusBar) { mContext = context; mHandler = new Handler(this); @@ -416,7 +414,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub handleMessage(msg); } }); - + IntentFilter packageFilt = new IntentFilter(); packageFilt.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilt.addAction(Intent.ACTION_PACKAGE_CHANGED); @@ -424,13 +422,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 class InputMethodManagerService extends IInputMethodManager.Stub } } } - + public List getInputMethodList() { synchronized (mMethodMap) { return new ArrayList(mMethodList); @@ -523,14 +521,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub List getEnabledInputMethodListLocked() { final ArrayList res = new ArrayList(); - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + return res; } @@ -549,13 +547,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub msg.recycle(); } } - + void unbindCurrentClientLocked() { if (mCurClient != null) { if (DEBUG) Log.v(TAG, "unbindCurrentInputLocked: client = " @@ -579,7 +577,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub + mCurClient.pid + " uid " + mCurClient.uid); } mCurClient = null; - + hideInputMethodMenuLocked(); } } - + private int getImeShowFlags() { int flags = 0; if (mShowForced) { @@ -603,7 +601,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return flags; } - + private int getAppShowFlags() { int flags = 0; if (mShowForced) { @@ -613,7 +611,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return flags; } - + InputBindResult attachNewInputLocked(boolean initial, boolean needResult) { if (!mBoundToMethod) { executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO( @@ -636,7 +634,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub ? new InputBindResult(session.session, mCurId, mCurSeq) : null; } - + InputBindResult startInputLocked(IInputMethodClient client, IInputContext inputContext, EditorInfo attribute, boolean initial, boolean needResult) { @@ -644,13 +642,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } catch (RemoteException e) { } - + if (mCurClient != cs) { // If the client is changing, we need to switch over to the new // one. @@ -682,14 +680,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + // 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return null; } - + public InputBindResult startInput(IInputMethodClient client, IInputContext inputContext, EditorInfo attribute, boolean initial, boolean needResult) { @@ -786,10 +784,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } mStatusBar.setIconVisibility(mInputMethodIcon, false); } - + public void onServiceDisconnected(ComponentName name) { synchronized (mMethodMap) { if (DEBUG) Log.v(TAG, "Service disconnected: " + name @@ -893,7 +891,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Binder.restoreCallingIdentity(ident); } } - + public boolean showSoftInput(IInputMethodClient client, int flags, ResultReceiver resultReceiver) { long ident = Binder.clearCallingIdentity(); @@ -979,7 +977,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return false; } } - + if (DEBUG) Log.v(TAG, "Client requesting input be shown"); return showCurrentInputLocked(flags, resultReceiver); } @@ -987,7 +985,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Binder.restoreCallingIdentity(ident); } } - + boolean showCurrentInputLocked(int flags, ResultReceiver resultReceiver) { mShowRequested = true; if ((flags&InputMethodManager.SHOW_IMPLICIT) == 0) { @@ -997,11 +995,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mShowExplicitlyRequested = true; mShowForced = true; } - + if (!mSystemReady) { return false; } - + boolean res = false; if (mCurMethod != null) { executeOrSendMessage(mCurMethod, mCaller.obtainMessageIOO( @@ -1015,15 +1013,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return false; } } - + if (DEBUG) Log.v(TAG, "Client requesting input be hidden"); return hideCurrentInputLocked(flags, resultReceiver); } @@ -1051,7 +1049,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Binder.restoreCallingIdentity(ident); } } - + boolean hideCurrentInputLocked(int flags, ResultReceiver resultReceiver) { if ((flags&InputMethodManager.HIDE_IMPLICIT_ONLY) != 0 && (mShowExplicitlyRequested || mShowForced)) { @@ -1078,7 +1076,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub + " 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub Binder.restoreCallingIdentity(ident); } } - + public void showInputMethodPickerFromClient(IInputMethodClient client) { synchronized (mMethodMap) { if (mCurClient == null || client == null @@ -1216,7 +1214,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + public void showMySoftInput(IBinder token, int flags) { synchronized (mMethodMap) { if (token == null || mCurToken != token) { @@ -1251,16 +1249,16 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } return true; // --------------------------------------------------------- - + case MSG_START_INPUT: args = (HandlerCaller.SomeArgs)msg.obj; try { @@ -1329,9 +1327,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } catch (RemoteException e) { } return true; - + // --------------------------------------------------------- - + case MSG_UNBIND_METHOD: try { ((IInputMethodClient)msg.obj).onUnbindMethod(msg.arg1); @@ -1373,13 +1371,13 @@ public class InputMethodManagerService extends IInputMethodManager.Stub HashMap map) { list.clear(); map.clear(); - + PackageManager pm = mContext.getPackageManager(); List 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + // ---------------------------------------------------------------------- - + 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 immis = getEnabledInputMethodList(); - + int N = (immis == null ? 0 : immis.size()); mItems = new CharSequence[N]; @@ -1465,7 +1463,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub hideInputMethodMenu(); } }; - + TypedArray a = context.obtainStyledAttributes(null, com.android.internal.R.styleable.DialogPreference, com.android.internal.R.attr.alertDialogStyle, 0); @@ -1479,7 +1477,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub .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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingDialog.show(); } } - + void hideInputMethodMenu() { synchronized (mMethodMap) { hideInputMethodMenuLocked(); } } - + void hideInputMethodMenuLocked() { if (DEBUG) Log.v(TAG, "Hide switching menu"); @@ -1512,14 +1510,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub "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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } } } - + if (!enabled) { if (!removed) { // We are disabling the input method but it is already @@ -1596,17 +1594,17 @@ public class InputMethodManagerService extends IInputMethodManager.Stub // 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } // ---------------------------------------------------------------------- - + @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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 @@ public class InputMethodManagerService extends IInputMethodManager.Stub + " mInputShown=" + mInputShown); p.println(" mSystemReady=" + mSystemReady + " mScreenOn=" + mScreenOn); } - + if (client != null) { p.println(" "); pw.flush(); @@ -1679,7 +1677,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub 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 147580b6d955..436a60e377f5 100755 --- a/services/java/com/android/server/NotificationManagerService.java +++ b/services/java/com/android/server/NotificationManagerService.java @@ -75,8 +75,8 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub private boolean mAdbEnabled = false; private boolean mAdbNotificationShown = false; private Notification mAdbNotification; - + private final ArrayList mNotificationList = new ArrayList(); @@ -127,11 +127,6 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub + " ledOnMS=" + notification.ledOnMS + " ledOffMS=" + notification.ledOffMS); } - + @Override public final String toString() { @@ -221,11 +216,11 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub SettingsObserver(Handler handler) { super(handler); } - + void observe() { ContentResolver resolver = mContext.getContentResolver(); resolver.registerContentObserver(Settings.Secure.getUriFor( @@ -422,7 +417,7 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub .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 @@ class NotificationManagerService extends INotificationManager.Stub // 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 @@ class NotificationManagerService extends INotificationManager.Stub /** * 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 @@ class NotificationManagerService extends INotificationManager.Stub */ 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 @@ class NotificationManagerService extends INotificationManager.Stub } } - + public void cancelNotification(String pkg, int id) { cancelNotificationWithTag(pkg, null /* tag */, id); } @@ -942,7 +937,7 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub throw new SecurityException("Unknown package " + pkg); } } - + void cancelAll() { synchronized (mNotificationList) { final int N = mNotificationList.size(); @@ -1103,14 +1098,14 @@ class NotificationManagerService extends INotificationManager.Stub 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 @@ class NotificationManagerService extends INotificationManager.Stub + ", uid=" + Binder.getCallingUid()); return; } - + pw.println("Current Notification Manager state:"); int N; @@ -1152,7 +1147,7 @@ class NotificationManagerService extends INotificationManager.Stub } pw.println(" "); } - + } synchronized (mNotificationList) { @@ -1164,7 +1159,7 @@ class NotificationManagerService extends INotificationManager.Stub } pw.println(" "); } - + N = mLights.size(); if (N > 0) { pw.println(" Lights List:"); @@ -1173,7 +1168,7 @@ class NotificationManagerService extends INotificationManager.Stub } 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 93821464c243..3320a53b71c9 100644 --- a/services/java/com/android/server/PackageManagerService.java +++ b/services/java/com/android/server/PackageManagerService.java @@ -135,12 +135,6 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { // 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 @@ class PackageManagerService extends IPackageManager.Stub { // 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { // etc/permissions.xml file. final SparseArray> mSystemPermissions = new SparseArray>(); - + // These are the built-in shared libraries that were read from the // etc/permissions.xml file. final HashMap mSharedLibraries = new HashMap(); - + // 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 mAvailableFeatures = new HashMap(); - + // All available activities, for your resolving pleasure. final ActivityIntentResolver mActivities = new ActivityIntentResolver(); @@ -266,7 +260,7 @@ class PackageManagerService extends IPackageManager.Stub { // Broadcast actions that are only available to the system. final HashSet mProtectedBroadcasts = new HashSet(); - + boolean mSystemReady; boolean mSafeMode; boolean mHasSystemUidErrors; @@ -344,7 +338,7 @@ class PackageManagerService extends IPackageManager.Stub { count++; i++; } - + String[] res = new String[count]; i=0; count = 0; @@ -358,15 +352,15 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 libFiles = new HashSet(); - + 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 @@ class PackageManagerService extends IPackageManager.Stub { } else { Log.w(TAG, "No BOOTCLASSPATH found!"); } - + /** * Also ensure all external libraries have had dexopt run on them. */ @@ -500,11 +494,11 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + // 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 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + 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 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + mFrameworkInstallObserver = new AppDirObserver( mFrameworkDir.getPath(), OBSERVER_EVENTS, true); mFrameworkInstallObserver.startWatching(); @@ -581,8 +575,8 @@ class PackageManagerService extends IPackageManager.Stub { } //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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 it = mSharedLibraries.keySet().iterator(); @@ -691,7 +685,7 @@ class PackageManagerService extends IPackageManager.Stub { sb.append(mSharedLibraries.get(name)); } Log.i(TAG, sb.toString()); - + sb.setLength(0); sb.append("Features:"); it = mAvailableFeatures.keySet().iterator(); @@ -701,8 +695,8 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { } XmlUtils.skipCurrentTag(parser); continue; - + } else if ("feature".equals(name)) { String fname = parser.getAttributeValue(null, "name"); if (fname == null) { @@ -808,7 +802,7 @@ class PackageManagerService extends IPackageManager.Stub { } XmlUtils.skipCurrentTag(parser); continue; - + } else { XmlUtils.skipCurrentTag(parser); continue; @@ -967,14 +961,14 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + 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 @@ class PackageManagerService extends IPackageManager.Stub { return out; } } - + private ApplicationInfo generateApplicationInfoFromSettingsLP(String packageName, int flags) { PackageSetting ps = mSettings.mPackages.get(packageName); if(ps != null) { @@ -1008,7 +1002,7 @@ class PackageManagerService extends IPackageManager.Stub { } return null; } - + private PackageInfo generatePackageInfoFromSettingsLP(String packageName, int flags) { PackageSetting ps = mSettings.mPackages.get(packageName); if(ps != null) { @@ -1020,7 +1014,7 @@ class PackageManagerService extends IPackageManager.Stub { } return null; } - + public ApplicationInfo getApplicationInfo(String packageName, int flags) { synchronized (mPackages) { PackageParser.Package p = mPackages.get(packageName); @@ -1040,8 +1034,8 @@ class PackageManagerService extends IPackageManager.Stub { } return null; } - - + + public void freeStorageAndNotify(final long freeStorageSize, final IPackageDataObserver observer) { mContext.enforceCallingOrSelfPermission( android.Manifest.permission.CLEAR_APP_CACHE, null); @@ -1094,7 +1088,7 @@ class PackageManagerService extends IPackageManager.Stub { } }); } - + public ActivityInfo getActivityInfo(ComponentName component, int flags) { synchronized (mPackages) { PackageParser.Activity a = mActivities.mActivities.get(component); @@ -1133,7 +1127,7 @@ class PackageManagerService extends IPackageManager.Stub { } return null; } - + public String[] getSystemSharedLibraryNames() { Set libSet; synchronized (mPackages) { @@ -1171,7 +1165,7 @@ class PackageManagerService extends IPackageManager.Stub { return mAvailableFeatures.containsKey(name); } } - + public int checkPermission(String permName, String pkgName) { synchronized (mPackages) { PackageParser.Package p = mPackages.get(pkgName); @@ -1290,7 +1284,7 @@ class PackageManagerService extends IPackageManager.Stub { return mProtectedBroadcasts.contains(actionName); } } - + public int checkSignatures(String pkg1, String pkg2) { synchronized (mPackages) { PackageParser.Package p1 = mPackages.get(pkg1); @@ -1395,7 +1389,7 @@ class PackageManagerService extends IPackageManager.Stub { } return null; } - + public int getUidForSharedUser(String sharedUserName) { if(sharedUserName == null) { return -1; @@ -1721,7 +1715,7 @@ class PackageManagerService extends IPackageManager.Stub { } return list; } - + synchronized (mPackages) { String pkgName = intent.getPackage(); if (pkgName == null) { @@ -1779,7 +1773,7 @@ class PackageManagerService extends IPackageManager.Stub { return null; } } - + public List getInstalledPackages(int flags) { ArrayList finalList = new ArrayList(); @@ -2001,7 +1995,7 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { } return true; } - + public boolean performDexOpt(String packageName) { if (!mNoDexOpt) { return false; } - + PackageParser.Package p; synchronized (mPackages) { p = mPackages.get(packageName); @@ -2123,11 +2117,11 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { System.arraycopy(mTmpSharedLibraries, 0, pkg.usesLibraryFiles, 0, num); } - + if (pkg.reqFeatures != null) { N = pkg.reqFeatures.size(); for (int i=0; i grantedPermissions = new HashSet(); int[] gids; - + HashSet loadedPermissions = new HashSet(); - + GrantedPermissions(int pkgFlags) { this.pkgFlags = pkgFlags & ApplicationInfo.FLAG_SYSTEM; } } - + /** * Settings base class for pending and resolved classes. */ @@ -5856,14 +5850,14 @@ class PackageManagerService extends IPackageManager.Stub { PackageSignatures signatures = new PackageSignatures(); boolean permissionsFixed; - + /* Explicitly disabled components */ HashSet disabledComponents = new HashSet(0); /* Explicitly enabled components */ HashSet enabledComponents = new HashSet(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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { timeStamp = newStamp; timeStampString = newStampStr; } - + public long getTimeStamp() { return timeStamp; } - + public String getTimeStampStr() { return timeStampString; } @@ -5918,7 +5912,7 @@ class PackageManagerService extends IPackageManager.Stub { grantedPermissions = base.grantedPermissions; gids = base.gids; loadedPermissions = base.loadedPermissions; - + timeStamp = base.timeStamp; timeStampString = base.timeStampString; signatures = base.signatures; @@ -5967,7 +5961,7 @@ class PackageManagerService extends IPackageManager.Stub { int pVersionCode, int pkgFlags) { super(name, codePath, resourcePath, pVersionCode, pkgFlags); } - + @Override public String toString() { return "PackageSetting{" @@ -5989,7 +5983,7 @@ class PackageManagerService extends IPackageManager.Stub { super(_pkgFlags); name = _name; } - + @Override public String toString() { return "SharedUserSetting{" @@ -6009,7 +6003,7 @@ class PackageManagerService extends IPackageManager.Stub { // List of replaced system applications final HashMap mDisabledSysPackages = new HashMap(); - + // The user's preferred activities associated with particular intent // filters. private final IntentResolver mPreferredActivities = @@ -6084,7 +6078,7 @@ class PackageManagerService extends IPackageManager.Stub { resourcePath, pkg.mVersionCode, pkgFlags, create, add); return p; } - + PackageSetting peekPackageLP(String name) { return mPackages.get(name); /* @@ -6095,7 +6089,7 @@ class PackageManagerService extends IPackageManager.Stub { return null; */ } - + void setInstallStatus(String pkgName, int status) { PackageSetting p = mPackages.get(pkgName); if(p != null) { @@ -6104,7 +6098,7 @@ class PackageManagerService extends IPackageManager.Stub { } } } - + void setInstallerPackageName(String pkgName, String installerPkgName) { PackageSetting p = mPackages.get(pkgName); @@ -6112,17 +6106,17 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { } return removePackageLP(name); } - + PackageSetting enableSystemPackageLP(String name) { PackageSetting p = mDisabledSysPackages.get(name); if(p == null) { @@ -6182,7 +6176,7 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { mOtherUserIds.remove(uid); } } - + void writeLP() { //Debug.startMethodTracing("/data/system/packageprof", 8 * 1024 * 1024); @@ -6528,7 +6522,7 @@ class PackageManagerService extends IPackageManager.Stub { for (PackageSetting pkg : mPackages.values()) { writePackage(serializer, pkg); } - + for (PackageSetting pkg : mDisabledSysPackages.values()) { writeDisabledSysPackage(serializer, pkg); } @@ -6587,8 +6581,8 @@ class PackageManagerService extends IPackageManager.Stub { } //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 @@ class PackageManagerService extends IPackageManager.Stub { 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 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { } return ret; } - + boolean readLP() { FileInputStream str = null; if (mBackupSettingsFilename.exists()) { @@ -6938,7 +6932,7 @@ class PackageManagerService extends IPackageManager.Stub { XmlUtils.skipCurrentTag(parser); } } - + private void readDisabledSysPackageLP(XmlPullParser parser) throws XmlPullParserException, IOException { String name = parser.getAttributeValue(null, "name"); @@ -6955,11 +6949,11 @@ class PackageManagerService extends IPackageManager.Stub { } 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 @@ class PackageManagerService extends IPackageManager.Stub { } mDisabledSysPackages.put(name, ps); } - + private void readPackageLP(XmlPullParser parser) throws XmlPullParserException, IOException { String name = null; @@ -7060,7 +7054,7 @@ class PackageManagerService extends IPackageManager.Stub { "Error in package manager settings: 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 @@ class PackageManagerService extends IPackageManager.Stub { packageSetting.installStatus = PKG_INSTALL_COMPLETE; } } - + int outerDepth = parser.getDepth(); int type; while ((type=parser.next()) != XmlPullParser.END_DOCUMENT @@ -7373,7 +7367,7 @@ class PackageManagerService extends IPackageManager.Stub { 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 6e769c76d32b..e11c312098d2 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -133,7 +133,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub // assume nothing is on yet mUserState = mPowerState = 0; - + // Add ourself to the Watchdog monitors. Watchdog.getInstance().addMonitor(this); } @@ -447,7 +440,7 @@ class PowerManagerService extends IPowerManager.Stub } }; mHandlerThread.start(); - + synchronized (mHandlerThread) { while (!mInitComplete) { try { @@ -458,7 +451,7 @@ class PowerManagerService extends IPowerManager.Stub } } } - + void initInThread() { mHandler = new Handler(); @@ -686,7 +679,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub if (wl == null) { return; } - + if (mSpew) { Log.d(TAG, "releaseWakeLock flags=0x" + Integer.toHexString(wl.flags) + " tag=" + wl.tag); @@ -748,7 +741,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub // 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 @@ class PowerManagerService extends IPowerManager.Stub } if (value == 1) { mScreenOnStart = SystemClock.uptimeMillis(); - + policy.screenTurnedOn(); try { ActivityManagerNative.getDefault().wakingUp(); @@ -1157,7 +1150,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub } else if (value == 0) { mScreenOffStart = SystemClock.uptimeMillis(); - + policy.screenTurnedOff(why); try { ActivityManagerNative.getDefault().goingToSleep(); @@ -1178,7 +1171,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub } } } - + 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub animating = true; return true; } - + boolean stepLocked() { if (!animating) return false; if (false && mSpew) { @@ -1814,7 +1807,7 @@ class PowerManagerService extends IPowerManager.Stub return more; } } - + private class LightAnimator implements Runnable { public void run() { synchronized (mLocks) { @@ -1832,7 +1825,7 @@ class PowerManagerService extends IPowerManager.Stub } } } - + private int getPreferredBrightness() { try { if (mScreenBrightnessOverride >= 0) { @@ -1992,7 +1985,7 @@ class PowerManagerService extends IPowerManager.Stub } finally { Binder.restoreCallingIdentity(ident); } - + mWakeLockState = mLocks.reactivateScreenLocksLocked(); setPowerState(mUserState | mWakeLockState, noChangeLights, WindowManagerPolicy.OFF_BECAUSE_OF_USER); @@ -2129,7 +2122,7 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub 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 @@ class PowerManagerService extends IPowerManager.Stub return SystemClock.elapsedRealtime() - mScreenOffTime; } } - + public void setKeyboardVisibility(boolean visible) { synchronized (mLocks) { if (mSpew) { @@ -2345,7 +2338,7 @@ class PowerManagerService extends IPowerManager.Stub } return result; } - + int reactivateScreenLocksLocked() { int result = 0; @@ -2378,7 +2371,7 @@ class PowerManagerService extends IPowerManager.Stub } 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 a0a9a936f4d1..73f930d8b647 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -70,7 +70,7 @@ class ServerThread extends Thread { @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 @@ class ServerThread extends Thread { } catch (RemoteException e) { } } - + // It is now time to start up the app processes... if (notification != null) { @@ -411,7 +411,7 @@ class ServerThread extends Thread { 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 @@ class ServerThread extends Thread { .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 @@ class ServerThread extends Thread { // 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 68bf4fbb0653..2ff9100be3ce 100644 --- a/services/java/com/android/server/Watchdog.java +++ b/services/java/com/android/server/Watchdog.java @@ -52,16 +52,6 @@ public class Watchdog extends Thread { 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 @@ public class Watchdog extends Thread { } 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 @@ public class Watchdog extends Thread { 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 @@ public class Watchdog extends Thread { } 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 @@ public class Watchdog extends Thread { 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 @@ public class Watchdog extends Thread { 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= (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 @@ public class Watchdog extends Thread { 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 @@ public class Watchdog extends Thread { // 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 05d340e83122..df011a215b3b 100644 --- a/services/java/com/android/server/WindowManagerService.java +++ b/services/java/com/android/server/WindowManagerService.java @@ -152,8 +152,6 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub * 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 @@ public class WindowManagerService extends IWindowManager.Stub final ArrayList mInputMethodDialogs = new ArrayList(); final ArrayList mWallpaperTokens = new ArrayList(); - + // If non-null, this is the currently visible window that is associated // with the wallpaper. WindowState mWallpaperTarget = null; @@ -447,7 +445,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub if (MEASURE_LATENCY) { lt = new LatencyTimer(100, 1000); } - + mContext = context; mHaveInputMethods = haveInputMethods; mLimitedAlphaCompositing = context.getResources().getBoolean( @@ -728,7 +726,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub || 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub + "=" + oldW + "; new#" + foundI + "=" + foundW); } - + // Set the new target correctly. if (foundW.mAppToken != null && foundW.mAppToken.hiddenRequested) { if (DEBUG_WALLPAPER) { @@ -1375,7 +1373,7 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + } else if (mLowerWallpaperTarget != null) { // Is it time to stop animating? boolean lowerAnimating = mLowerWallpaperTarget.mAnimation != null @@ -1416,25 +1414,25 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub // 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 @@ public class WindowManagerService extends IWindowManager.Stub mLastWallpaperYStep = mWallpaperTarget.mWallpaperYStep; } } - + // Start stepping backwards from here, ensuring that our wallpaper windows // are correctly placed. int curTokenIndex = mWallpaperTokens.size(); @@ -1491,16 +1489,16 @@ public class WindowManagerService extends IWindowManager.Stub // 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 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub ? (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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub wallpaperWin.mWallpaperYStep = wpys; rawChanged = true; } - + if (rawChanged) { try { if (DEBUG_WALLPAPER) Log.v(TAG, "Report new wp offset " @@ -1644,10 +1642,10 @@ public class WindowManagerService extends IWindowManager.Stub } catch (RemoteException e) { } } - + return changed; } - + void wallpaperOffsetsComplete(IBinder window) { synchronized (mWindowMap) { if (mWaitingOnWallpaper != null && @@ -1657,13 +1655,13 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub mLastWallpaperY = changingTarget.mWallpaperY; } } - + int curTokenIndex = mWallpaperTokens.size(); while (curTokenIndex > 0) { curTokenIndex--; @@ -1694,15 +1692,15 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub // correct size. mLayoutNeeded = true; } - + int curWallpaperIndex = token.windows.size(); while (curWallpaperIndex > 0) { curWallpaperIndex--; @@ -1721,7 +1719,7 @@ public class WindowManagerService extends IWindowManager.Stub if (visible) { updateWallpaperOffsetLocked(wallpaper, dw, dh, false); } - + if (wallpaper.mWallpaperVisible != visible) { wallpaper.mWallpaperVisible = visible; try { @@ -1735,7 +1733,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + void sendPointerToWallpaperLocked(WindowState srcWin, MotionEvent pointer, long eventTime) { int curTokenIndex = mWallpaperTokens.size(); @@ -1773,7 +1771,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + public int addWindow(Session session, IWindow client, WindowManager.LayoutParams attrs, int viewVisibility, Rect outContentInsets) { @@ -2080,7 +2078,7 @@ public class WindowManagerService extends IWindowManager.Stub e.fillInStackTrace(); Log.w(TAG, "Removing window " + win, e); } - + mPolicy.removeWindowLw(win); win.removeLocked(); @@ -2137,7 +2135,7 @@ public class WindowManagerService extends IWindowManager.Stub } else if ((win.mAttrs.flags&FLAG_SHOW_WALLPAPER) != 0) { adjustWallpaperWindowsLocked(); } - + if (!mInLayout) { assignLayersLocked(); mLayoutNeeded = true; @@ -2217,7 +2215,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + void wallpaperCommandComplete(IBinder window, Bundle result) { synchronized (mWindowMap) { if (mWaitingOnWallpaper != null && @@ -2227,7 +2225,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + if (win.mSurface == null || (win.getAttrs().flags & WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING) == 0 || win.mSurfacePendingDestroy) { @@ -3014,7 +3012,7 @@ public class WindowManagerService extends IWindowManager.Stub "updateOrientationFromAppTokens()")) { throw new SecurityException("Requires MANAGE_APP_TOKENS permission"); } - + Configuration config; long ident = Binder.clearCallingIdentity(); config = updateOrientationFromAppTokensUnchecked(currentConfig, @@ -3207,7 +3205,7 @@ public class WindowManagerService extends IWindowManager.Stub mNextAppTransitionExit = exitAnim; } } - + public void executeAppTransition() { if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS, "executeAppTransition()")) { @@ -3375,7 +3373,7 @@ public class WindowManagerService extends IWindowManager.Stub return; } } - + mStartingIconInTransition = true; wtoken.startingData = new StartingData( pkg, theme, nonLocalizedLabel, @@ -3543,14 +3541,14 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } } 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) { moveAppWindowsLocked(tokens, mAppTokens.size()); } @@ -4041,7 +4039,7 @@ public class WindowManagerService extends IWindowManager.Stub pos++; } } - + if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET) { moveAppWindowsLocked(tokens, 0); } @@ -4126,7 +4124,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + static float fixScale(float scale) { if (scale < 0) scale = 0; else if (scale > 20) scale = 20; @@ -4745,7 +4743,7 @@ public class WindowManagerService extends IWindowManager.Stub orientation = Configuration.ORIENTATION_LANDSCAPE; } config.orientation = orientation; - + DisplayMetrics dm = new DisplayMetrics(); mDisplay.getMetrics(dm); CompatibilityInfo.updateCompatibleScreenFrame(dm, orientation, mCompatibleScreenFrame); @@ -4780,7 +4778,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } } config.screenLayout = mScreenLayout; - + config.keyboardHidden = Configuration.KEYBOARDHIDDEN_NO; config.hardKeyboardHidden = Configuration.HARDKEYBOARDHIDDEN_NO; mPolicy.adjustConfigurationLw(config); @@ -4879,7 +4877,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub return INJECT_NO_PERMISSION; } } - + if (MEASURE_LATENCY) { lt.sample("4 in dispatchPointer ", System.nanoTime() - eventTimeNano); } @@ -5054,7 +5052,7 @@ public class WindowManagerService extends IWindowManager.Stub ev.recycle(); return INJECT_SUCCEEDED; } - + if (qev != null && action == MotionEvent.ACTION_MOVE) { mKeyWaiter.bindTargetWindowLocked(target, KeyWaiter.RETURN_PENDING_POINTER, qev); @@ -5079,13 +5077,13 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub if (event.getRepeatCount() > 0 && mQueue.hasKeyUpEvent(event)) { return INJECT_SUCCEEDED; } - + WindowState focus = (WindowState)focusObj; if (DEBUG_INPUT) Log.v( @@ -5704,7 +5702,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + return res; } @@ -6703,11 +6701,11 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub // 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 @@ public class WindowManagerService extends IWindowManager.Stub // 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub WindowState c = (WindowState)mChildWindows.get(i); c.mAttachedHidden = true; } - + if (mReportDestroySurface) { mReportDestroySurface = false; mSurfacePendingDestroy = true; @@ -7345,7 +7343,7 @@ public class WindowManagerService extends IWindowManager.Stub } catch (RemoteException e) { } } - + try { if (DEBUG_VISIBILITY) { RuntimeException e = new RuntimeException(); @@ -7365,7 +7363,7 @@ public class WindowManagerService extends IWindowManager.Stub + " surface " + mSurface + " session " + mSession + ": " + e.toString()); } - + mSurface = null; } } @@ -7443,7 +7441,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + if (selfTransformation || attachedTransformation != null || appTransformation != null) { // cache often used attributes locally @@ -8191,19 +8189,19 @@ public class WindowManagerService extends IWindowManager.Stub // 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 @@ public class WindowManagerService extends IWindowManager.Stub } return null; } - + void dump(PrintWriter pw, String prefix) { super.dump(pw, prefix); if (appToken != null) { @@ -9050,7 +9048,7 @@ public class WindowManagerService extends IWindowManager.Stub int i; int lastWallpaper = -1; int numRemoved = 0; - + // First remove all existing app windows. i=0; while (i < NW) { @@ -9068,12 +9066,12 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub for (int j=0; j=0; i--) { WindowState w = (WindowState)mWindows.get(i); @@ -9373,7 +9371,7 @@ public class WindowManagerService extends IWindowManager.Stub wallpaperMayChange = true; } } - + boolean wasAnimating = w.mAnimating; if (w.stepAnimationLocked(currentTime, dw, dh)) { animating = true; @@ -9382,7 +9380,7 @@ public class WindowManagerService extends IWindowManager.Stub if (wasAnimating && !w.mAnimating && mWallpaperTarget == w) { wallpaperMayChange = true; } - + if (mPolicy.doesForceHide(w, attrs)) { if (!wasAnimating && animating) { wallpaperForceHidingChanged = true; @@ -9413,7 +9411,7 @@ public class WindowManagerService extends IWindowManager.Stub wallpaperMayChange = true; } } - + mPolicy.animatingWindowLw(w, attrs); } @@ -9562,18 +9560,18 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + if (foundWallpapers == 3) { if (DEBUG_APP_TRANSITIONS) Log.v(TAG, "Wallpaper animation!"); @@ -9655,7 +9653,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub mLastEnterAnimToken = null; mLastEnterAnimParams = null; } - + NN = mOpeningApps.size(); for (i=0; i=0; i--) { WindowState w = (WindowState)mWindows.get(i); @@ -10067,7 +10065,7 @@ public class WindowManagerService extends IWindowManager.Stub } final boolean obscuredChanged = w.mObscured != obscured; - + // Update effect. if (!(w.mObscured=obscured)) { if (w.mSurface != null) { @@ -10172,7 +10170,7 @@ public class WindowManagerService extends IWindowManager.Stub } } } - + 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 @@ public class WindowManagerService extends IWindowManager.Stub updateWallpaperVisibilityLocked(); } } - + if (backgroundFillerShown == false && mBackgroundFillerShown) { mBackgroundFillerShown = false; if (SHOW_TRANSACTIONS) Log.d(TAG, "hiding background filler"); @@ -10295,7 +10293,7 @@ public class WindowManagerService extends IWindowManager.Stub } 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 @@ public class WindowManagerService extends IWindowManager.Stub // Clear information about apps that were moving. mToBottomApps.clear(); } - + if (focusDisplayed) { mH.sendEmptyMessage(H.REPORT_LOSING_FOCUS); } @@ -10339,7 +10337,7 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub 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 @@ public class WindowManagerService extends IWindowManager.Stub mDimDeltaPerMs = (-mDimCurrentAlpha) / DEFAULT_DIM_DURATION; } } - + boolean animating = false; if (mLastDimAnimTime != 0) { mDimCurrentAlpha += mDimDeltaPerMs -- cgit v1.2.3-59-g8ed1b