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

Commit 6b93a31a authored by Ioana Alexandru's avatar Ioana Alexandru
Browse files

Add tracing to loadHeaderAppName and recoverBuilder

These are known to be likely to cause issues (b/281629927) so this
should help us keep an eye on them.

Bug: 281629927
Test: builds
Flag: NONE
Change-Id: If69840e5582be0c4d47705dd2a5a07315b93d3e6
parent de1feb16
Loading
Loading
Loading
Loading
+56 −42
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.os.SystemClock;
import android.os.SystemProperties;
import android.os.Trace;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
@@ -3022,6 +3023,9 @@ public class Notification implements Parcelable
     * @hide
     */
    public String loadHeaderAppName(Context context) {
        Trace.beginSection("Notification#loadHeaderAppName");
        try {
            CharSequence name = null;
            // Check if there is a non-empty substitute app name and return that.
            if (extras.containsKey(EXTRA_SUBSTITUTE_APP_NAME)) {
@@ -3037,7 +3041,8 @@ public class Notification implements Parcelable
            final PackageManager pm = context.getPackageManager();
            if (TextUtils.isEmpty(name)) {
                if (extras.containsKey(EXTRA_BUILDER_APPLICATION_INFO)) {
                final ApplicationInfo info = extras.getParcelable(EXTRA_BUILDER_APPLICATION_INFO,
                    final ApplicationInfo info = extras.getParcelable(
                            EXTRA_BUILDER_APPLICATION_INFO,
                            ApplicationInfo.class);
                    if (info != null) {
                        name = pm.getApplicationLabel(info);
@@ -3053,6 +3058,9 @@ public class Notification implements Parcelable
                return null;
            }
            return name.toString();
        } finally {
            Trace.endSection();
        }
    }
    /**
@@ -6713,6 +6721,9 @@ public class Notification implements Parcelable
         */
        @NonNull
        public static Notification.Builder recoverBuilder(Context context, Notification n) {
            Trace.beginSection("Notification.Builder#recoverBuilder");
            try {
                // Re-create notification context so we can access app resources.
                ApplicationInfo applicationInfo = n.extras.getParcelable(
                        EXTRA_BUILDER_APPLICATION_INFO, ApplicationInfo.class);
@@ -6730,6 +6741,9 @@ public class Notification implements Parcelable
                }
                return new Builder(builderContext, n);
            } finally {
                Trace.endSection();
            }
        }
        /**