Reset default UserTag at the time of the first flutter frame (#86516)

* Reset default UserTag at the time of the first flutter frame
diff --git a/packages/flutter/lib/src/widgets/binding.dart b/packages/flutter/lib/src/widgets/binding.dart
index 162c548..b5d9542 100644
--- a/packages/flutter/lib/src/widgets/binding.dart
+++ b/packages/flutter/lib/src/widgets/binding.dart
@@ -859,6 +859,11 @@
       firstFrameCallback = (List<FrameTiming> timings) {
         assert(sendFramesToEngine);
         if (!kReleaseMode) {
+          // Change the current user tag back to the default tag. At this point,
+          // the user tag should be set to "AppStartUp" (originally set in the
+          // engine), so we need to change it back to the default tag to mark
+          // the end of app start up for CPU profiles.
+          developer.UserTag.defaultTag.makeCurrent();
           developer.Timeline.instantSync('Rasterized first useful frame');
           developer.postEvent('Flutter.FirstFrame', <String, dynamic>{});
         }
diff --git a/packages/flutter/test/widgets/binding_first_frame_developer_test.dart b/packages/flutter/test/widgets/binding_first_frame_developer_test.dart
new file mode 100644
index 0000000..9bc3bb9
--- /dev/null
+++ b/packages/flutter/test/widgets/binding_first_frame_developer_test.dart
@@ -0,0 +1,25 @@
+// Copyright 2014 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:developer' as developer;
+import 'dart:ui';
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+void main() {
+  test('first frame callback sets the default UserTag', () {
+      final WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
+
+      expect(developer.getCurrentTag().label, equals('Default'));
+      developer.UserTag('test tag').makeCurrent();
+      expect(developer.getCurrentTag().label, equals('test tag'));
+
+      binding.drawFrame();
+      // Simulates the engine again.
+      binding.window.onReportTimings!(<FrameTiming>[]);
+
+      expect(developer.getCurrentTag().label, equals('Default'));
+  });
+}