Merge change Iab5c49c7 into eclair-mr2
* changes: move event log tags used by system server into this package
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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());
|
||||
|
@ -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() ==
|
||||
|
@ -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);
|
||||
|
139
services/java/com/android/server/EventLogTags.logtags
Normal file
139
services/java/com/android/server/EventLogTags.logtags
Normal file
@ -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)
|
@ -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<InputMethodInfo> 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<IBinder, ClientState> mClients
|
||||
= new HashMap<IBinder, ClientState>();
|
||||
|
||||
|
||||
/**
|
||||
* Set once the system is ready to run third party code.
|
||||
*/
|
||||
boolean mSystemReady;
|
||||
|
||||
|
||||
/**
|
||||
* Id of the currently selected input method.
|
||||
*/
|
||||
String mCurMethodId;
|
||||
|
||||
|
||||
/**
|
||||
* The current binding sequence number, incremented every time there is
|
||||
* a new bind performed.
|
||||
*/
|
||||
int mCurSeq;
|
||||
|
||||
|
||||
/**
|
||||
* The client that is currently bound to an input method.
|
||||
*/
|
||||
ClientState mCurClient;
|
||||
|
||||
|
||||
/**
|
||||
* The last window token that gained focus.
|
||||
*/
|
||||
IBinder mCurFocusedWindow;
|
||||
|
||||
|
||||
/**
|
||||
* The input context last provided by the current client.
|
||||
*/
|
||||
IInputContext mCurInputContext;
|
||||
|
||||
|
||||
/**
|
||||
* The attributes last provided by the current client.
|
||||
*/
|
||||
EditorInfo mCurAttribute;
|
||||
|
||||
|
||||
/**
|
||||
* The input method ID of the input method service that we are currently
|
||||
* connected to or in the process of connecting to.
|
||||
*/
|
||||
String mCurId;
|
||||
|
||||
|
||||
/**
|
||||
* Set to true if our ServiceConnection is currently actively bound to
|
||||
* a service (whether or not we have gotten its IBinder back yet).
|
||||
*/
|
||||
boolean mHaveConnection;
|
||||
|
||||
|
||||
/**
|
||||
* Set if the client has asked for the input method to be shown.
|
||||
*/
|
||||
boolean mShowRequested;
|
||||
|
||||
|
||||
/**
|
||||
* Set if we were explicitly told to show the input method.
|
||||
*/
|
||||
boolean mShowExplicitlyRequested;
|
||||
|
||||
|
||||
/**
|
||||
* Set if we were forced to be shown.
|
||||
*/
|
||||
boolean mShowForced;
|
||||
|
||||
|
||||
/**
|
||||
* Set if we last told the input method to show itself.
|
||||
*/
|
||||
boolean mInputShown;
|
||||
|
||||
|
||||
/**
|
||||
* The Intent used to connect to the current input method.
|
||||
*/
|
||||
Intent mCurIntent;
|
||||
|
||||
|
||||
/**
|
||||
* The token we have made for the currently active input method, to
|
||||
* identify it in the future.
|
||||
*/
|
||||
IBinder mCurToken;
|
||||
|
||||
|
||||
/**
|
||||
* If non-null, this is the input method service we are currently connected
|
||||
* to.
|
||||
*/
|
||||
IInputMethod mCurMethod;
|
||||
|
||||
|
||||
/**
|
||||
* Time that we last initiated a bind to the input method, to determine
|
||||
* if we should try to disconnect and reconnect to it.
|
||||
*/
|
||||
long mLastBindTime;
|
||||
|
||||
|
||||
/**
|
||||
* Have we called mCurMethod.bindInput()?
|
||||
*/
|
||||
boolean mBoundToMethod;
|
||||
|
||||
|
||||
/**
|
||||
* Currently enabled session. Only touched by service thread, not
|
||||
* protected by a lock.
|
||||
*/
|
||||
SessionState mEnabledSession;
|
||||
|
||||
|
||||
/**
|
||||
* True if the screen is on. The value is true initially.
|
||||
*/
|
||||
boolean mScreenOn = true;
|
||||
|
||||
|
||||
AlertDialog.Builder mDialogBuilder;
|
||||
AlertDialog mSwitchingDialog;
|
||||
InputMethodInfo[] mIms;
|
||||
CharSequence[] mItems;
|
||||
|
||||
|
||||
class SettingsObserver extends ContentObserver {
|
||||
SettingsObserver(Handler handler) {
|
||||
super(handler);
|
||||
@ -300,14 +298,14 @@ 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<InputMethodInfo> getInputMethodList() {
|
||||
synchronized (mMethodMap) {
|
||||
return new ArrayList<InputMethodInfo>(mMethodList);
|
||||
@ -523,14 +521,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
List<InputMethodInfo> getEnabledInputMethodListLocked() {
|
||||
final ArrayList<InputMethodInfo> res = new ArrayList<InputMethodInfo>();
|
||||
|
||||
|
||||
final String enabledStr = Settings.Secure.getString(
|
||||
mContext.getContentResolver(),
|
||||
Settings.Secure.ENABLED_INPUT_METHODS);
|
||||
if (enabledStr != null) {
|
||||
final TextUtils.SimpleStringSplitter splitter = mStringColonSplitter;
|
||||
splitter.setString(enabledStr);
|
||||
|
||||
|
||||
while (splitter.hasNext()) {
|
||||
InputMethodInfo info = mMethodMap.get(splitter.next());
|
||||
if (info != null) {
|
||||
@ -538,7 +536,7 @@ 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<String, InputMethodInfo> map) {
|
||||
list.clear();
|
||||
map.clear();
|
||||
|
||||
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
|
||||
List<ResolveInfo> services = pm.queryIntentServices(
|
||||
new Intent(InputMethod.SERVICE_INTERFACE),
|
||||
PackageManager.GET_META_DATA);
|
||||
|
||||
|
||||
for (int i = 0; i < services.size(); ++i) {
|
||||
ResolveInfo ri = services.get(i);
|
||||
ServiceInfo si = ri.serviceInfo;
|
||||
@ -1407,7 +1405,7 @@ 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<InputMethodInfo> 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();
|
||||
|
@ -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<NotificationRecord> mNotificationList =
|
||||
new ArrayList<NotificationRecord>();
|
||||
|
||||
@ -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);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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);
|
||||
|
@ -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!");
|
||||
}
|
||||
|
@ -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<mMemInfoSizes.length; i++) {
|
||||
mMemInfoSizes[i] *= 1024;
|
||||
}
|
||||
EventLog.writeEvent(EVENT_LOG_MEMINFO_TAG,
|
||||
EventLog.writeEvent(EventLogTags.WATCHDOG_MEMINFO,
|
||||
(int)mMemInfoSizes[0], (int)mMemInfoSizes[1], (int)mMemInfoSizes[2],
|
||||
(int)mMemInfoSizes[3], (int)mMemInfoSizes[4],
|
||||
(int)mMemInfoSizes[5], (int)mMemInfoSizes[6], (int)mMemInfoSizes[7],
|
||||
@ -589,7 +579,7 @@ public class Watchdog extends Thread {
|
||||
mVMStatSizes[i] -= mPrevVMStatSizes[i];
|
||||
mPrevVMStatSizes[i] = v;
|
||||
}
|
||||
EventLog.writeEvent(EVENT_LOG_VMSTAT_TAG, dur,
|
||||
EventLog.writeEvent(EventLogTags.WATCHDOG_VMSTAT, dur,
|
||||
(int)mVMStatSizes[0], (int)mVMStatSizes[1], (int)mVMStatSizes[2],
|
||||
(int)mVMStatSizes[3], (int)mVMStatSizes[4]);
|
||||
}
|
||||
@ -635,7 +625,7 @@ public class Watchdog extends Thread {
|
||||
(now-mBootTime) >= (rebootIntervalMillis-rebootWindowMillis)) {
|
||||
if (fromAlarm && rebootWindowMillis <= 0) {
|
||||
// No reboot window -- just immediately reboot.
|
||||
EventLog.writeEvent(EVENT_LOG_SCHEDULED_REBOOT_TAG, now,
|
||||
EventLog.writeEvent(EventLogTags.WATCHDOG_SCHEDULED_REBOOT, now,
|
||||
(int)rebootIntervalMillis, (int)rebootStartTime*1000,
|
||||
(int)rebootWindowMillis, "");
|
||||
rebootSystem("Checkin scheduled forced");
|
||||
@ -649,7 +639,7 @@ 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.
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user