"Are packaged candy and treats safe to eat in China? We're going to avoid street food, but can we eat gum/candy/snacks that are packaged? "
Yes, packaged goods are fine. In terms of food safety in the streets, i.e. restaurants, stalls, small stands, etc. our general rule is to stick with establishments that are well-frequented and food is well-cooked, fresh and piping hot. Food at five-star hotel buffets that has been sitting there for a while could go bad, while street food with people lining up ready to take it as it comes out from the flames would be fine. So rather than "avoiding street food" just avoid food that looks doubtful and has been sitting there with no takers!
Here's more on Food Safety
Have a great trip!