celzero / rethink-app

DNS over HTTPS / DNS over Tor / DNSCrypt client, WireGuard proxifier, firewall, and connection tracker for Android.
https://rethinkfirewall.com/
Apache License 2.0
2.98k stars 149 forks source link

ActivityManager kills Rethink "due to set debug app" #1746

Closed ignoramous closed 1 week ago

ignoramous commented 1 week ago
10-21 04:08:30.944  1848  5630 I am_kill : [0,10847,com.celzero.bravedns,100,stop com.celzero.bravedns due to set debug app]

From prior logs it looks like this kill happened just before the Settings app's developer options was opened:

10-21 04:08:30.479 20923  7417 I sysui_multi_action: [757,830,758,4,833,744,854,development_settings]
10-21 04:08:30.494  1848  1863 I wm_task_moved: [30250,30250,0,1,15]            
10-21 04:08:30.494  1848  1863 I wm_create_activity: [0,31922274,30250,com.android.settings/.Settings$DevelopmentSettingsDashboardActivity,android.settings.APPLICATION_DEVELOPMENT_SETTINGS,NULL,NULL,0]
10-21 04:08:30.497  1848  1863 I wm_pause_activity: [0,117627198,com.android.settings/.SubSettings,userLeaving=true,resumeTopActivity]
10-21 04:08:30.500 20923 20923 I wm_on_top_resumed_lost_called: [117627198,com.android.settings.SubSettings,topStateChangedWhenResumed]
10-21 04:08:30.502 20923 20923 I wm_on_paused_called: [117627198,com.android.settings.SubSettings,performPause,0]
10-21 04:08:30.502 20923  7414 I sysui_multi_action: [757,744,758,2,1089,1721]  
10-21 04:08:30.504  1848  3379 I wm_add_to_stopping: [0,117627198,com.android.settings/.SubSettings,makeInvisible]
10-21 04:08:30.505  1848  3379 I wm_restart_activity: [0,31922274,30250,com.android.settings/.Settings$DevelopmentSettingsDashboardActivity]
10-21 04:08:30.509  1848  3379 I wm_set_resumed_activity: [0,com.android.settings/.Settings$DevelopmentSettingsDashboardActivity,minimalResumeActivityLocked - onActivityStateChanged]
10-21 04:08:30.513  1848  1884 I sysui_multi_action: [757,803,799,window_time_0,802,2]
10-21 04:08:30.517  1848  1888 I input_focus: [Requesting to set focus to null window,reason=UpdateInputWindows]
10-21 04:08:30.542  1848  2212 I input_focus: [Focus leaving 2f7a611 com.android.settings/com.android.settings.SubSettings (server),reason=NO_WINDOW]
10-21 04:08:30.620 20923  7424 I sysui_multi_action: [757,853,758,4,833,39,854,bluetooth_select_a2dp_lhdc_playback_quality,1089,4]
10-21 04:08:30.631 20923  7421 I sysui_multi_action: [757,853,758,4,833,39,854,bluetooth_select_a2dp_codec,1089,1000000]
10-21 04:08:30.677 20923  7415 I sysui_multi_action: [757,853,758,4,833,39,854,bluetooth_select_a2dp_codec_new,1089,1000000]
10-21 04:08:30.699  1848  1911 I am_proc_start: [0,7616,1000,com.oplus.engineermode,content provider,{com.oplus.engineermode/com.oplus.engineermode.display.lcd.modeltest.VisibilityAttrProvider}]
10-21 04:08:30.724  1848  5131 I am_proc_bound: [0,7616,com.oplus.engineermode] 
10-21 04:08:30.843 20923 20923 I wm_on_create_called: [31922274,com.android.settings.Settings$DevelopmentSettingsDashboardActivity,performCreate,323]
10-21 04:08:30.873 20923 20923 I wm_on_start_called: [31922274,com.android.settings.Settings$DevelopmentSettingsDashboardActivity,handleStartActivity,28]
10-21 04:08:30.873 20923 20923 I snet_event_log: [120484087,-1,]                
10-21 04:08:30.873 20923 20923 I wm_on_resume_called: [31922274,com.android.settings.Settings$DevelopmentSettingsDashboardActivity,RESUME_ACTIVITY,0]
10-21 04:08:30.877 20923  7421 I sysui_multi_action: [757,39,758,1,833,0,1089,331]
10-21 04:08:30.893 20923  7424 I sysui_multi_action: [757,853,758,4,833,39,854,ingress_rate_limit,1089,-1]
10-21 04:08:30.942  1848  5630 I am_uid_stopped: 10458  

From ActivityManager's code (am:resolveActivity), it looks like if an app is sent an intent with START_FLAG_DEBUG set (am:setDebugApp), the app is force stopped.

The question is, why does it happen with Rethink? Probably only happens on debuggable builds?

hussainmohd-a commented 1 week ago

This behavior is expected to happen on debug builds,

When the app in debug mode, the system can force-stop and restart it to ensure it runs with proper debug hooks attached.

The system wants to ensure the app is restarted properly in a debug context, so it force-stops the app and relaunches it to ensure all debugging options (like breakpoints, logs, etc.) are initialized correctly.

ref: https://stackoverflow.com/questions/60569758/android-studio-debugger-stops-unexpectedly, https://developer.android.com/studio/debug, https://stackoverflow.com/questions/40618803/android-app-crashes-when-launched-in-debug-mode