code: public static void setAdbEnabled(boolean adbEnabled) {
      // This setting moved from Secure to Global in JELLY_BEAN_MR1
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        Settings.Global.putInt(
            RuntimeEnvironment.application.getContentResolver(),
            Settings.Global.ADB_ENABLED,
            adbEnabled ? 1 : 0);
      }
      // Support all clients by always setting the Secure version of the setting
      Settings.Secure.putInt(
          RuntimeEnvironment.application.getContentResolver(),
          Settings.Secure.ADB_ENABLED,
          adbEnabled ? 1 : 0);
    }
docs: Sets the value of the {@link Settings.Global#ADB_ENABLED} setting or {@link
  Settings.Secure#ADB_ENABLED} depending on API level.
  
  @param adbEnabled new value for whether adb is enabled