File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed 
app/src/main/java/tech/httptoolkit/android Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -182,12 +182,20 @@ class ProxyVpnService : VpnService(), IProtectSocket {
182182                when  {
183183                    isGenymotion ->  {
184184                        //  For some reason, with Genymotion the whole device crashes if we intercept
185-                         //  blindly, but intercepting every single application explicitly is fine, so
186-                         //  we have to individually allow every app instead:
187-                         allPackageNames.forEach { name -> 
188-                             if  (name !=  httpToolkitPackage &&  ! uninterceptedApps.contains(name)) {
189-                                 addAllowedApplication(name)
190-                             }
185+                         //  the whole system, so we have to ensure we *always* explicitly allow
186+                         //  every app that we care about.
187+ 
188+                         val  pkgsToIntercept =  allPackageNames.filter { name -> 
189+                             name !=  httpToolkitPackage &&  ! uninterceptedApps.contains(name)
190+                         }
191+ 
192+                         if  (! pkgsToIntercept.isEmpty()) {
193+                             pkgsToIntercept.forEach { pkg ->  addAllowedApplication(pkg) }
194+                         } else  {
195+                             //  We can never intercept nothing (or the whole emulator crashes), so
196+                             //  instead we intercept a random bit of Genymotions internals, which
197+                             //  (AFAICT) doesn't seem to ever send traffic.
198+                             addAllowedApplication(" com.genymotion.genyd" 
191199                        }
192200                    }
193201                    else  ->  {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments