From a286cf0d504fe63c2a3fab1c424ec092ed19e6f2 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Fri, 6 Aug 2021 12:49:09 +0000 Subject: [PATCH] Fix missing timeline due to unexpected navigation type. Added fallback to global timeline instead of throwing a error if navigation type is unexpected. Bug: b/195738728 Test: Open x20 file winscope-staging-priyankaspatel and select Flicker mode from navigation options, then open local Winscope and check that the global timeline still appears after running/uploading a trace. Change-Id: I9ea336c31fa1f5c752eb4a30f55f08a3ee595811 --- tools/winscope/src/Overlay.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/winscope/src/Overlay.vue b/tools/winscope/src/Overlay.vue index 28a118d7f..e123d7c23 100644 --- a/tools/winscope/src/Overlay.vue +++ b/tools/winscope/src/Overlay.vue @@ -388,7 +388,8 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected navigation type'); + console.warn('Unexpected navigation type; fallback to global'); + return 'All timelines'; } const fileType = split[1]; @@ -410,7 +411,8 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected navigation type'); + console.warn('Unexpected navigation type; fallback to global'); + return 'public'; } const fileType = split[1]; @@ -441,7 +443,8 @@ export default { .traces[this.navigationStyle.split('-')[1]]; } - throw new Error('Unexpected Navigation Style'); + console.warn('Unexpected navigation type; fallback to global'); + return this.mergedTimeline; }, isCropped() { return this.crop != null && @@ -608,7 +611,9 @@ export default { default: const split = this.navigationStyle.split('-'); if (split[0] !== NAVIGATION_STYLE.TARGETED) { - throw new Error('Unexpected navigation type'); + console.warn('Unexpected navigation type; fallback to global'); + navigationStyleFilter = (f) => true; + break; } const fileType = split[1];