A teenager who was detained under the Emergency Ordinance (EO) for almost a year has been set free to return home.