| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -42,12 +42,10 @@ static void set_awake(UIState *s, bool awake) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // TODO: replace command_awake and command_sleep with direct calls to android
 | 
					 | 
					 | 
					 | 
					    // TODO: replace command_awake and command_sleep with direct calls to android
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (awake) { | 
					 | 
					 | 
					 | 
					    if (awake) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      LOGW("awake normal"); | 
					 | 
					 | 
					 | 
					      LOGW("awake normal"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      system("service call window 18 i32 1");  // enable event processing
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_NORMAL); | 
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_NORMAL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } else { | 
					 | 
					 | 
					 | 
					    } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      LOGW("awake off"); | 
					 | 
					 | 
					 | 
					      LOGW("awake off"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      set_brightness(s, 0); | 
					 | 
					 | 
					 | 
					      set_brightness(s, 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      system("service call window 18 i32 0");  // disable event processing
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_OFF); | 
					 | 
					 | 
					 | 
					      framebuffer_set_power(s->fb, HWC_POWER_MODE_OFF); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  } | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -57,8 +55,20 @@ static void set_awake(UIState *s, bool awake) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#endif | 
					 | 
					 | 
					 | 
					#endif | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					int event_processing_enabled = -1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					static void enable_event_processing(bool yes) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if (event_processing_enabled != 1 && yes) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    system("service call window 18 i32 1");  // enable event processing
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    event_processing_enabled = 1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } else if (event_processing_enabled != 0 && !yes) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    system("service call window 18 i32 0");  // disable event processing
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    event_processing_enabled = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void navigate_to_settings(UIState *s) { | 
					 | 
					 | 
					 | 
					static void navigate_to_settings(UIState *s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#ifdef QCOM | 
					 | 
					 | 
					 | 
					#ifdef QCOM | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  enable_event_processing(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  system("am broadcast -a 'ai.comma.plus.SidebarSettingsTouchUpInside'"); | 
					 | 
					 | 
					 | 
					  system("am broadcast -a 'ai.comma.plus.SidebarSettingsTouchUpInside'"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#else | 
					 | 
					 | 
					 | 
					#else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // computer UI doesn't have offroad settings
 | 
					 | 
					 | 
					 | 
					  // computer UI doesn't have offroad settings
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -67,6 +77,9 @@ static void navigate_to_settings(UIState *s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					static void navigate_to_home(UIState *s) { | 
					 | 
					 | 
					 | 
					static void navigate_to_home(UIState *s) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#ifdef QCOM | 
					 | 
					 | 
					 | 
					#ifdef QCOM | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if (s->vision_connected) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    enable_event_processing(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  system("am broadcast -a 'ai.comma.plus.HomeButtonTouchUpInside'"); | 
					 | 
					 | 
					 | 
					  system("am broadcast -a 'ai.comma.plus.HomeButtonTouchUpInside'"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#else | 
					 | 
					 | 
					 | 
					#else | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // computer UI doesn't have offroad home
 | 
					 | 
					 | 
					 | 
					  // computer UI doesn't have offroad home
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -722,6 +735,7 @@ static void* vision_connect_thread(void *args) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    s->vision_connected = true; | 
					 | 
					 | 
					 | 
					    s->vision_connected = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    s->vision_connect_firstrun = true; | 
					 | 
					 | 
					 | 
					    s->vision_connect_firstrun = true; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    enable_event_processing(false); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    // Drain sockets
 | 
					 | 
					 | 
					 | 
					    // Drain sockets
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    while (true){ | 
					 | 
					 | 
					 | 
					    while (true){ | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -926,6 +940,8 @@ int main(int argc, char* argv[]) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    if (!s->vision_connected) { | 
					 | 
					 | 
					 | 
					    if (!s->vision_connected) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      // always process events offroad
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      enable_event_processing(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (s->status != STATUS_STOPPED) { | 
					 | 
					 | 
					 | 
					      if (s->status != STATUS_STOPPED) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        update_status(s, STATUS_STOPPED); | 
					 | 
					 | 
					 | 
					        update_status(s, STATUS_STOPPED); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |