Merge "ui: fix recording on P"
diff --git a/infra/perfetto.dev/src/gen_sql_tables_reference.js b/infra/perfetto.dev/src/gen_sql_tables_reference.js
index a605577..b1ced89 100644
--- a/infra/perfetto.dev/src/gen_sql_tables_reference.js
+++ b/infra/perfetto.dev/src/gen_sql_tables_reference.js
@@ -61,6 +61,12 @@
     return tableDesc.cols[name];
   };
 
+  // Reserve the id and type columns so they appear first in the column list
+  // They will only be kept in case this is a root table - otherwise they will
+  // be deleted below..
+  const id = getOrCreateColumn('id');
+  const type = getOrCreateColumn('type');
+
   let lastColumn = undefined;
   for (const line of tableDef.split('\n')) {
     if (line.startsWith('#define'))
@@ -121,6 +127,14 @@
     throw new Error(`Cannot parse line "${line}" from ${tableDefName}`);
   }
 
+  if (tableDesc.parentDefName === '') {
+    id.type = `${tableDesc.cppClassName}::Id`;
+    type.type = 'string';
+  } else {
+    delete tableDesc.cols['id'];
+    delete tableDesc.cols['type'];
+  }
+
   // Process {@joinable xxx} annotations.
   const regex = /\s?\{@joinable\s*(\w+)\.(\w+)\s*\}/;
   for (const col of Object.values(tableDesc.cols)) {
diff --git a/tools/tmux b/tools/tmux
index 0eb3d6f..c9568c6 100755
--- a/tools/tmux
+++ b/tools/tmux
@@ -264,6 +264,10 @@
 fi
 tmux -2 new-session -d -s demo
 
+if [ ! -z "$ANDROID_ADB_SERVER_PORT" ]; then
+  tmux set-environment -t demo ANDROID_ADB_SERVER_PORT $ANDROID_ADB_SERVER_PORT
+fi
+
 if tmux -V | awk '{split($2, ver, "."); if (ver[1] < 2) exit 1 ; else if (ver[1] == 2 && ver[2] < 1) exit 1 }'; then
   tmux set-option -g mouse on
 else