Loading services/core/Android.bp +8 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,7 @@ java_library_static { "aconfig_new_storage_flags_lib", "powerstats_flags_lib", "locksettings_flags_lib", "profiling_flags_lib", ], javac_shard_size: 50, javacflags: [ Loading @@ -255,6 +256,13 @@ java_library_static { "FlaggedApi", ], }, jarjar_rules: ":services-jarjar-rules", apex_available: ["//apex_available:platform"], } filegroup { name: "services-jarjar-rules", srcs: ["services-jarjar-rules.txt"], } java_genrule { Loading services/core/java/com/android/server/am/ActivityManagerService.java +14 −1 Original line number Diff line number Diff line Loading @@ -337,6 +337,8 @@ import android.os.PowerManager; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; import android.os.Process; import android.os.ProfilingServiceHelper; import android.os.ProfilingTrigger; import android.os.RemoteCallback; import android.os.RemoteCallbackList; import android.os.RemoteException; Loading Loading @@ -1089,7 +1091,18 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void onReportFullyDrawn(long id, long timestampNanos) { mProcessList.getAppStartInfoTracker().onActivityReportFullyDrawn(id, timestampNanos); ApplicationStartInfo startInfo = mProcessList.getAppStartInfoTracker() .onActivityReportFullyDrawn(id, timestampNanos); if (android.os.profiling.Flags.systemTriggeredProfilingNew() && startInfo != null && startInfo.getStartType() == ApplicationStartInfo.START_TYPE_COLD && startInfo.getPackageName() != null) { ProfilingServiceHelper.getInstance().onProfilingTriggerOccurred( startInfo.getRealUid(), startInfo.getPackageName(), ProfilingTrigger.TRIGGER_TYPE_APP_COLD_START_ACTIVITY); } } }; Loading services/core/java/com/android/server/am/AnrHelper.java +11 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,8 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.content.pm.ApplicationInfo; import android.os.Process; import android.os.ProfilingServiceHelper; import android.os.ProfilingTrigger; import android.os.SystemClock; import android.os.Trace; import android.util.ArraySet; Loading Loading @@ -240,6 +241,15 @@ class AnrHelper { || startTime < SELF_ONLY_AFTER_BOOT_MS; r.appNotResponding(onlyDumpSelf); final long endTime = SystemClock.uptimeMillis(); if (android.os.profiling.Flags.systemTriggeredProfilingNew() && r.mAppInfo != null && r.mAppInfo.packageName != null) { ProfilingServiceHelper.getInstance().onProfilingTriggerOccurred( r.mUid, r.mAppInfo.packageName, ProfilingTrigger.TRIGGER_TYPE_ANR); } Slog.d(TAG, "Completed ANR of " + r.mApp.processName + " in " + (endTime - startTime) + "ms, latency " + reportLatency + (onlyDumpSelf ? "ms (expired, only dump ANR app)" : "ms")); Loading services/core/java/com/android/server/am/AppStartInfoTracker.java +7 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ApplicationStartInfo; import android.app.Flags; import android.app.IApplicationStartInfoCompleteListener; Loading Loading @@ -419,23 +420,25 @@ public final class AppStartInfoTracker { * Should only be called for Activity launch sequences from an instance of * {@link ActivityMetricsLaunchObserver}. */ void onActivityReportFullyDrawn(long id, long timestampNanos) { @Nullable ApplicationStartInfo onActivityReportFullyDrawn(long id, long timestampNanos) { synchronized (mLock) { if (!mEnabled) { return; return null; } int index = mInProgressRecords.indexOfKey(id); if (index < 0) { return; return null; } ApplicationStartInfo info = mInProgressRecords.valueAt(index); if (info == null) { mInProgressRecords.removeAt(index); return; return null; } info.addStartupTimestamp(ApplicationStartInfo.START_TIMESTAMP_FULLY_DRAWN, timestampNanos); mInProgressRecords.removeAt(index); return info; } } Loading services/core/services-jarjar-rules.txt 0 → 100644 +2 −0 Original line number Diff line number Diff line # For profiling flags rule android.os.profiling.** android.internal.os.profiling.@1 Loading
services/core/Android.bp +8 −0 Original line number Diff line number Diff line Loading @@ -240,6 +240,7 @@ java_library_static { "aconfig_new_storage_flags_lib", "powerstats_flags_lib", "locksettings_flags_lib", "profiling_flags_lib", ], javac_shard_size: 50, javacflags: [ Loading @@ -255,6 +256,13 @@ java_library_static { "FlaggedApi", ], }, jarjar_rules: ":services-jarjar-rules", apex_available: ["//apex_available:platform"], } filegroup { name: "services-jarjar-rules", srcs: ["services-jarjar-rules.txt"], } java_genrule { Loading
services/core/java/com/android/server/am/ActivityManagerService.java +14 −1 Original line number Diff line number Diff line Loading @@ -337,6 +337,8 @@ import android.os.PowerManager; import android.os.PowerManager.ServiceType; import android.os.PowerManagerInternal; import android.os.Process; import android.os.ProfilingServiceHelper; import android.os.ProfilingTrigger; import android.os.RemoteCallback; import android.os.RemoteCallbackList; import android.os.RemoteException; Loading Loading @@ -1089,7 +1091,18 @@ public class ActivityManagerService extends IActivityManager.Stub @Override public void onReportFullyDrawn(long id, long timestampNanos) { mProcessList.getAppStartInfoTracker().onActivityReportFullyDrawn(id, timestampNanos); ApplicationStartInfo startInfo = mProcessList.getAppStartInfoTracker() .onActivityReportFullyDrawn(id, timestampNanos); if (android.os.profiling.Flags.systemTriggeredProfilingNew() && startInfo != null && startInfo.getStartType() == ApplicationStartInfo.START_TYPE_COLD && startInfo.getPackageName() != null) { ProfilingServiceHelper.getInstance().onProfilingTriggerOccurred( startInfo.getRealUid(), startInfo.getPackageName(), ProfilingTrigger.TRIGGER_TYPE_APP_COLD_START_ACTIVITY); } } }; Loading
services/core/java/com/android/server/am/AnrHelper.java +11 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,8 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.content.pm.ApplicationInfo; import android.os.Process; import android.os.ProfilingServiceHelper; import android.os.ProfilingTrigger; import android.os.SystemClock; import android.os.Trace; import android.util.ArraySet; Loading Loading @@ -240,6 +241,15 @@ class AnrHelper { || startTime < SELF_ONLY_AFTER_BOOT_MS; r.appNotResponding(onlyDumpSelf); final long endTime = SystemClock.uptimeMillis(); if (android.os.profiling.Flags.systemTriggeredProfilingNew() && r.mAppInfo != null && r.mAppInfo.packageName != null) { ProfilingServiceHelper.getInstance().onProfilingTriggerOccurred( r.mUid, r.mAppInfo.packageName, ProfilingTrigger.TRIGGER_TYPE_ANR); } Slog.d(TAG, "Completed ANR of " + r.mApp.processName + " in " + (endTime - startTime) + "ms, latency " + reportLatency + (onlyDumpSelf ? "ms (expired, only dump ANR app)" : "ms")); Loading
services/core/java/com/android/server/am/AppStartInfoTracker.java +7 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ApplicationStartInfo; import android.app.Flags; import android.app.IApplicationStartInfoCompleteListener; Loading Loading @@ -419,23 +420,25 @@ public final class AppStartInfoTracker { * Should only be called for Activity launch sequences from an instance of * {@link ActivityMetricsLaunchObserver}. */ void onActivityReportFullyDrawn(long id, long timestampNanos) { @Nullable ApplicationStartInfo onActivityReportFullyDrawn(long id, long timestampNanos) { synchronized (mLock) { if (!mEnabled) { return; return null; } int index = mInProgressRecords.indexOfKey(id); if (index < 0) { return; return null; } ApplicationStartInfo info = mInProgressRecords.valueAt(index); if (info == null) { mInProgressRecords.removeAt(index); return; return null; } info.addStartupTimestamp(ApplicationStartInfo.START_TIMESTAMP_FULLY_DRAWN, timestampNanos); mInProgressRecords.removeAt(index); return info; } } Loading
services/core/services-jarjar-rules.txt 0 → 100644 +2 −0 Original line number Diff line number Diff line # For profiling flags rule android.os.profiling.** android.internal.os.profiling.@1