Improve conversion of constants in lowercase.

Bug: issue 8968
Bug: issue 8969
Change-Id: I81a518f7b0906aefec2c6826210a1fe0588edb5d
(cherry picked from commit 820b1b0273e3e2c31e39c83382fa79cd9e5b062a)