How to deactivate wifi and bluetooth in sleep mode?

About how to go into deep sleep and ignore an active Bluetooth connection, playing music, and a network connection on Android Pie.
You can modify the source code on kernel.

diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 1896386..ca700a3 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -197,6 +197,7 @@ static struct wakelock *wakelock_lookup_add(const char *name, size_t len,
 
 int pm_wake_lock(const char *buf)
 {
+#if 0
        const char *str = buf;
        struct wakelock *wl;
        u64 timeout_ns = 0;
@@ -241,6 +242,8 @@ int pm_wake_lock(const char *buf)
  out:
        mutex_unlock(&wakelocks_lock);
        return ret;
+#endif
+       return 0;
 }
 
 int pm_wake_unlock(const char *buf)

3 Likes