the Ming dynasty. the emperor and his wife in 13th century
"HONG WU Emperor". but besides that. Having a muslim empror or king is was never required. Muslims won hearts of chinese when Prophet's Uncle led the islamic mission in China. 630 i think or 627 A.D
Chinese not only accepted Muslims and their beliefs many adopted them and hence Hui community came into being. Many modern people think why the name "hui" or hui hui zhao. its because ancient religion on china in which they call the cretor of the universe as ( Lao Tian) meaning Ancient of the heavens. who we call ( Allah) and jews call Him (Adnoi) or YHWH. since chinese discovered that the pricipals of the faith were similar and so true. Islam was given the Name Zhen Zhiao (meaning) true religion. it's God (Allah) is called (Zhen Zhu) meaning True God. Hui zu name hui was selected or givien to chinese people of faith who knew the anceint chinese religion and hence they did'nt have to convert they were just called Reverts . becasue their faith was essentially the same as islam.
Muslims generals. Admirals of navy were very famous . and in some cases some dynasties prefered Muslim and jew soliders as they were more loyal than opposition parties or civilians who could double cross. it was ancient time many chinese empires were fighting among each other. North and north east basically had Muslim rulers or elite even. while south ghuanzhou and its alikes became Islamic centers for knowledge.
Arabs and Muslim faith was very very desirble for that community in that time. just read or google islam in china. there was an emperor of China in ming dynasty who had a muslim wife and then reverted to islam. he also wrote a poem in honor of Prophet (PBUH) i saw that poem pasted on the shenyang capital imperial Palace . it was in chinese spoke of Prophet Mohammad and the true God of the world in great details.
its called Bai zi zan in chinese literature very famous.
https://en.wikipedia.org/wiki/The_Hundred-word_Eulogy <<< this is one link u can read about. Just google it. islam had a Golden age in central asia and china. only later when smaller people and armies started battleing in india and Mongolia then islam lost its spark.
today modern chinese view islam as a foreign religion. because of xinjiang political mess.
in truth Best of the Muslim teachers, scientists , soliders inventors were Chinese and central asians. Islam is deeply routed in chinese society . just because of communism u dont' see people preching islam or Christianity for example communist party of china says only law is chinese comunist party is super power. no one else no religion or political party can ever challenge that. and this party fears Religion can be a very powerful tool to destablize china so they are harsh on religious stuff.
before 1949 it was different. not only for Muslims but for every one in china. but today's communist party is okay i guess they are harsh but a muslim can be a chinese practicing Muslim without fear. only if u endulge in political activities and gathering than no matter Muslim or christian u are going to jail or worse.