Merge "ResetIncrState before all other track_event packets"
diff --git a/examples/sdk/BUILD.gn b/examples/sdk/BUILD.gn
index 8da2991..a801d29 100644
--- a/examples/sdk/BUILD.gn
+++ b/examples/sdk/BUILD.gn
@@ -20,7 +20,6 @@
     "trace_categories.cc",
     "trace_categories.h",
   ]
-  configs -= [ "//gn/standalone:extra_warnings" ]
   cflags = [ "-DPERFETTO_SDK_EXAMPLE_USE_INTERNAL_HEADERS" ]
   testonly = true
   deps = [
diff --git a/include/perfetto/tracing/internal/track_event_macros.h b/include/perfetto/tracing/internal/track_event_macros.h
index c82134d..a901524 100644
--- a/include/perfetto/tracing/internal/track_event_macros.h
+++ b/include/perfetto/tracing/internal/track_event_macros.h
@@ -87,9 +87,16 @@
   }  // namespace internal
 
 // Defines the TrackEvent data source for the current track event namespace.
+// `virtual ~TrackEvent` is added to avoid `-Wweak-vtables` warning.
+// Learn more : aosp/2019906
 #define PERFETTO_INTERNAL_DECLARE_TRACK_EVENT_DATA_SOURCE()              \
   struct TrackEvent : public ::perfetto::internal::TrackEventDataSource< \
-                          TrackEvent, &internal::kCategoryRegistry> {}
+                          TrackEvent, &internal::kCategoryRegistry> {    \
+    virtual ~TrackEvent();                                               \
+  }
+
+#define PERFETTO_INTERNAL_DEFINE_TRACK_EVENT_DATA_SOURCE() \
+  TrackEvent::~TrackEvent() = default;
 
 // At compile time, turns a category name represented by a static string into an
 // index into the current category registry. A build error will be generated if
diff --git a/include/perfetto/tracing/track_event.h b/include/perfetto/tracing/track_event.h
index 7e226f0..45499eb 100644
--- a/include/perfetto/tracing/track_event.h
+++ b/include/perfetto/tracing/track_event.h
@@ -184,12 +184,13 @@
 
 // Allocate storage for each category by using this macro once per track event
 // namespace.
-#define PERFETTO_TRACK_EVENT_STATIC_STORAGE()      \
-  namespace PERFETTO_TRACK_EVENT_NAMESPACE {       \
-  PERFETTO_INTERNAL_CATEGORY_STORAGE()             \
-  } /* namespace PERFETTO_TRACK_EVENT_NAMESPACE */ \
-  PERFETTO_DEFINE_DATA_SOURCE_STATIC_MEMBERS(      \
-      PERFETTO_TRACK_EVENT_NAMESPACE::TrackEvent,  \
+#define PERFETTO_TRACK_EVENT_STATIC_STORAGE()        \
+  namespace PERFETTO_TRACK_EVENT_NAMESPACE {         \
+  PERFETTO_INTERNAL_CATEGORY_STORAGE()               \
+  PERFETTO_INTERNAL_DEFINE_TRACK_EVENT_DATA_SOURCE() \
+  } /* namespace PERFETTO_TRACK_EVENT_NAMESPACE */   \
+  PERFETTO_DEFINE_DATA_SOURCE_STATIC_MEMBERS(        \
+      PERFETTO_TRACK_EVENT_NAMESPACE::TrackEvent,    \
       perfetto::internal::TrackEventDataSourceTraits)
 
 // Ignore GCC warning about a missing argument for a variadic macro parameter.
diff --git a/protos/perfetto/trace/ftrace/ftrace_event.proto b/protos/perfetto/trace/ftrace/ftrace_event.proto
index e23b909..f7b4d53 100644
--- a/protos/perfetto/trace/ftrace/ftrace_event.proto
+++ b/protos/perfetto/trace/ftrace/ftrace_event.proto
@@ -499,5 +499,7 @@
     KvmWfxArm64FtraceEvent kvm_wfx_arm64 = 401;
     TrapRegFtraceEvent trap_reg = 402;
     VgicUpdateIrqPendingFtraceEvent vgic_update_irq_pending = 403;
+    WakeupSourceActivateFtraceEvent wakeup_source_activate = 404;
+    WakeupSourceDeactivateFtraceEvent wakeup_source_deactivate = 405;
   }
 }
diff --git a/protos/perfetto/trace/ftrace/power.proto b/protos/perfetto/trace/ftrace/power.proto
index f38015a..7279e24 100644
--- a/protos/perfetto/trace/ftrace/power.proto
+++ b/protos/perfetto/trace/ftrace/power.proto
@@ -42,3 +42,11 @@
   optional uint32 gpu_id = 1;
   optional uint32 state = 2;
 }
+message WakeupSourceActivateFtraceEvent {
+  optional string name = 1;
+  optional uint64 state = 2;
+}
+message WakeupSourceDeactivateFtraceEvent {
+  optional string name = 1;
+  optional uint64 state = 2;
+}
diff --git a/protos/perfetto/trace/perfetto_trace.proto b/protos/perfetto/trace/perfetto_trace.proto
index cede0b6..39b2ad0 100644
--- a/protos/perfetto/trace/perfetto_trace.proto
+++ b/protos/perfetto/trace/perfetto_trace.proto
@@ -5528,6 +5528,14 @@
   optional uint32 gpu_id = 1;
   optional uint32 state = 2;
 }
+message WakeupSourceActivateFtraceEvent {
+  optional string name = 1;
+  optional uint64 state = 2;
+}
+message WakeupSourceDeactivateFtraceEvent {
+  optional string name = 1;
+  optional uint64 state = 2;
+}
 
 // End of protos/perfetto/trace/ftrace/power.proto
 
@@ -6325,6 +6333,8 @@
     KvmWfxArm64FtraceEvent kvm_wfx_arm64 = 401;
     TrapRegFtraceEvent trap_reg = 402;
     VgicUpdateIrqPendingFtraceEvent vgic_update_irq_pending = 403;
+    WakeupSourceActivateFtraceEvent wakeup_source_activate = 404;
+    WakeupSourceDeactivateFtraceEvent wakeup_source_deactivate = 405;
   }
 }
 
diff --git a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
index ea7c8a2..1692c44 100644
--- a/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
+++ b/src/trace_processor/importers/ftrace/ftrace_descriptors.cc
@@ -24,7 +24,7 @@
 namespace trace_processor {
 namespace {
 
-std::array<MessageDescriptor, 404> descriptors{{
+std::array<MessageDescriptor, 406> descriptors{{
     {nullptr, 0, {}},
     {nullptr, 0, {}},
     {nullptr, 0, {}},
@@ -4343,6 +4343,24 @@
             {"vcpu_id", ProtoSchemaType::kUint64},
         },
     },
+    {
+        "wakeup_source_activate",
+        2,
+        {
+            {},
+            {"name", ProtoSchemaType::kString},
+            {"state", ProtoSchemaType::kUint64},
+        },
+    },
+    {
+        "wakeup_source_deactivate",
+        2,
+        {
+            {},
+            {"name", ProtoSchemaType::kString},
+            {"state", ProtoSchemaType::kUint64},
+        },
+    },
 }};
 
 }  // namespace
diff --git a/src/traced/probes/ftrace/event_info.cc b/src/traced/probes/ftrace/event_info.cc
index af0dfb5..f24895d 100644
--- a/src/traced/probes/ftrace/event_info.cc
+++ b/src/traced/probes/ftrace/event_info.cc
@@ -6622,6 +6622,32 @@
        kUnsetFtraceId,
        332,
        kUnsetSize},
+      {"wakeup_source_activate",
+       "power",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "name", 1, ProtoSchemaType::kString,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "state", 2, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       404,
+       kUnsetSize},
+      {"wakeup_source_deactivate",
+       "power",
+       {
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "name", 1, ProtoSchemaType::kString,
+            TranslationStrategy::kInvalidTranslationStrategy},
+           {kUnsetOffset, kUnsetSize, FtraceFieldType::kInvalidFtraceFieldType,
+            "state", 2, ProtoSchemaType::kUint64,
+            TranslationStrategy::kInvalidTranslationStrategy},
+       },
+       kUnsetFtraceId,
+       405,
+       kUnsetSize},
       {"sys_enter",
        "raw_syscalls",
        {
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_activate/format b/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_activate/format
new file mode 100644
index 0000000..b8b39d8
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_activate/format
@@ -0,0 +1,12 @@
+name: wakeup_source_activate
+ID: 123
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:__data_loc char[] name;	offset:8;	size:4;	signed:0;
+	field:u64 state;	offset:16;	size:8;	signed:0;
+
+print fmt: "%s state=0x%lx", __get_str(name), (unsigned long)REC->state
diff --git a/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_deactivate/format b/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_deactivate/format
new file mode 100644
index 0000000..03e9b39
--- /dev/null
+++ b/src/traced/probes/ftrace/test/data/synthetic/events/power/wakeup_source_deactivate/format
@@ -0,0 +1,12 @@
+name: wakeup_source_deactivate
+ID: 124
+format:
+	field:unsigned short common_type;	offset:0;	size:2;	signed:0;
+	field:unsigned char common_flags;	offset:2;	size:1;	signed:0;
+	field:unsigned char common_preempt_count;	offset:3;	size:1;	signed:0;
+	field:int common_pid;	offset:4;	size:4;	signed:1;
+
+	field:__data_loc char[] name;	offset:8;	size:4;	signed:0;
+	field:u64 state;	offset:16;	size:8;	signed:0;
+
+print fmt: "%s state=0x%lx", __get_str(name), (unsigned long)REC->state
diff --git a/tools/ftrace_proto_gen/event_list b/tools/ftrace_proto_gen/event_list
index de39399..d60a545 100644
--- a/tools/ftrace_proto_gen/event_list
+++ b/tools/ftrace_proto_gen/event_list
@@ -398,3 +398,5 @@
 kvm/kvm_wfx_arm64
 kvm/trap_reg
 kvm/vgic_update_irq_pending
+power/wakeup_source_activate
+power/wakeup_source_deactivate
diff --git a/ui/release/channels.json b/ui/release/channels.json
index dbda68f..1540749 100644
--- a/ui/release/channels.json
+++ b/ui/release/channels.json
@@ -6,7 +6,7 @@
     },
     {
       "name": "canary",
-      "rev": "88e543ae67d219635038cd007ab3b5a45a0e2614"
+      "rev": "433c9fe808b23a28f3bcfaaf026830d908be4104"
     },
     {
       "name": "autopush",