Tcpdump in Shell Command Fails During Sleep

Skip to first unread message


Apr 22, 2022, 12:07:21 PMApr 22
to Tasker
I am on Android 9, rooted. I have power saving turned off for Tasker. I also have set the property wifi_sleep_policy to 2 (never). Yet, I find that when I run the Tcpdump command in a Shell action, it fails to produce any output if the device is rebooted and left totally alone (as mine is after its nightly reboot) with the screen off.

The Shell action is run, I can see it in the tasker logs. But it appears that the output from Tcpdump of the wlan0 interface is always empty (even though it should not be) until I pick up the phone and start using it again in the morning.

I have seen an interesting discussion here that implies that Android might be turning off wifi despite my efforts but I have looked for the " work profile setup" app mentioned in the posting and it does not appear to exist on my phone (they are talking about Android 8 so maybe things have changed and it no longer exists).

Anyone have any suggestions on how to defeat this?



Apr 22, 2022, 7:25:43 PMApr 22
to Tasker
I have been doing some reading and it appears that Android is shutting down multicast (which I am sending/receiving) during sleep. I have discovered that always on display, if enabled, seems to prevent this from happening. But AOD seems to be turned off if the device is face down, in a pocket, and similar. So even that will not work for my needs.

It seems that this may possibly be overridden by taking a multicast wake lock:

WifiManager wifi = (WifiManager)getSystemService( Context.WIFI_SERVICE ); if(wifi != null){ WifiManager.MulticastLock lock = wifi.createMulticastLock("Log_Tag"); lock.acquire(); }

which can certainly be done using Tasker's java support (what an amazing app!). However, trying to do so reveals that the following permission is required:


And Tasker doesn't have it in its manifest. I tried granting it to Tasker via adb and that didn't work. I know that in an app factory app, you can add permissions. Maybe I can resolve this that way?
Reply all
Reply to author
0 new messages