All of PKD's stuff has "sad" endings - or I think so anyway. Some of his short stories (I have several volumes) make me simply howl and sob every time I read them. I find that when I'm in "that sort of mood" for a bit of a weep or melancholy, they're great, but not so much if I want cheering up! He suffered from depression more or less throughout his life, and did eventually commit suicide irrc, and it is pretty damn obvious from his work that he had a bloody BIG "Black Dog" bless him.
Well, it has never occurred to me to howl and sob when reading Dick's books but he does tend to portray bleak futures.
In this book, life has pretty much all dead (plants and animals are rare) and love and any other real emotion is on the way out, too. Androids are psychopaths and humans have a machine controlling their moods. So yes, it is not a happy premise. Then again, I can't think of a good book about the future that has a happy premise - it seems that the present is never all that perfect and we have an inherent distrust of books who present the future in a pleasant light
Philip K Dick likes playing with themes of what is real/what is not and the irony of humans hunting replicants who mimic emotion while mimicking emotions themselves serves this purpose of questioning what "human" means, imho.
Dick was also a notorious fan of various recreational chemicals, so the idea of controlling one's mood artificially would be very familiar to him. (At the end of A Scanner Darkly, he lists all his friends who have died early or had permanent organ damage because of drug use. His name is on the list, too)