Fix Lazy layers trace parsing in winscope

Plus some uncaught exceptions in the log

Bug: 211049519
Test: build winscope and open a trace
Change-Id: I04f52258069667e0da6342dabbcf2d46810804d3
diff --git a/tools/winscope/src/DataInput.vue b/tools/winscope/src/DataInput.vue
index 57fcb98..c4f1cf0 100644
--- a/tools/winscope/src/DataInput.vue
+++ b/tools/winscope/src/DataInput.vue
@@ -373,9 +373,9 @@
 
           const selectedFile =
               this.getMostLikelyCandidateFile(dataType, files);
-          const frozenData = Object.freeze(selectedFile.data);
-          delete selectedFile.data;
-          selectedFile.data = frozenData;
+          if (selectedFile.data) {
+            selectedFile.data = Object.freeze(selectedFile.data);
+          }
 
           this.$set(this.dataFiles, dataType, Object.freeze(selectedFile));
 
@@ -592,28 +592,26 @@
 
       let lastError;
       for (const filename in content.files) {
-        if (content.files.hasOwnProperty(filename)) {
-          const file = content.files[filename];
-          if (file.dir) {
-            // Ignore directories
-            continue;
+        const file = content.files[filename];
+        if (file.dir) {
+          // Ignore directories
+          continue;
+        }
+
+        const fileBlob = await file.async('blob');
+        // Get only filename and remove rest of path
+        fileBlob.name = filename.split('/').slice(-1).pop();
+
+        try {
+          const decodedFile = await this.decodeFile(fileBlob);
+
+          decodedFiles.push(decodedFile);
+        } catch (e) {
+          if (!(e instanceof UndetectableFileType)) {
+            lastError = e;
           }
 
-          const fileBlob = await file.async('blob');
-          // Get only filename and remove rest of path
-          fileBlob.name = filename.split('/').slice(-1).pop();
-
-          try {
-            const decodedFile = await this.decodeFile(fileBlob);
-
-            decodedFiles.push(decodedFile);
-          } catch (e) {
-            if (!(e instanceof UndetectableFileType)) {
-              lastError = e;
-            }
-
-            console.error(e);
-          }
+          console.error(e);
         }
       }
 
diff --git a/tools/winscope/src/flickerlib/common.js b/tools/winscope/src/flickerlib/common.js
index 7538d23..cca16f4 100644
--- a/tools/winscope/src/flickerlib/common.js
+++ b/tools/winscope/src/flickerlib/common.js
@@ -56,8 +56,8 @@
 // SF
 const Layer = require('flicker').com.android.server.wm.traces.common.
     layers.Layer;
-const AbstractLayerTraceEntry = require('flicker').com.android.server.wm.traces.common.
-    layers.AbstractLayerTraceEntry;
+const BaseLayerTraceEntry = require('flicker').com.android.server.wm.traces.common.
+    layers.BaseLayerTraceEntry;
 const LayerTraceEntry = require('flicker').com.android.server.wm.traces.common.
     layers.LayerTraceEntry;
 const LayerTraceEntryBuilder = require('flicker').com.android.server.wm.traces.
@@ -272,7 +272,7 @@
   WindowManagerTrace,
   WindowManagerState,
   // SF
-  AbstractLayerTraceEntry,
+  BaseLayerTraceEntry,
   Layer,
   LayerTraceEntry,
   LayerTraceEntryBuilder,
diff --git a/tools/winscope/src/flickerlib/layers/LayerTraceEntryLazy.ts b/tools/winscope/src/flickerlib/layers/LayerTraceEntryLazy.ts
index 035cee7..393e97c 100644
--- a/tools/winscope/src/flickerlib/layers/LayerTraceEntryLazy.ts
+++ b/tools/winscope/src/flickerlib/layers/LayerTraceEntryLazy.ts
@@ -15,10 +15,10 @@
  */
 
 
-import { AbstractLayerTraceEntry } from "../common";
+import { BaseLayerTraceEntry } from "../common";
 import LayerTraceEntry from "./LayerTraceEntry";
 
-class LayerTraceEntryLazy extends AbstractLayerTraceEntry {
+class LayerTraceEntryLazy extends BaseLayerTraceEntry {
   private _isInitialized: boolean = false;
   private _layersProto: any[];
   private _displayProtos: any[];