13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846
以下内容为反编译后的 MMSDK.java 源代码,内容仅作参考
package com.millennialmedia.android;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.os.Build;
import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.StatFs;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import com.adsdk.sdk.Const;
import com.flurry.org.codehaus.jackson.util.MinimalPrettyPrinter;
import com.millennialmedia.android.AdCache;
import com.millennialmedia.android.Utils;
import com.xbtsol.jynvrt161024.IConstants;
import com.xbtsol.jynvrt161024.IMraid;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.util.Enumeration;
import java.util.Locale;
import java.util.Map;
import org.apache.http.conn.util.InetAddressUtils;
public final class MMSDK {
private static final String BASE_URL_TRACK_EVENT = "http://ads.mp.mydas.mobi/pixel?id=";
static final int CACHE_REQUEST_TIMEOUT = 30000;
static final int CLOSE_ACTIVITY_DURATION = 400;
public static final String DEFAULT_APID = "28911";
public static final String DEFAULT_BANNER_APID = "28913";
public static final String DEFAULT_RECT_APID = "28914";
static final String EMPTY = "";
static final int HANDSHAKE_REQUEST_TIMEOUT = 3000;
static final String JSON_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss ZZZZ";
public static final int LOG_LEVEL_DEBUG = 1;
public static final int LOG_LEVEL_ERROR = 0;
public static final int LOG_LEVEL_INFO = 2;
@Deprecated
public static final int LOG_LEVEL_INTERNAL = 4;
@Deprecated
public static final int LOG_LEVEL_PRIVATE_VERBOSE = 5;
public static final int LOG_LEVEL_VERBOSE = 3;
static final int OPEN_ACTIVITY_DURATION = 600;
static final String PREFS_NAME = "MillennialMediaSettings";
static final int REQUEST_TIMEOUT = 10000;
public static final String SDKLOG = "MillennialMediaSDK";
public static final String VERSION = "5.1.0-13.08.12.a";
@Deprecated
public static boolean debugMode;
private static boolean hasSpeechKit;
private static boolean isBroadcastingEvents;
static int logLevel;
static String macId;
@Deprecated
static boolean disableAdMinRefresh = false;
private static int nextDefaultId = 1897808289;
static String COMMA = ",";
static Handler mainHandler = new Handler(Looper.getMainLooper());
private static String getMMdidValue = null;
private MMSDK() {
}
static {
hasSpeechKit = false;
try {
System.loadLibrary("nmsp_speex");
hasSpeechKit = true;
} catch (UnsatisfiedLinkError e) {
}
}
public static int getDefaultAdId() {
int i;
synchronized (MMSDK.class) {
i = nextDefaultId + 1;
nextDefaultId = i;
}
return i;
}
public static void resetCache(Context context) {
AdCache.resetCache(context);
}
public static void setBroadcastEvents(boolean enable) {
isBroadcastingEvents = enable;
}
public static boolean getBroadcastEvents() {
return isBroadcastingEvents;
}
public static void setLogLevel(int level) {
logLevel = level;
}
public static int getLogLevel() {
return logLevel;
}
public static class Log {
Log() {
}
public static void i(String message) {
android.util.Log.i(MMSDK.SDKLOG, message);
}
static void i(String format, Object... args) {
android.util.Log.i(MMSDK.SDKLOG, String.format(format, args));
}
static void i(Throwable tr) {
i(android.util.Log.getStackTraceString(tr));
}
public static void w(String message) {
android.util.Log.w(MMSDK.SDKLOG, message);
}
static void w(String format, Object... args) {
android.util.Log.w(MMSDK.SDKLOG, String.format(format, args));
}
static void w(Throwable tr) {
w(android.util.Log.getStackTraceString(tr));
}
public static void e(String message) {
android.util.Log.e(MMSDK.SDKLOG, message);
}
public static void e(String format, Object... args) {
android.util.Log.e(MMSDK.SDKLOG, String.format(format, args));
}
public static void e(Throwable tr) {
e(android.util.Log.getStackTraceString(tr));
}
public static void d(String message) {
if (MMSDK.logLevel >= 1) {
android.util.Log.i(MMSDK.SDKLOG, "Diagnostic - " + message);
}
}
public static void d(String format, Object... args) {
if (MMSDK.logLevel >= 1) {
android.util.Log.i(MMSDK.SDKLOG, "Diagnostic - " + String.format(format, args));
}
}
public static void d(Throwable tr) {
if (MMSDK.logLevel >= 1) {
d(android.util.Log.getStackTraceString(tr));
}
}
public static void v(String message) {
if (MMSDK.logLevel >= 3) {
android.util.Log.i(MMSDK.SDKLOG, "Verbose - " + message);
}
}
public static void v(String format, Object... args) {
if (MMSDK.logLevel >= 3) {
android.util.Log.i(MMSDK.SDKLOG, "Verbose - " + String.format(format, args));
}
}
public static void v(Throwable tr) {
if (MMSDK.logLevel >= 3) {
v(android.util.Log.getStackTraceString(tr));
}
}
static void p(String message) {
if (MMSDK.logLevel > 3) {
android.util.Log.i(MMSDK.SDKLOG, "Private - " + message);
}
}
static void p(String format, Object... args) {
if (MMSDK.logLevel > 3) {
android.util.Log.i(MMSDK.SDKLOG, "Private - " + String.format(format, args));
}
}
static void p(Throwable tr) {
if (MMSDK.logLevel > 3) {
p(android.util.Log.getStackTraceString(tr));
}
}
}
public static class Event {
public static final String INTENT_EMAIL = "email";
public static final String INTENT_EXTERNAL_BROWSER = "browser";
public static final String INTENT_MAPS = "geo";
public static final String INTENT_MARKET = "market";
public static final String INTENT_PHONE_CALL = "tel";
public static final String INTENT_STREAMING_VIDEO = "streamingVideo";
public static final String INTENT_TXT_MESSAGE = "sms";
private static final String KEY_ERROR = "error";
static final String KEY_INTENT_TYPE = "intentType";
static final String KEY_INTERNAL_ID = "internalId";
static final String KEY_PACKAGE_NAME = "packageName";
Event() {
}
public static void logEvent(final String logString) {
Log.d("Logging event to: %s", logString);
Utils.ThreadUtils.execute(new Runnable() {
@Override
public void run() {
HttpGetRequest getRequest = new HttpGetRequest();
try {
getRequest.get(logString);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public static void adSingleTap(final MMAdImpl adImpl) {
if (adImpl != null) {
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.onSingleTap(MMAdImpl.this.getCallingAd());
} catch (Exception exception) {
Log.w("Exception raised in your RequestListener: ", exception);
}
}
}
});
if (MMSDK.isBroadcastingEvents) {
sendIntent(adImpl.getContext(), new Intent(MMBroadcastReceiver.ACTION_OVERLAY_TAP), adImpl.internalId);
sendIntent(adImpl.getContext(), new Intent(MMBroadcastReceiver.ACTION_AD_SINGLE_TAP), adImpl.internalId);
}
}
}
public static void intentStarted(Context context, String intentType, long adImplId) {
if (MMSDK.isBroadcastingEvents && intentType != null) {
sendIntent(context, new Intent(MMBroadcastReceiver.ACTION_INTENT_STARTED).putExtra(KEY_INTENT_TYPE, intentType), adImplId);
}
}
public static void fetchStartedCaching(final MMAdImpl adImpl) {
if (adImpl == null) {
Log.w("No Context in the listener: ");
return;
}
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.MMAdRequestIsCaching(MMAdImpl.this.getCallingAd());
} catch (Exception e) {
Log.w("Exception raised in your RequestListener: ", e);
}
}
}
});
if (MMSDK.isBroadcastingEvents) {
sendIntent(adImpl.getContext(), new Intent(MMBroadcastReceiver.ACTION_FETCH_STARTED_CACHING), adImpl.internalId);
}
}
public static void displayStarted(MMAdImpl adImpl) {
if (adImpl != null) {
if (MMSDK.isBroadcastingEvents) {
sendIntent(adImpl.getContext(), new Intent(MMBroadcastReceiver.ACTION_DISPLAY_STARTED), adImpl.internalId);
}
overlayOpened(adImpl);
return;
}
Log.w("No Context in the listener: ");
}
public static void overlayOpened(final MMAdImpl adImpl) {
if (adImpl == null) {
Log.w("No Context in the listener: ");
return;
}
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.MMAdOverlayLaunched(MMAdImpl.this.getCallingAd());
} catch (Exception exception) {
Log.w("Exception raised in your RequestListener: ", exception);
}
}
}
});
overlayOpenedBroadCast(adImpl.getContext(), adImpl.internalId);
}
public static void overlayOpenedBroadCast(Context context, long adImplId) {
if (MMSDK.isBroadcastingEvents) {
sendIntent(context, new Intent(MMBroadcastReceiver.ACTION_OVERLAY_OPENED), adImplId);
}
}
public static void overlayClosed(final MMAdImpl adImpl) {
if (adImpl == null) {
Log.w("No Context in the listener: ");
return;
}
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.MMAdOverlayClosed(MMAdImpl.this.getCallingAd());
} catch (Exception exception) {
Log.w("Exception raised in your RequestListener: ", exception);
}
}
}
});
if (MMSDK.isBroadcastingEvents && adImpl.getContext() != null) {
sendIntent(adImpl.getContext(), new Intent(MMBroadcastReceiver.ACTION_OVERLAY_CLOSED), adImpl.internalId);
}
}
public static void requestCompleted(final MMAdImpl adImpl) {
if (adImpl == null) {
Log.w("No Context in the listener: ");
return;
}
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.requestCompleted(MMAdImpl.this.getCallingAd());
} catch (Exception exception) {
Log.w("Exception raised in your RequestListener: ", exception);
}
}
}
});
if (MMSDK.isBroadcastingEvents) {
String action = adImpl.getRequestCompletedAction();
sendIntent(adImpl.getContext(), new Intent(action), adImpl.internalId);
}
}
public static void requestFailed(final MMAdImpl adImpl, final MMException error) {
if (adImpl == null) {
Log.w("No Context in the listener: ");
return;
}
MMSDK.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MMAdImpl.this != null && MMAdImpl.this.requestListener != null) {
try {
MMAdImpl.this.requestListener.requestFailed(MMAdImpl.this.getCallingAd(), error);
} catch (Exception exception) {
Log.w("Exception raised in your RequestListener: ", exception);
}
}
}
});
if (MMSDK.isBroadcastingEvents) {
String action = adImpl.getRequestFailedAction();
sendIntent(adImpl.getContext(), new Intent(action).putExtra("error", error), adImpl.internalId);
}
}
private static final void sendIntent(Context context, Intent intent, long adImplId) {
String type;
if (context != null) {
intent.addCategory(MMBroadcastReceiver.CATEGORY_SDK);
if (adImplId != -4) {
intent.putExtra(KEY_INTERNAL_ID, adImplId);
}
intent.putExtra("packageName", context.getPackageName());
String type2 = intent.getStringExtra(KEY_INTENT_TYPE);
if (!TextUtils.isEmpty(type2)) {
type = String.format(" Type[%s]", type2);
} else {
type = MMSDK.EMPTY;
}
Log.v(" @@ Intent: " + intent.getAction() + MinimalPrettyPrinter.DEFAULT_ROOT_VALUE_SEPARATOR + type + " for " + adImplId);
context.sendBroadcast(intent);
}
}
}
public static void runOnUiThread(Runnable action) {
if (isUiThread()) {
action.run();
} else {
mainHandler.post(action);
}
}
public static void runOnUiThreadDelayed(Runnable action, long delayMillis) {
mainHandler.postDelayed(action, delayMillis);
}
public static boolean isUiThread() {
return mainHandler.getLooper() == Looper.myLooper();
}
public static boolean isConnected(Context context) {
boolean z = true;
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return false;
}
if (connectivityManager.getActiveNetworkInfo() == null || !connectivityManager.getActiveNetworkInfo().isConnected()) {
z = false;
}
return z;
}
static String getIpAddress(Context context) {
try {
StringBuilder ips = new StringBuilder();
Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces();
while (en.hasMoreElements()) {
NetworkInterface intf = en.nextElement();
Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses();
while (enumIpAddr.hasMoreElements()) {
InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress()) {
if (ips.length() > 0) {
ips.append(',');
}
String inetAddressHost = inetAddress.getHostAddress().toUpperCase();
boolean isIPv4 = InetAddressUtils.isIPv4Address(inetAddressHost);
if (isIPv4) {
ips.append(inetAddressHost);
} else {
int delim = inetAddressHost.indexOf(37);
String noInterfaceNameAddress = delim < 0 ? inetAddressHost : inetAddressHost.substring(0, delim);
ips.append(noInterfaceNameAddress);
}
}
}
}
return ips.toString();
} catch (Exception ex) {
Log.e(ex);
return EMPTY;
}
}
public static String getConnectionType(Context context) {
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager == null) {
return "unknown";
}
if (connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnected()) {
int type = connectivityManager.getActiveNetworkInfo().getType();
int subType = connectivityManager.getActiveNetworkInfo().getSubtype();
if (type == 1) {
return "wifi";
}
if (type == 0) {
switch (subType) {
case 1:
return "gprs";
case 2:
return "edge";
case 3:
return "umts";
case 4:
return "cdma";
case 5:
return "evdo_0";
case 6:
return "evdo_a";
case 7:
return "1xrtt";
case 8:
return "hsdpa";
case 9:
return "hsupa";
case 10:
return "hspa";
case 11:
return "iden";
case 12:
return "evdo_b";
case 13:
return "lte";
case 14:
return "ehrpd";
case 15:
return "hspap";
default:
return "unknown";
}
}
return "unknown";
}
return "offline";
}
public static synchronized String getMMdid(Context context) {
String str = null;
synchronized (MMSDK.class) {
if (getMMdidValue != null) {
str = getMMdidValue;
} else {
String mmdid = Settings.Secure.getString(context.getContentResolver(), IConstants.ANDROID_ID);
if (mmdid != null) {
StringBuilder mmdidBuilder = new StringBuilder("mmh_");
try {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] hashBytes = md.digest(mmdid.getBytes());
mmdidBuilder.append(byteArrayToString(hashBytes));
mmdidBuilder.append("_");
MessageDigest md2 = MessageDigest.getInstance("SHA1");
byte[] hashBytes2 = md2.digest(mmdid.getBytes());
mmdidBuilder.append(byteArrayToString(hashBytes2));
str = mmdidBuilder.toString();
getMMdidValue = str;
} catch (Exception e) {
Log.v(e.getMessage());
}
}
}
}
return str;
}
public static synchronized void setMMdid(String value) {
synchronized (MMSDK.class) {
getMMdidValue = value;
}
}
public static String byteArrayToString(byte[] ba) {
StringBuilder hex = new StringBuilder(ba.length * 2);
for (int i = 0; i < ba.length; i++) {
hex.append(String.format("%02X", Byte.valueOf(ba[i])));
}
return hex.toString();
}
private static String getDensityString(Context context) {
float density = getDensity(context);
return Float.toString(density);
}
public static float getDensity(Context context) {
DisplayMetrics metrics = getMetrics(context);
if (metrics == null) {
return 1.0f;
}
return metrics.density;
}
public static void checkPermissions(Context context) {
if (context.checkCallingOrSelfPermission("android.permission.INTERNET") == -1) {
createMissingPermissionDialog(context, "INTERNET permission").show();
}
if (context.checkCallingOrSelfPermission("android.permission.ACCESS_NETWORK_STATE") == -1) {
createMissingPermissionDialog(context, "ACCESS_NETWORK_STATE permission").show();
}
}
private static AlertDialog createMissingPermissionDialog(Context context, String permission) {
AlertDialog dialog = new AlertDialog.Builder(context).create();
dialog.setTitle("Whoops!");
dialog.setMessage(String.format("The developer has forgot to declare the %s in the manifest file. Please reach out to the developer to remove this error.", permission));
dialog.setButton(-3, "OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog2, int which) {
dialog2.cancel();
}
});
dialog.show();
return dialog;
}
public static void checkActivity(Context context) {
PackageManager pm = context.getPackageManager();
try {
ComponentName cn = new ComponentName(context, "com.millennialmedia.android.MMActivity");
pm.getActivityInfo(cn, 128);
} catch (PackageManager.NameNotFoundException e) {
Log.e("Activity MMActivity not declared in AndroidManifest.xml");
e.printStackTrace();
createMissingPermissionDialog(context, "MMActivity class").show();
}
}
static boolean isCachedVideoSupportedOnDevice(Context context) {
return context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") != -1 && (!Build.VERSION.SDK.equalsIgnoreCase("8") || (Environment.getExternalStorageState().equals("mounted") && AdCache.isExternalEnabled));
}
static String getMcc(Context context) {
String networkOperator;
Configuration config = getConfiguration(context);
return (config.mcc != 0 || (networkOperator = getNetworkOperator(context)) == null || networkOperator.length() < 6) ? String.valueOf(config.mcc) : networkOperator.substring(0, 3);
}
static String getMnc(Context context) {
String networkOperator;
Configuration config = getConfiguration(context);
return (config.mnc != 0 || (networkOperator = getNetworkOperator(context)) == null || networkOperator.length() < 6) ? String.valueOf(config.mnc) : networkOperator.substring(3);
}
static Configuration getConfiguration(Context context) {
return context.getResources().getConfiguration();
}
static String getNetworkOperator(Context context) {
TelephonyManager tel = (TelephonyManager) context.getSystemService("phone");
return tel.getNetworkOperator();
}
public static void insertUrlCommonValues(Context context, Map<String, String> paramsMap) {
StatFs stat;
paramsMap.put("density", getDensityString(context));
paramsMap.put("hpx", getDpiHeight(context));
paramsMap.put("wpx", getDpiWidth(context));
paramsMap.put("sk", hasSpeechKit(context));
paramsMap.put("mic", hasVoiceAbility(context));
if (isCachedVideoSupportedOnDevice(context)) {
paramsMap.put("cachedvideo", "true");
} else {
paramsMap.put("cachedvideo", "false");
}
if (Build.MODEL != null) {
paramsMap.put("dm", Build.MODEL);
}
if (Build.VERSION.RELEASE != null) {
paramsMap.put("dv", "Android" + Build.VERSION.RELEASE);
}
String mmdid = getMMdid(context);
if (mmdid != null) {
paramsMap.put("mmdid", mmdid);
}
paramsMap.put(IConstants.SDK_VERSION, VERSION);
paramsMap.put("mmisdk", VERSION);
paramsMap.put("mcc", getMcc(context));
paramsMap.put("mnc", getMnc(context));
Locale locale = Locale.getDefault();
if (locale != null) {
paramsMap.put(IConstants.LANGUAGE, locale.getLanguage());
paramsMap.put(IConstants.COUNTRY, locale.getCountry());
}
try {
String pkid = context.getPackageName();
paramsMap.put("pkid", pkid);
PackageManager pm = context.getPackageManager();
ApplicationInfo ai = pm.getApplicationInfo(pkid, 0);
paramsMap.put("pknm", pm.getApplicationLabel(ai).toString());
} catch (Exception e) {
}
if (debugMode) {
paramsMap.put("debug", "true");
}
String schemes = HandShake.sharedHandShake(context).getSchemesList(context);
if (schemes != null) {
paramsMap.put("appsids", schemes);
}
String vid = AdCache.getCachedVideoList(context);
if (vid != null) {
paramsMap.put("vid", vid);
}
try {
String connectionType = getConnectionType(context);
if (AdCache.isExternalStorageAvailable(context)) {
stat = new StatFs(AdCache.getCacheDirectory(context).getAbsolutePath());
} else {
stat = new StatFs(context.getFilesDir().getPath());
}
String freeSpace = Long.toString(stat.getAvailableBlocks() * stat.getBlockSize());
String devicePluggedIn = null;
String deviceBatteryLevel = null;
Intent intent = context.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED"));
if (intent != null) {
devicePluggedIn = intent.getIntExtra("plugged", 0) == 0 ? "false" : "true";
int scale = intent.getIntExtra("scale", 100);
float ratio = 100.0f / scale;
int level = (int) (intent.getIntExtra("level", 0) * ratio);
deviceBatteryLevel = Integer.toString(level);
}
if (deviceBatteryLevel != null && deviceBatteryLevel.length() > 0) {
paramsMap.put("bl", deviceBatteryLevel);
}
if (devicePluggedIn != null && devicePluggedIn.length() > 0) {
paramsMap.put("plugged", devicePluggedIn);
}
if (freeSpace.length() > 0) {
paramsMap.put("space", freeSpace);
}
if (connectionType != null) {
paramsMap.put("conn", connectionType);
}
String ip = URLEncoder.encode(getIpAddress(context), Const.ENCODING);
if (!TextUtils.isEmpty(ip)) {
paramsMap.put("pip", ip);
}
} catch (Exception e2) {
Log.v(e2);
}
MMRequest.insertLocation(paramsMap);
}
public static String getDpiWidth(Context context) {
if (needsRawDisplayMethod()) {
String width = getRawSize(context, "getRawWidth");
if (!TextUtils.isEmpty(width)) {
return width;
}
}
DisplayMetrics metrics = getMetrics(context);
return getDpiWidthFrom(metrics);
}
public static DisplayMetrics getMetrics(Context context) {
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
if (needsRealDisplayMethod()) {
try {
Method getRealMetrics = Display.class.getMethod("getRealMetrics", new Class[0]);
getRealMetrics.invoke(metrics, new Object[0]);
} catch (Exception e) {
}
}
return metrics;
}
public static String getDpiHeight(Context context) {
if (needsRawDisplayMethod()) {
String height = getRawSize(context, "getRawHeight");
if (!TextUtils.isEmpty(height)) {
return height;
}
}
DisplayMetrics metrics = getMetrics(context);
return getDpiHeightFrom(metrics);
}
private static String getRawSize(Context context, String functionName) {
if (!(context instanceof Activity)) {
return null;
}
Activity activity = (Activity) context;
Display display = activity.getWindowManager().getDefaultDisplay();
try {
Method mGetRawSize = Display.class.getMethod(functionName, new Class[0]);
int rawSize = ((Integer) mGetRawSize.invoke(display, new Object[0])).intValue();
String size = String.valueOf(rawSize);
return size;
} catch (Exception e) {
return null;
}
}
private static boolean needsRawDisplayMethod() {
return Integer.parseInt(Build.VERSION.SDK) >= 13 && Integer.parseInt(Build.VERSION.SDK) <= 16;
}
private static boolean needsRealDisplayMethod() {
return Integer.parseInt(Build.VERSION.SDK) >= 17;
}
private static String getDpiHeightFrom(DisplayMetrics metrics) {
return Integer.toString(metrics.heightPixels);
}
private static String getDpiWidthFrom(DisplayMetrics metrics) {
return Integer.toString(metrics.widthPixels);
}
public static void trackEvent(Context context, String eventId) {
if (!TextUtils.isEmpty(eventId)) {
String mmdid = getMMdid(context);
if (!TextUtils.isEmpty(mmdid)) {
String trackEventUrl = BASE_URL_TRACK_EVENT + eventId + "&mmdid=" + mmdid;
Utils.HttpUtils.executeUrl(trackEventUrl);
}
}
}
public static void trackConversion(Context context, String goalId) {
MMConversionTracker.trackConversion(context, goalId, null);
}
public static void trackConversion(Context context, String goalId, MMRequest request) {
MMConversionTracker.trackConversion(context, goalId, request);
}
private static String hasSpeechKit(Context context) {
return hasSpeechKit ? "true" : "false";
}
public static void initialize(Context context) {
HandShake handShake = HandShake.sharedHandShake(context);
handShake.sendInitRequest();
handShake.startSession();
}
public static String hasVoiceAbility(Context context) {
if (!context.getPackageManager().hasSystemFeature("android.hardware.microphone") || getMediaVolume(context) == 0) {
return "false";
}
AudioManager am = (AudioManager) context.getApplicationContext().getSystemService("audio");
int ringermode = am.getRingerMode();
if (ringermode == 0 || ringermode == 1) {
return "false";
}
return "true";
}
public static int getMediaVolume(Context context) {
AudioManager am = (AudioManager) context.getApplicationContext().getSystemService("audio");
return am.getStreamVolume(3);
}
public static void printDiagnostics(MMAdImpl adImpl) {
if (adImpl != null) {
final Context context = adImpl.getContext();
Log.i("MMAd External ID: %d", Integer.valueOf(adImpl.getId()));
Log.i("MMAd Internal ID: %d", Long.valueOf(adImpl.internalId));
Log.i("APID: %s", adImpl.apid);
Object[] objArr = new Object[1];
objArr[0] = AdCache.isExternalStorageAvailable(context) ? EMPTY : "not ";
Log.i("SD card is %savailable.", objArr);
if (context != null) {
Log.i("Package: %s", context.getPackageName());
Log.i("MMDID: %s", getMMdid(context));
Log.i("Permissions:");
Object[] objArr2 = new Object[1];
objArr2[0] = context.checkCallingOrSelfPermission("android.permission.ACCESS_NETWORK_STATE") == -1 ? "not " : EMPTY;
Log.i("android.permission.ACCESS_NETWORK_STATE is %spresent", objArr2);
Object[] objArr3 = new Object[1];
objArr3[0] = context.checkCallingOrSelfPermission("android.permission.INTERNET") == -1 ? "not " : EMPTY;
Log.i("android.permission.INTERNET is %spresent", objArr3);
Object[] objArr4 = new Object[1];
objArr4[0] = context.checkCallingOrSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == -1 ? "not " : EMPTY;
Log.i("android.permission.WRITE_EXTERNAL_STORAGE is %spresent", objArr4);
Object[] objArr5 = new Object[1];
objArr5[0] = context.checkCallingOrSelfPermission("android.permission.VIBRATE") == -1 ? "not " : EMPTY;
Log.i("android.permission.VIBRATE is %spresent", objArr5);
Object[] objArr6 = new Object[1];
objArr6[0] = context.checkCallingOrSelfPermission("android.permission.ACCESS_COARSE_LOCATION") == -1 ? "not " : EMPTY;
Log.i("android.permission.ACCESS_COARSE_LOCATION is %spresent", objArr6);
Object[] objArr7 = new Object[1];
objArr7[0] = context.checkCallingOrSelfPermission("android.permission.ACCESS_FINE_LOCATION") == -1 ? "not " : EMPTY;
Log.i("android.permission.ACCESS_FINE_LOCATION is %spresent", objArr7);
Log.i("Cached Ads:");
AdCache.iterateCachedAds(context, 2, new AdCache.Iterator() {
@Override
boolean callback(CachedAd ad) {
Object[] objArr8 = new Object[4];
objArr8[0] = ad.getTypeString();
objArr8[1] = ad.getId();
objArr8[2] = ad.isOnDisk(context) ? MMSDK.EMPTY : "not ";
objArr8[3] = ad.isExpired() ? MMSDK.EMPTY : "not ";
Log.i("%s %s is %son disk. Is %sexpired.", objArr8);
return true;
}
});
}
}
}
public static String getSupportsSms(Context context) {
PackageManager pm = context.getPackageManager();
return String.valueOf(pm.hasSystemFeature("android.hardware.telephony"));
}
public static String getSupportsTel(Context context) {
PackageManager pm = context.getPackageManager();
return String.valueOf(pm.hasSystemFeature("android.hardware.telephony"));
}
public static String getOrientation(Context context) {
switch (context.getResources().getConfiguration().orientation) {
case 1:
return IMraid.ORIENTATION_PORTRAIT;
case 2:
return IMraid.ORIENTATION_LANDSCAPE;
case 3:
return "square";
default:
return IMraid.STATE_DEFAULT;
}
}
public static final String getOrientationLocked(Context context) {
return Settings.System.getString(context.getContentResolver(), "accelerometer_rotation").equals("1") ? "false" : "true";
}
static boolean removeAccelForJira1164() {
return Integer.parseInt(Build.VERSION.SDK) >= 14;
}
public static boolean hasSetTranslationMethod() {
return Integer.parseInt(Build.VERSION.SDK) >= 11;
}
static boolean supportsFullScreenInline() {
return Integer.parseInt(Build.VERSION.SDK) >= 11;
}
}