Merge "Introduce TRACE_TAG_APEX_MANAGER and add timing to getActiveApexInfos"
This commit is contained in:
committed by
Android (Google) Code Review
commit
35bbc9d4ba
@@ -101,6 +101,8 @@ public final class Trace {
|
||||
public static final long TRACE_TAG_NNAPI = 1L << 25;
|
||||
/** @hide */
|
||||
public static final long TRACE_TAG_RRO = 1L << 26;
|
||||
/** @hide */
|
||||
public static final long TRACE_TAG_APEX_MANAGER = 1L << 18;
|
||||
|
||||
private static final long TRACE_TAG_NOT_READY = 1L << 63;
|
||||
private static final int MAX_SECTION_NAME_LEN = 127;
|
||||
|
||||
@@ -36,6 +36,7 @@ import android.content.pm.parsing.AndroidPackage;
|
||||
import android.os.Environment;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.Trace;
|
||||
import android.sysprop.ApexProperties;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
@@ -46,6 +47,7 @@ import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.os.BackgroundThread;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.server.utils.TimingsTraceAndSlog;
|
||||
|
||||
import com.google.android.collect.Lists;
|
||||
|
||||
@@ -375,8 +377,11 @@ public abstract class ApexManager {
|
||||
|
||||
@Override
|
||||
public List<ActiveApexInfo> getActiveApexInfos() {
|
||||
final TimingsTraceAndSlog t = new TimingsTraceAndSlog(TAG + "Timing",
|
||||
Trace.TRACE_TAG_APEX_MANAGER);
|
||||
synchronized (mLock) {
|
||||
if (mActiveApexInfosCache == null) {
|
||||
t.traceBegin("getActiveApexInfos_noCache");
|
||||
try {
|
||||
mActiveApexInfosCache = new ArraySet<>();
|
||||
final ApexInfo[] activePackages = mApexService.getActivePackages();
|
||||
@@ -387,6 +392,7 @@ public abstract class ApexManager {
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "Unable to retrieve packages from apexservice", e);
|
||||
}
|
||||
t.traceEnd();
|
||||
}
|
||||
if (mActiveApexInfosCache != null) {
|
||||
return new ArrayList<>(mActiveApexInfosCache);
|
||||
|
||||
Reference in New Issue
Block a user