I have consulted Miss Google and found some information that may be useful here:
1. if the entire sentence is stating the speaker's attitude, then the dangling structure may be acceptable.
2.in sentences started with "it" or "there",still, the "attitude" is a core issue.
With these, I checked the seven sentences again. Please correct me if I my thinking wrong.
1 Walking or sleeping, this subject was always on my mind.
>>> It’s hard to say the sentence is stating the writer’s attitude. But it sounds something like it. So it is on the verge of being acceptable.
2 Wiping the sweat from his brow, it seemed to Kunta that his people were always enduring one hardship or another.
>>> The main clause of this sentence begins with a “it”, and furthermore, the entire sentence speaks of the writer’s attitude. So it is acceptable.
3 Born and bred in the countryside, the living style of the country is familiar to him.
>>> Acceptable. The writer’s attitude.
4 Using the electric energy, it is necessary to change its form.
(When using electrical energy，it is necessary to change its form.)
>>> Basically the same as sentence2.
5 Faced with many choices in the cosmetic departments, it is easy to forget that there is a whole science to the manufacturing of them.
>>> Basically the same as sentence2
6 Trying to sit up, the whole room reeled before him.
>>> Incorrect. It’s not an attitude issue
7 Pushed into the house, the door closed with a bang.
>>> Incorrect. The same as sentence6
Many many thaks