Until a few days ago, the peaceful turned occasionally violent pro-democracy movement by Hong Kong's inhabitants was about securing universal adult suffrage (UAS), official withdrawal of the extradition Bill, and resignation of HK's Chief Executive Officer Carrie Lam. However, when protestors failed to secure a resolution, some of them started waiving foreign nations' flags and singing national anthem, such as of US and UK.
There are conflicting views on the meaning of waving these flags and singing the anthems. They range from secessionist views (complete independence) or rule under a democratic bastion such as UK; diplomatic and political intervention by western democracies for securing HK's autonomy and UAS; while others not supporting a call to an another nation at all. Inkstone has covered these views here.
China has termed the expression of flag waving as foreign intervention in internal affairs with serious repercussion for HK. As I understand, whatever the numeric strength of these flag waivers be and so does their intention for that expression, waiving of a foreign flag and singing anthem and explicitly using signs such as "Liberate Hong Kong" in a political movement is tantamount to professing disloyalty to the State legally in possession of the territory under conflict.
In such a scenario, a state has obligation to protect itself from disloyal citizenry and to quell any movement threatening its territorial integrity. China is known to quell political movements threatening the status quo, the popular of them is the Tiananmen square protests and the massacre that followed, where China dubbed protestors as terrorists and prosecuted them violently.
What bewilders me is why China, being an authoritative State as it has always been, has not destroyed the movement through military intervention in the face of such disturbing acts of disloyalty to it by some protestors?
Chinese media many a times has dubbed these protestors in wholesale as nothing short of terrorists which is rather extreme but indeed fitting from Chinese point of view. So I don't assume China is showing restraint because it believes the majority of protestors do not want complete secession. In fact, authoritative states tend to find one reasonable excuse just to put their boots on the ground.
In addition, the Security Council, the global peacekeeping arm of UN, cannot be a problem for China with the latter being itself a permanent veto-equipped member. Furthermore, with Russia not having good democratic credentials and with UK marred with Brexit issues and a threat to recession with no-Brexit deal it is unlikely a resolution against China could even muster majority in UNSC.