framework: fix screenshot and rotation animation

for devices with abnormal hw rotation (e.g. hwrotation=270 or 90)

port forward from:
https://github.com/CyanogenMod/android_frameworks_base/commit/ac555b9ca9a76d13a26fc9ea40980fe57258761b#diff-d6f7bba268a742c91252cc9e64e2381a

Change-Id: I8dd0568c9261466178c737975a418321c3c634d1
Merge "framework: fix screenshot and rotation animation" into android-4.4