Foldable rotation settings: persist postures instead of device states

Device state ids can change, and therefore shouldn't be persisted. We
define our custom ids for device postures, which will not change.

1. We define our custom posture ids in Settings.Secure. These match
   the current device state ids. This way we don't have to wipe users'
   settings.
2. We convert device ids to postures, based on the config arrays
   "config_foldedDeviceStates", "config_halfFoldedDeviceStates", and
   "config_openDeviceStates".

Test: unit tests
Test: manually by trying the different auto-rotation scenarios in
      different postures.
Fixes: 261968395
Change-Id: I396e9c92230e75e186b6a70198ee16b41e508a1e
7 files changed