Remove device HW id -> marketing name mapping table for iOS devices.

BUG=webrtc:6907

Review-Url: https://codereview.webrtc.org/2581153002
Cr-Commit-Position: refs/heads/master@{#15656}
This commit is contained in:
kthelgason
2016-12-16 06:17:58 -08:00
committed by Commit bot
parent 617ca316e9
commit b3df385f5c

View File

@ -28,64 +28,6 @@ bool isOperatingSystemAtLeastVersion(double version) {
return GetSystemVersion() >= version; return GetSystemVersion() >= version;
} }
// Internal helper method used by GetDeviceName() to return device name.
const char* LookUpRealName(const char* raw_name) {
// Lookup table which maps raw device names to real (human readable) names.
struct {
const char* raw_name;
const char* real_name;
} device_names[] = {
{"iPhone1,1", "iPhone 1G"},
{"iPhone1,2", "iPhone 3G"},
{"iPhone2,1", "iPhone 3GS"},
{"iPhone3,1", "iPhone 4"},
{"iPhone3,3", "Verizon iPhone 4"},
{"iPhone4,1", "iPhone 4S"},
{"iPhone5,1", "iPhone 5 (GSM)"},
{"iPhone5,2", "iPhone 5 (GSM+CDMA)"},
{"iPhone5,3", "iPhone 5c (GSM)"},
{"iPhone5,4", "iPhone 5c (GSM+CDMA)"},
{"iPhone6,1", "iPhone 5s (GSM)"},
{"iPhone6,2", "iPhone 5s (GSM+CDMA)"},
{"iPhone7,1", "iPhone 6 Plus"},
{"iPhone7,2", "iPhone 6"},
{"iPhone8,1", "iPhone 6s"},
{"iPhone8,2", "iPhone 6s Plus"},
{"iPod1,1", "iPod Touch 1G"},
{"iPod2,1", "iPod Touch 2G"},
{"iPod3,1", "iPod Touch 3G"},
{"iPod4,1", "iPod Touch 4G"},
{"iPod5,1", "iPod Touch 5G"},
{"iPad1,1", "iPad"},
{"iPad2,1", "iPad 2 (WiFi)"},
{"iPad2,2", "iPad 2 (GSM)"},
{"iPad2,3", "iPad 2 (CDMA)"},
{"iPad2,4", "iPad 2 (WiFi)"},
{"iPad2,5", "iPad Mini (WiFi)"},
{"iPad2,6", "iPad Mini (GSM)"},
{"iPad2,7", "iPad Mini (GSM+CDMA)"},
{"iPad3,1", "iPad 3 (WiFi)"},
{"iPad3,2", "iPad 3 (GSM+CDMA)"},
{"iPad3,3", "iPad 3 (GSM)"},
{"iPad3,4", "iPad 4 (WiFi)"},
{"iPad3,5", "iPad 4 (GSM)"},
{"iPad3,6", "iPad 4 (GSM+CDMA)"},
{"iPad4,1", "iPad Air (WiFi)"},
{"iPad4,2", "iPad Air (Cellular)"},
{"iPad4,4", "iPad mini 2G (WiFi)"},
{"iPad4,5", "iPad mini 2G (Cellular)"},
{"i386", "Simulator"},
{"x86_64", "Simulator"},
};
for (auto& d : device_names) {
if (strcmp(d.raw_name, raw_name) == 0)
return d.real_name;
}
LOG(LS_WARNING) << "Failed to find device name (" << raw_name << ")";
return "";
}
NSString* NSStringFromStdString(const std::string& stdString) { NSString* NSStringFromStdString(const std::string& stdString) {
// std::string may contain null termination character so we construct // std::string may contain null termination character so we construct
// using length. // using length.
@ -154,7 +96,7 @@ std::string GetDeviceName() {
std::unique_ptr<char[]> machine; std::unique_ptr<char[]> machine;
machine.reset(new char[size]); machine.reset(new char[size]);
sysctlbyname("hw.machine", machine.get(), &size, NULL, 0); sysctlbyname("hw.machine", machine.get(), &size, NULL, 0);
return std::string(LookUpRealName(machine.get())); return std::string(machine.get());
} }
std::string GetProcessName() { std::string GetProcessName() {