/* Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 2 0 ĠThe ĠAndroid ĠOpen ĠSource ĠProject Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ package Ġcom . android . tools . idea . app inspection . internal Ċ Ċ import Ġcom . android . tools . idea . app inspection . api . App Inspection Api Services Ċ import Ġcom . android . tools . idea . app inspection . api . Jar Cop ier Creator Ċ import Ġcom . android . tools . idea . app inspection . inspector . api . App Inspection Process No Long er Exists Exception Ċ import Ġcom . android . tools . idea . app inspection . inspector . api . App Inspector Messenger Ċ import Ġcom . android . tools . idea . app inspection . inspector . api . launch . Launch Parameters Ċ import Ġcom . android . tools . idea . app inspection . inspector . api . process . Process Descriptor Ċ Ċ /** Ċ Ġ* ĠThis Ġserves Ġas Ġthe Ġentry Ġpoint Ġto Ġall Ġpublic ĠApp Inspection ĠAPI Ġservices , Ġspecifically : Ċ Ġ* Ġ 1 ) Ġdiscover Ġwhen Ġprocesses Ġstart Ġand Ġfinish . Ċ Ġ* Ġ 2 ) Ġlaunch Ġinspect ors Ġon Ġdiscovered Ġprocesses . Ċ Ġ*/ Ċ internal Ġclass ĠDefault App Inspection Api Services Ġinternal Ġconstructor ( ĊĠ Ġprivate Ġval Ġtarget Manager : ĠApp Inspection Target Manager , ĊĠ Ġprivate Ġval Ġcreate Jar Cop ier : ĠJar Cop ier Creator , ĊĠ Ġprivate Ġval Ġdiscovery : ĠApp Inspection Process Discovery Ċ ) Ġ: ĠApp Inspection Api Services Ġ{ ĊĠ Ġoverride Ġval Ġprocess Notifier Ġ= Ġdiscovery ĊĊĠ Ġoverride Ġsuspend Ġfun Ġdispose Clients ( project : ĠString ) Ġ{ ĊĠĠĠ Ġtarget Manager . dispose Clients ( project ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġsuspend Ġfun Ġdo Attach To Process ( process : ĠProcess Descriptor , ĠprojectName : ĠString ): ĠApp Inspection Target Ġ{ ĊĠĠĠ Ġval Ġjar Cop ier Creator Ġ= Ġcreate Jar Cop ier ( process . device ) Ġ?: Ġthrow ĠRuntimeException (" Cannot Ġfind ĠA DB Ġdevice .") ĊĠĠĠ Ġval Ġstream Channel Ġ= Ġdiscovery . get Stream Channel ( process . stream Id ) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ?: Ġthrow ĠApp Inspection Process No Long er Exists Exception ( ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ" Cannot Ġattach Ġto Ġprocess Ġbecause Ġthe Ġdevice Ġdoes Ġnot Ġexist . ĠProcess : Ġ$ process ") ĊĠĠĠ Ġreturn Ġtarget Manager . attach To Process ( process , Ġjar Cop ier Creator , Ġstream Channel , ĠprojectName ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġsuspend Ġfun Ġattach To Process ( process : ĠProcess Descriptor , ĠprojectName : ĠString ): ĠApp Inspection Target Ġ{ ĊĠĠĠ Ġreturn Ġdo Attach To Process ( process , ĠprojectName ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġsuspend Ġfun Ġlaunch Inspector ( params : ĠLaunch Parameters ): ĠApp Inspector Messenger Ġ{ ĊĠĠĠ Ġreturn Ġdo Attach To Process ( params . process Descriptor , Ġparams . projectName ). launch Inspector ( params ) ĊĠ Ġ} ĊĊĠ Ġoverride Ġsuspend Ġfun Ġstop Inspect ors ( process : ĠProcess Descriptor ) Ġ{ ĊĠĠĠ Ġtarget Manager . getTarget ( process )?. dispose () ĊĠ Ġ} Ċ }