optimize ScreenMetrics and TouchDeviceParser