In this agreement , China promised that , under its " one country , two systems " formula , China 's socialist economic system would not be imposed on Hong Kong and that Hong Kong would enjoy a high degree of autonomy in all matters except foreign and defense affairs for the next 50 years .