package com.meizu.cloud.pushsdk.b; import android.content.Context; import android.os.Build; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.meizu.cloud.pushinternal.DebugLogger; import com.meizu.cloud.pushsdk.b.b.a; import com.meizu.cloud.pushsdk.b.b.d; import com.xiaomi.mipush.sdk.Constants; public class c { private static String a = ""; public static String a(Context context) { if (!TextUtils.isEmpty(a)) { return a; } a = !a() ? d(context) : b(context); return a; } public static boolean a() { String a2 = i.a("ro.target.product"); if (!TextUtils.isEmpty(a2)) { DebugLogger.i("DeviceUtils", "current product is " + a2); return false; } DebugLogger.i("DeviceUtils", "current product is phone"); return true; } public static String b(Context context) { try { d a2 = a.a("android.telephony.MzTelephonyManager").a("getDeviceId", new Class[0]).a(new Object[0]); if (a2.a && !TextUtils.isEmpty(a2.b)) { return a2.b; } TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone"); if (telephonyManager != null) { return telephonyManager.getDeviceId(); } return null; } catch (Exception e) { e.printStackTrace(); return null; } } public static String c(Context context) { return null; } private static String d(Context context) { StringBuilder sb = new StringBuilder(); String str = Build.SERIAL; DebugLogger.i("DeviceUtils", "device serial " + str); if (!TextUtils.isEmpty(str)) { sb.append(str); String c = c(context); DebugLogger.e("DeviceUtils", "mac address " + c); if (!TextUtils.isEmpty(c)) { sb.append(c.replace(Constants.COLON_SEPARATOR, "").toUpperCase()); return sb.toString(); } } return null; } }