[Kindle Fire Themes and Apps] unique311:
Eureka

i think this file has alot to do with

the app not being able to run on any other device but the kindle.

OptimumApplication.class

package com.cablevision.unity.android;

import android.app.Application;

import android.content.*;

import android.content.pm.PackageInfo;

import android.content.pm.PackageManager;

import android.content.res.Configuration;

import android.content.res.Resources;

import android.net.wifi.WifiInfo;

import android.net.wifi.WifiManager;

import android.os.Build;

import android.telephony.TelephonyManager;

import android.util.DisplayMetrics;

import android.util.Log;

import android.view.Display;

import android.view.WindowManager;

import com.cablevision.optimum2.custom.URLStringBuilder;

import com.cablevision.optimum2.domain.ConfigEnvironmentEnum;

import com.cablevision.optimum2.domain.InitialCheckConstants;

import com.cablevision.optimum2.epg.TVGridUtils;

import com.cablevision.optimum2.receiver.NetworkBroadcastReceiver;

import com.cablevision.optimum2.settings.SettingsUtils;

import com.cablevision.optimum2.utility.*;

import com.irdeto.cws.*;

import java.lang.reflect.Method;

public class OptimumApplication extends Application

{

private static OptimumApplication INSTANCE;

public static final String TAG = "OptimumApplication";

public static boolean appRelaunchRestrictionsEnabled = false;

public static int delayDurationForAppRelaunch = 3000;

private NetworkBroadcastReceiver receiver;

public OptimumApplication()

{

receiver = null;

}

private void calculateURLParams()

{

DisplayMetrics displaymetrics;

float f;

String s;

float f1;

String s1;

String s2;

String s3;

String s4;

String s5;

Object obj;

String s6;

String s7;

String s8;

String s9;

if ("http://andusc.iptv.optimum.net/eandroidconfig.jsp".equalsIgnoreCase("http://andusc.iptv.optimum.net/eandroidconfig.jsp"))

Utils.configEnv = ConfigEnvironmentEnum.PROD;

else

if ("http://andusc.iptv.optimum.net/eandroidconfig.jsp".equalsIgnoreCase("http://dev.usc.optimum.net/eandroidconfig.jsp"))

Utils.configEnv = ConfigEnvironmentEnum.DEV;

else

if ("http://andusc.iptv.optimum.net/eandroidconfig.jsp".equalsIgnoreCase("http://qa.usc.optimum.net/androidconfig.xml"))

Utils.configEnv = ConfigEnvironmentEnum.QA;

else

if ("http://andusc.iptv.optimum.net/eandroidconfig.jsp".equalsIgnoreCase("https://stage.usc.iptv.optimum.net/eandroidconfig.jsp"))

Utils.configEnv = ConfigEnvironmentEnum.STG;

Utils.requestURLParams = "";

displaymetrics = getResources().getDisplayMetrics();

f = 160F * displaymetrics.density;

f1 = (float)displaymetrics.widthPixels / f;

f1 = (float)Math.sqrt(Math.pow((float)displaymetrics.heightPixels / f, 2D) + Math.pow(f1, 2D));

s5 = ((TelephonyManager)getSystemService("phone")).getDeviceId();

s = "";

try

{

s = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;

Utils.appVersionVal = s;

}

catch (Exception exception)

{

Logging.i("OptimumApplication", "Exception in package info", exception.getMessage());

}

s1 = android.os.Build.VERSION.RELEASE;

s4 = Build.MODEL;

s2 = Build.BRAND;

s3 = android.os.Build.VERSION.SDK;

obj = android.provider.Settings.Secure.getString(getContentResolver(), "android_id");

if (s5 == null)

{

Logging.i("OptimumApplication", "Imei is null", "Yes");

s5 = ((String) (obj));

} else

{

s5 = s5;

}

OmnitureData.SERIAL_NO = s5;

Utils.deviceDensity = displaymetrics.density;

Utils.deviceHeightInPixels = displaymetrics.heightPixels;

Utils.deviceWidthInPixels = displaymetrics.widthPixels;

s7 = ((WifiManager)getSystemService("wifi")).getConnectionInfo().getMacAddress();

if (Utils.isKindle)

{

s8 = "Kindle";

s9 = "Kindle";

} else

{

s8 = "androidHH";

s9 = "HH";

}

Utils.deviceType = s8;

Log.w("isSTBLINEAR VALUE", (new StringBuilder()).append(Utils.isSTBlinear).toString());

if (Utils.isSTBlinear)

{

s6 = "True";

Log.w("isSTBLINEAR VALUE", (new StringBuilder()).append(Utils.isSTBlinear).toString());

} else

{

s6 = "False";

Log.w("isSTBLINEAR VALUE", (new StringBuilder()).append(Utils.isSTBlinear).toString());

}

obj = new URLStringBuilder();

((URLStringBuilder) (obj)).append("deviceId");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s5);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("version");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("os");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s1);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("deviceType");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s8);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("deviceName");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s4);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("loadType");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s9);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("manufacturer");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s2);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("brand");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s2);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("sdk");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).appendEncode(s3);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("screenWidth");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).append(displaymetrics.widthPixels);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("screenHeight");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).append(displaymetrics.heightPixels);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("screenSize");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).append(f1);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("MacAdress");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).append(s7);

((URLStringBuilder) (obj)).append("&");

((URLStringBuilder) (obj)).append("isSTBLinear");

((URLStringBuilder) (obj)).append("=");

((URLStringBuilder) (obj)).append(s6);

Utils.requestURLParams = ((URLStringBuilder) (obj)).toString();

Logging.i("OptimumApplication", "response url param", Utils.requestURLParams);

}

public static void cleanThisApp()

{

(new VodFileCache(INSTANCE.getApplicationContext())).clear();

android.content.SharedPreferences.Editor editor = INSTANCE.getApplicationContext().getSharedPreferences("optimum_logos", 0).edit();

editor.clear();

editor.commit();

}

public static Application getInstance()

{

return INSTANCE;

}

private String getSerial()

{

Object obj;

try

{

obj = Class.forName("android.os.SystemProperties");

Class aclass[] = new Class[1];

aclass[0] = java/lang/String;

Method method = ((Class) (obj)).getMethod("get", aclass);

aclass = ((Class []) (new Object[1]));

aclass[0] = "ro.serialno";

obj = (String)method.invoke(obj, aclass);

Logging.i("OptimumApplication", "getSerial", ((String) (obj)));

}

catch (Exception _ex)

{

obj = null;

}

return ((String) (obj));

}

public void checkrootdetection()

{

MediaStream.detectRoot(getApplicationContext());

MediaStream.verifyIV(getApplicationContext());

Log.w("ROOT", "NOT A ROOTED DEVICE!!!\n");

_L1:

return;

MediaException mediaexception;

mediaexception;

mediaexception.printStackTrace();

MediaResult mediaresult = mediaexception.getResult();

if (mediaresult == MediaResult.ROOT_DETECTION_FAILED)

{

Utils.isSTBlinear = true;

Log.w("isSTBLINEAR VALUE", (new StringBuilder()).append(Utils.isSTBlinear).toString());

Log.w("ROOT", "Rooting detected on the device!!!\n");

} else

if (mediaresult == MediaResult.DRM_INIT_FAILED)

{

Utils.isSTBlinear = true;

Log.w("isSTBLINEAR VALUE", (new StringBuilder()).append(Utils.isSTBlinear).toString());

InitialCheckConstants.tampered = true;

Log.w("ROOT", "Secure store is being tampered!!!\n");

} else

{

Log.w("ROOT", (new StringBuilder("Operation unsuccessful with rc = ")).append(mediaresult).append("\n").toString());

}

goto _L1

}

public void onCreate()

{

super.onCreate();

INSTANCE = this;

Logging.i("OptimumApplication", "Method[Application Initialization]", "Starting Optimum App");

Utils.networkStatus = DeviceStateUtilities.isNetworkAvailable(getApplicationContext());

DisplayMetrics displaymetrics;

Object obj;

if ((0xf & getResources().getConfiguration().screenLayout) == 3)

Utils.isKindle = true;

else

Utils.isKindle = false;

if (Utils.isKindle)

OptimumConstants.DEVICE_TYPE = "Kindle";

receiver = new NetworkBroadcastReceiver();

registerReceiver(receiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));

registerReceiver(receiver, new IntentFilter("android.intent.action.SCREEN_OFF"));

checkrootdetection();

calculateURLParams();

obj = (WindowManager)getSystemService("window");

displaymetrics = new DisplayMetrics();

((WindowManager) (obj)).getDefaultDisplay().getMetrics(displaymetrics);

TVGridUtils.gWindowWidth = ((WindowManager) (obj)).getDefaultDisplay().getWidth();

TVGridUtils.gWindowHeight = ((WindowManager) (obj)).getDefaultDisplay().getHeight();

TVGridUtils.gScale = displaymetrics.density;

Utils.gScale = displaymetrics.density;

try

{

OmnitureData.APP_VER = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;

}

catch (android.content.pm.PackageManager.NameNotFoundException namenotfoundexception)

{

Logging.e("OptimumApplication", "Method[Application Initialization]", "App Version Name not found", namenotfoundexception);

}

SettingsUtils.initializeContentList();

if (getResources().getString(0x7f0800bd).equalsIgnoreCase("ON"))

appRelaunchRestrictionsEnabled = true;

obj = getResources().getString(0x7f0800c0);

try

{

delayDurationForAppRelaunch = Integer.p****Int(((String) (obj)));

}

catch (Exception exception)

{

Logging.e("OptimumApplication", "Method[Application Initialization]", "Parsing delay duration", exception);

delayDurationForAppRelaunch = 3000;

}

Logging.i("OptimumApplication", "Method[Application Initialization]", (new StringBuilder("Screen Width: ")).append(TVGridUtils.gWindowWidth).append(" Screen Height: ").append(TVGridUtils.gWindowHeight).append(" Density: ").append(displaymetrics.density).toString());

}

public void onTerminate()

{

super.onTerminate();

Logging.i("OptimumApplication", "onTerminate", "Inside");

unregisterReceiver(receiver);

}

}