If this blog helped you in any way, please donate a dollar here

Monday, May 15, 2017

ADB Disable bluetooth on non-rooted devices

Here's a script to disable Bluetooth from non-rooted devices:

adb shell <<__eof
  input keyevent KEYCODE_WAKEUP;
  wm dismiss-keyguard;
  am start -a android.bluetooth.adapter.action.REQUEST_DISABLE;
  is_open=`dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp' | grep 'com.android.settings/com.android.settings.bluetooth.RequestPermissionHelperActivity'|wc -l`
  if [ $is_open = 0 ]; then exit; fi
  sleep 1;
  input keyevent KEYCODE_DPAD_RIGHT;
  input keyevent KEYCODE_DPAD_RIGHT;
  input keyevent KEYCODE_ENTER;
  exit;
__EOF

No warranties!

No comments:

Post a Comment