In criminal cases, if the petitioner is confined in a county jail or other local correctional facility, notice of the time and place at which the writ is returnable must be given to the county attorney of the county from which the petitioner was committed, if the county attorney is within the petitioner’s county. If the petitioner is confined in a state correctional facility, the notice of the time and place at which the writ is returnable must be given to the attorney general, and the attorney general shall appear for the person named as respondent in the writ. In other cases, notice of the time and place at which the writ is returnable must be given to any person interested in continuing the custody or restraint of the petitioner.