Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async deleteSession () {
logger.debug('Deleting UiAutomator2 session');
await androidHelpers.removeAllSessionWebSocketHandlers(this.server, this.sessionId);
await this.mobileStopScreenStreaming();
if (this.uiautomator2) {
try {
await this.stopChromedriverProxies();
} catch (err) {
logger.warn(`Unable to stop ChromeDriver proxies: ${err.message}`);
}
if (this.jwpProxyActive) {
try {
await this.uiautomator2.deleteSession();
} catch (err) {
logger.warn(`Unable to proxy deleteSession to UiAutomator2: ${err.message}`);
}
}
this.uiautomator2 = null;
}