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

Commit 31d9989e authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android (Google) Code Review
Browse files

Merge "Add app version codes to procstats."

parents bb615a6f 8472e618
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -338,7 +338,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     * the normal application lifecycle.
     *
     * <p>Comes from the
     * {@link android.R.styleable#AndroidManifestApplication_cantSaveState android:cantSaveState}
     * android.R.styleable#AndroidManifestApplication_cantSaveState
     * attribute of the &lt;application&gt; tag.
     *
     * {@hide}
@@ -457,6 +457,12 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public int targetSdkVersion;

    /**
     * The app's declared version code.
     * @hide
     */
    public int versionCode;

    /**
     * When false, indicates that all components within this application are
     * considered disabled, regardless of their individually set enabled status.
@@ -508,7 +514,8 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        if (sharedLibraryFiles != null) {
            pw.println(prefix + "sharedLibraryFiles=" + sharedLibraryFiles);
        }
        pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion);
        pw.println(prefix + "enabled=" + enabled + " targetSdkVersion=" + targetSdkVersion
                + " versionCode=" + versionCode);
        if (manageSpaceActivityName != null) {
            pw.println(prefix + "manageSpaceActivityName="+manageSpaceActivityName);
        }
@@ -576,6 +583,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dataDir = orig.dataDir;
        uid = orig.uid;
        targetSdkVersion = orig.targetSdkVersion;
        versionCode = orig.versionCode;
        enabled = orig.enabled;
        enabledSetting = orig.enabledSetting;
        installLocation = orig.installLocation;
@@ -616,6 +624,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dest.writeString(dataDir);
        dest.writeInt(uid);
        dest.writeInt(targetSdkVersion);
        dest.writeInt(versionCode);
        dest.writeInt(enabled ? 1 : 0);
        dest.writeInt(enabledSetting);
        dest.writeInt(installLocation);
@@ -655,6 +664,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
        dataDir = source.readString();
        uid = source.readInt();
        targetSdkVersion = source.readInt();
        versionCode = source.readInt();
        enabled = source.readInt() != 0;
        enabledSetting = source.readInt();
        installLocation = source.readInt();
+1 −1
Original line number Diff line number Diff line
@@ -980,7 +980,7 @@ public class PackageParser {
        
        TypedArray sa = res.obtainAttributes(attrs,
                com.android.internal.R.styleable.AndroidManifest);
        pkg.mVersionCode = sa.getInteger(
        pkg.mVersionCode = pkg.applicationInfo.versionCode = sa.getInteger(
                com.android.internal.R.styleable.AndroidManifest_versionCode, 0);
        pkg.mVersionName = sa.getNonConfigurationString(
                com.android.internal.R.styleable.AndroidManifest_versionName, 0);
+486 −358

File changed.

Preview size limit exceeded, changes collapsed.

+5 −4
Original line number Diff line number Diff line
@@ -392,14 +392,15 @@ final class ProcessRecord {
                origBase.makeInactive();
            }
            baseProcessTracker = tracker.getProcessStateLocked(info.packageName, info.uid,
                    processName);
                    info.versionCode, processName);
            baseProcessTracker.makeActive();
            for (int i=0; i<pkgList.size(); i++) {
                ProcessStats.ProcessState ps = pkgList.valueAt(i);
                if (ps != null && ps != origBase) {
                    ps.makeInactive();
                }
                ps = tracker.getProcessStateLocked(pkgList.keyAt(i), info.uid, processName);
                ps = tracker.getProcessStateLocked(pkgList.keyAt(i), info.uid,
                        info.versionCode, processName);
                if (ps != baseProcessTracker) {
                    ps.makeActive();
                }
@@ -572,7 +573,7 @@ final class ProcessRecord {
        if (!pkgList.containsKey(pkg)) {
            if (baseProcessTracker != null) {
                ProcessStats.ProcessState state = tracker.getProcessStateLocked(
                        pkg, info.uid, processName);
                        pkg, info.uid, info.versionCode, processName);
                pkgList.put(pkg, state);
                if (state != baseProcessTracker) {
                    state.makeActive();
@@ -619,7 +620,7 @@ final class ProcessRecord {
                }
                pkgList.clear();
                ProcessStats.ProcessState ps = tracker.getProcessStateLocked(
                        info.packageName, info.uid, processName);
                        info.packageName, info.uid, info.versionCode, processName);
                pkgList.put(info.packageName, ps);
                if (ps != baseProcessTracker) {
                    ps.makeActive();
+45 −33
Original line number Diff line number Diff line
@@ -108,13 +108,14 @@ public final class ProcessStatsService extends IProcessStats.Stub {
    }

    public ProcessStats.ProcessState getProcessStateLocked(String packageName,
            int uid, String processName) {
        return mProcessStats.getProcessStateLocked(packageName, uid, processName);
            int uid, int versionCode, String processName) {
        return mProcessStats.getProcessStateLocked(packageName, uid, versionCode, processName);
    }

    public ProcessStats.ServiceState getServiceStateLocked(String packageName, int uid,
            String processName, String className) {
        return mProcessStats.getServiceStateLocked(packageName, uid, processName, className);
            int versionCode, String processName, String className) {
        return mProcessStats.getServiceStateLocked(packageName, uid, versionCode, processName,
                className);
    }

    public boolean isMemFactorLowered() {
@@ -134,15 +135,17 @@ public final class ProcessStatsService extends IProcessStats.Stub {
            }
            mProcessStats.mMemFactor = memFactor;
            mProcessStats.mStartTime = now;
            ArrayMap<String, SparseArray<ProcessStats.PackageState>> pmap
            final ArrayMap<String, SparseArray<SparseArray<ProcessStats.PackageState>>> pmap
                    = mProcessStats.mPackages.getMap();
            for (int i=0; i<pmap.size(); i++) {
                SparseArray<ProcessStats.PackageState> uids = pmap.valueAt(i);
                for (int j=0; j<uids.size(); j++) {
                    ProcessStats.PackageState pkg = uids.valueAt(j);
                    ArrayMap<String, ProcessStats.ServiceState> services = pkg.mServices;
                    for (int k=0; k<services.size(); k++) {
                        ProcessStats.ServiceState service = services.valueAt(k);
            for (int ipkg=pmap.size()-1; ipkg>=0; ipkg--) {
                final SparseArray<SparseArray<ProcessStats.PackageState>> uids = pmap.valueAt(ipkg);
                for (int iuid=uids.size()-1; iuid>=0; iuid--) {
                    final SparseArray<ProcessStats.PackageState> vers = uids.valueAt(iuid);
                    for (int iver=vers.size()-1; iver>=0; iver--) {
                        final ProcessStats.PackageState pkg = vers.valueAt(iver);
                        final ArrayMap<String, ProcessStats.ServiceState> services = pkg.mServices;
                        for (int isvc=services.size()-1; isvc>=0; isvc--) {
                            final ProcessStats.ServiceState service = services.valueAt(isvc);
                            if (service.isInUse()) {
                                if (service.mStartedState != ProcessStats.STATE_NOTHING) {
                                    service.setStarted(true, memFactor, now);
@@ -154,6 +157,8 @@ public final class ProcessStatsService extends IProcessStats.Stub {
                                    service.setExecuting(true, memFactor, now);
                                }
                            }

                        }
                    }
                }
            }
@@ -291,16 +296,21 @@ public final class ProcessStatsService extends IProcessStats.Stub {
                            Slog.w(TAG, "  Uid " + uids.keyAt(iu) + ": " + uids.valueAt(iu));
                        }
                    }
                    ArrayMap<String, SparseArray<ProcessStats.PackageState>> pkgMap
                    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<ProcessStats.PackageState> uids = pkgMap.valueAt(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));
                            ProcessStats.PackageState pkgState = uids.valueAt(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)
@@ -310,6 +320,8 @@ public final class ProcessStatsService extends IProcessStats.Stub {
                                for (int isvc=0; isvc<NSRVS; isvc++) {
                                    Slog.w(TAG, "      Service " + pkgState.mServices.keyAt(isvc)
                                            + ": " + pkgState.mServices.valueAt(isvc));

                                }
                            }
                        }
                    }
Loading