Catalyzes the reversible interconversion of maltose and trehalose by transglucosylation (PubMed:15511231, PubMed:18505459, PubMed:20118231, PubMed:21840994). Maltose is the preferred substrate (PubMed:15511231, PubMed:18505459). To a lesser extent, also displays amylase activity, catalyzing the endohydrolysis of (1->4)-alpha-D-glucosidic linkages in glycogen and maltooligosaccharides such as maltoheptaose, to produce maltose which then can be converted to trehalose (PubMed:18505459). TreS plays a key role in the utilization of trehalose for the production of glycogen and alpha-glucan via the TreS-Pep2 branch involved in the biosynthesis of maltose-1-phosphate (M1P) (PubMed:20118231, PubMed:27513637). Might also function as a sensor and/or regulator of trehalose levels within the cell. Thus, when trehalose levels in the cell become dangerously low, TreS can expedite the conversion of glycogen to maltose via its amylase activity and then convert the maltose to trehalose; but this enzyme also can expedite or promote the conversion of trehalose to glycogen when cytoplasmic trehalose levels become too high. Is also able to catalyze the hydrolytic cleavage of alpha-aryl glucosides, as well as alpha-glucosyl fluoride in vitro. D-maltose = alpha,alpha-trehalose Endohydrolysis of (1->4)-alpha-D-glucosidic linkages in polysaccharides containing three or more (1->4)-alpha-linked D-glucose units. The amylase activity is stimulated by addition of Ca(2+), but this cation and other divalent cations inhibit the trehalose synthase activity. In addition, trehalose synthase activity, but not amylase activity, is strongly inhibited, and in a competitive manner, by validoxylamine. On the other hand, amylase, but not trehalose synthase activity, is inhibited by the known transition-state amylase inhibitor, acarbose, suggesting the possibility of two different active sites. Other metal ions such as Mg(2+), Mn(2+), and Co(2+) are also somewhat effective in the stimulation of amylase activity, but Hg(2+), Cu(2+), Ni(2+) and Zn(2+) are inhibitory. Optimum pH is between 6.0-6.2 for the amylase activity and 7.0 for the trehalose synthase activity. Glycan biosynthesis; glycogen biosynthesis. Homohexamer. Cells lacking this gene do not accumulate increased amounts of glycogen in the presence of trehalose and show only a small effect in alpha-glucan (PubMed:20118231, PubMed:27513637). Combined inactivation of treS with glgB or glgC completely blocks alpha-glucan production (PubMed:27513637). Maltose-1-phosphate (M1P), the building block required for alpha-glucan production, is generated by two alternative routes: the TreS-Pep2 branch and the GlgC-GlgM branch, however it seems that the GlgC-GlgM branch provides most of M1P for the GlgE pathway in M.smegmatis. Belongs to the glycosyl hydrolase 13 family. TreS subfamily.