use of com.android.internal.app.procstats.ProcessState in project android_frameworks_base by crdroidandroid.
the class ProcessRecord method resetPackageList.
/*
* Delete all packages from list except the package indicated in info
*/
public void resetPackageList(ProcessStatsService tracker) {
final int N = pkgList.size();
if (baseProcessTracker != null) {
long now = SystemClock.uptimeMillis();
baseProcessTracker.setState(ProcessStats.STATE_NOTHING, tracker.getMemFactorLocked(), now, pkgList);
if (N != 1) {
for (int i = 0; i < N; i++) {
ProcessStats.ProcessStateHolder holder = pkgList.valueAt(i);
if (holder.state != null && holder.state != baseProcessTracker) {
holder.state.makeInactive();
}
}
pkgList.clear();
ProcessState ps = tracker.getProcessStateLocked(info.packageName, uid, info.versionCode, processName);
ProcessStats.ProcessStateHolder holder = new ProcessStats.ProcessStateHolder(info.versionCode);
holder.state = ps;
pkgList.put(info.packageName, holder);
if (ps != baseProcessTracker) {
ps.makeActive();
}
}
} else if (N != 1) {
pkgList.clear();
pkgList.put(info.packageName, new ProcessStats.ProcessStateHolder(info.versionCode));
}
}
use of com.android.internal.app.procstats.ProcessState in project android_frameworks_base by crdroidandroid.
the class ProcessStatsService method readLocked.
boolean readLocked(ProcessStats stats, AtomicFile file) {
try {
FileInputStream stream = file.openRead();
stats.read(stream);
stream.close();
if (stats.mReadError != null) {
Slog.w(TAG, "Ignoring existing stats; " + stats.mReadError);
if (DEBUG) {
ArrayMap<String, SparseArray<ProcessState>> procMap = stats.mProcesses.getMap();
final int NPROC = procMap.size();
for (int ip = 0; ip < NPROC; ip++) {
Slog.w(TAG, "Process: " + procMap.keyAt(ip));
SparseArray<ProcessState> uids = procMap.valueAt(ip);
final int NUID = uids.size();
for (int iu = 0; iu < NUID; iu++) {
Slog.w(TAG, " Uid " + uids.keyAt(iu) + ": " + uids.valueAt(iu));
}
}
ArrayMap<String, SparseArray<SparseArray<ProcessStats.PackageState>>> pkgMap = stats.mPackages.getMap();
final int NPKG = pkgMap.size();
for (int ip = 0; ip < NPKG; ip++) {
Slog.w(TAG, "Package: " + pkgMap.keyAt(ip));
SparseArray<SparseArray<ProcessStats.PackageState>> uids = pkgMap.valueAt(ip);
final int NUID = uids.size();
for (int iu = 0; iu < NUID; iu++) {
Slog.w(TAG, " Uid: " + uids.keyAt(iu));
SparseArray<ProcessStats.PackageState> vers = uids.valueAt(iu);
final int NVERS = vers.size();
for (int iv = 0; iv < NVERS; iv++) {
Slog.w(TAG, " Vers: " + vers.keyAt(iv));
ProcessStats.PackageState pkgState = vers.valueAt(iv);
final int NPROCS = pkgState.mProcesses.size();
for (int iproc = 0; iproc < NPROCS; iproc++) {
Slog.w(TAG, " Process " + pkgState.mProcesses.keyAt(iproc) + ": " + pkgState.mProcesses.valueAt(iproc));
}
final int NSRVS = pkgState.mServices.size();
for (int isvc = 0; isvc < NSRVS; isvc++) {
Slog.w(TAG, " Service " + pkgState.mServices.keyAt(isvc) + ": " + pkgState.mServices.valueAt(isvc));
}
}
}
}
}
return false;
}
} catch (Throwable e) {
stats.mReadError = "caught exception: " + e;
Slog.e(TAG, "Error reading process statistics", e);
return false;
}
return true;
}
use of com.android.internal.app.procstats.ProcessState in project android_frameworks_base by AOSPA.
the class ProcessRecord method resetPackageList.
/*
* Delete all packages from list except the package indicated in info
*/
public void resetPackageList(ProcessStatsService tracker) {
final int N = pkgList.size();
if (baseProcessTracker != null) {
long now = SystemClock.uptimeMillis();
baseProcessTracker.setState(ProcessStats.STATE_NOTHING, tracker.getMemFactorLocked(), now, pkgList);
if (N != 1) {
for (int i = 0; i < N; i++) {
ProcessStats.ProcessStateHolder holder = pkgList.valueAt(i);
if (holder.state != null && holder.state != baseProcessTracker) {
holder.state.makeInactive();
}
}
pkgList.clear();
ProcessState ps = tracker.getProcessStateLocked(info.packageName, uid, info.versionCode, processName);
ProcessStats.ProcessStateHolder holder = new ProcessStats.ProcessStateHolder(info.versionCode);
holder.state = ps;
pkgList.put(info.packageName, holder);
if (ps != baseProcessTracker) {
ps.makeActive();
}
}
} else if (N != 1) {
pkgList.clear();
pkgList.put(info.packageName, new ProcessStats.ProcessStateHolder(info.versionCode));
}
}
use of com.android.internal.app.procstats.ProcessState in project android_frameworks_base by AOSPA.
the class ProcessRecord method makeActive.
public void makeActive(IApplicationThread _thread, ProcessStatsService tracker) {
String seempStr = "app_uid=" + uid + ",app_pid=" + pid + ",oom_adj=" + curAdj + ",setAdj=" + setAdj + ",hasShownUi=" + (hasShownUi ? 1 : 0) + ",cached=" + (cached ? 1 : 0) + ",fA=" + (foregroundActivities ? 1 : 0) + ",fS=" + (foregroundServices ? 1 : 0) + ",systemNoUi=" + (systemNoUi ? 1 : 0) + ",curSchedGroup=" + curSchedGroup + ",curProcState=" + curProcState + ",setProcState=" + setProcState + ",killed=" + (killed ? 1 : 0) + ",killedByAm=" + (killedByAm ? 1 : 0) + ",debugging=" + (debugging ? 1 : 0);
android.util.SeempLog.record_str(386, seempStr);
if (thread == null) {
final ProcessState origBase = baseProcessTracker;
if (origBase != null) {
origBase.setState(ProcessStats.STATE_NOTHING, tracker.getMemFactorLocked(), SystemClock.uptimeMillis(), pkgList);
origBase.makeInactive();
}
baseProcessTracker = tracker.getProcessStateLocked(info.packageName, uid, info.versionCode, processName);
baseProcessTracker.makeActive();
for (int i = 0; i < pkgList.size(); i++) {
ProcessStats.ProcessStateHolder holder = pkgList.valueAt(i);
if (holder.state != null && holder.state != origBase) {
holder.state.makeInactive();
}
holder.state = tracker.getProcessStateLocked(pkgList.keyAt(i), uid, info.versionCode, processName);
if (holder.state != baseProcessTracker) {
holder.state.makeActive();
}
}
}
thread = _thread;
}
use of com.android.internal.app.procstats.ProcessState in project android_frameworks_base by AOSPA.
the class ProcessRecord method makeInactive.
public void makeInactive(ProcessStatsService tracker) {
String seempStr = "app_uid=" + uid + ",app_pid=" + pid + ",oom_adj=" + curAdj + ",setAdj=" + setAdj + ",hasShownUi=" + (hasShownUi ? 1 : 0) + ",cached=" + (cached ? 1 : 0) + ",fA=" + (foregroundActivities ? 1 : 0) + ",fS=" + (foregroundServices ? 1 : 0) + ",systemNoUi=" + (systemNoUi ? 1 : 0) + ",curSchedGroup=" + curSchedGroup + ",curProcState=" + curProcState + ",setProcState=" + setProcState + ",killed=" + (killed ? 1 : 0) + ",killedByAm=" + (killedByAm ? 1 : 0) + ",debugging=" + (debugging ? 1 : 0);
android.util.SeempLog.record_str(387, seempStr);
thread = null;
final ProcessState origBase = baseProcessTracker;
if (origBase != null) {
origBase.setState(ProcessStats.STATE_NOTHING, tracker.getMemFactorLocked(), SystemClock.uptimeMillis(), pkgList);
origBase.makeInactive();
}
baseProcessTracker = null;
for (int i = 0; i < pkgList.size(); i++) {
ProcessStats.ProcessStateHolder holder = pkgList.valueAt(i);
if (holder.state != null && holder.state != origBase) {
holder.state.makeInactive();
}
holder.state = null;
}
}
Aggregations