// Path: sdk/src/com/sharethis/loopy/sdk/util/AppUtils.java
// public class AppUtils {
// 
//     static final AppUtils instance = new AppUtils();
// 
//     AppUtils() {}
// 
//     public static AppUtils getInstance() {
//         return instance;
//     }
// 
//     /**
//      * Determines inclusive permissions.
//      * @param context The current context.
//      * @param permissions The permissions sought.
//      * @return Returns true iff the app has ALL the given permissions.
//      */
//     public boolean hasAndPermission(Context context, String...permissions) {
//         for (String permission : permissions) {
//             int res = context.checkCallingOrSelfPermission(permission);
//             if(res != PackageManager.PERMISSION_GRANTED) {
//                 return false;
//             }
//         }
//         return true;
//     }
// 
//     /**
//      * Determines exclusive permissions.
//      * @param context The current context.
//      * @param permissions The permissions sought.
//      * @return Returns true iff the app has ANY the given permissions.
//      */
//     public boolean hasOrPermission(Context context, String...permissions) {
//         for (String permission : permissions) {
//             int res = context.checkCallingOrSelfPermission(permission);
//             if(res == PackageManager.PERMISSION_GRANTED) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     /**
//      * Returns the app info for the apps which support the ACTION_SEND intent with the given types.
//      * @param context The current context.
//      * @param contentTypes The content types supported.
//      * @return A Collection (set) of ResolveInfo objects corresponding to the apps installed on the device that
//      *          support the content type(s).
//      */
//     public Collection<ResolveInfo> getAppsForContentType(Context context, String...contentTypes) {
//         Set<ResolveInfo> apps = new LinkedHashSet<ResolveInfo>();
//         for (String type : contentTypes) {
//             List<ResolveInfo> appsByType = listAppsForType(context, type);
//             if(appsByType != null && appsByType.size() > 0) {
//                 apps.addAll(appsByType);
//             }
//         }
//         return apps;
//     }
// 
//     List<ResolveInfo> listAppsForType(Context context, String type) {
//         Intent intent = getSendIntent();
//         intent.setType(type);
// 
//         PackageManager p = context.getPackageManager();
// 
//         List<ResolveInfo> appList = p.queryIntentActivities(intent, 0);
// 
//         // Sort alphabetically.
//         Collections.sort(appList, new android.content.pm.ResolveInfo.DisplayNameComparator(p));
// 
//         return appList;
//     }
// 
//     // mockable
//     Intent getSendIntent() {
//         return new Intent(Intent.ACTION_SEND);
//     }
// 
// }
// 
// Path: sdk/src/com/sharethis/loopy/sdk/util/MD5Util.java
// public class MD5Util {
// 
//     public static String hash(String s) throws NoSuchAlgorithmException {
//         MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
//         digest.update(s.getBytes());
//         byte messageDigest[] = digest.digest();
//         StringBuilder hexString = new StringBuilder();
//         for (byte aMessageDigest : messageDigest) {
//             hexString.append(Integer.toHexString(0xFF & aMessageDigest));
//         }
//         return hexString.toString();
//     }
// }


import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.sharethis.loopy.sdk.util.AppUtils;
import com.sharethis.loopy.sdk.util.MD5Util;
import java.security.NoSuchAlgorithmException;
package com.sharethis.loopy.sdk;



/**
 * @author Jason Polites
 */
public class Device {

	private String modelName;
	private String androidVersion;
	private String androidId;
    private String md5Id;

    private String carrier;
    private boolean initialized = false;

    private final WifiState wifiState = new WifiState();

    Device onCreate(Context context) {
		modelName = android.os.Build.MODEL;
		androidVersion = String.valueOf(Build.VERSION.SDK_INT);
		androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

        try {
// Path: sdk/src/com/sharethis/loopy/sdk/util/AppUtils.java
// public class AppUtils {
// 
//     static final AppUtils instance = new AppUtils();
// 
//     AppUtils() {}
// 
//     public static AppUtils getInstance() {
//         return instance;
//     }
// 
//     /**
//      * Determines inclusive permissions.
//      * @param context The current context.
//      * @param permissions The permissions sought.
//      * @return Returns true iff the app has ALL the given permissions.
//      */
//     public boolean hasAndPermission(Context context, String...permissions) {
//         for (String permission : permissions) {
//             int res = context.checkCallingOrSelfPermission(permission);
//             if(res != PackageManager.PERMISSION_GRANTED) {
//                 return false;
//             }
//         }
//         return true;
//     }
// 
//     /**
//      * Determines exclusive permissions.
//      * @param context The current context.
//      * @param permissions The permissions sought.
//      * @return Returns true iff the app has ANY the given permissions.
//      */
//     public boolean hasOrPermission(Context context, String...permissions) {
//         for (String permission : permissions) {
//             int res = context.checkCallingOrSelfPermission(permission);
//             if(res == PackageManager.PERMISSION_GRANTED) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
//     /**
//      * Returns the app info for the apps which support the ACTION_SEND intent with the given types.
//      * @param context The current context.
//      * @param contentTypes The content types supported.
//      * @return A Collection (set) of ResolveInfo objects corresponding to the apps installed on the device that
//      *          support the content type(s).
//      */
//     public Collection<ResolveInfo> getAppsForContentType(Context context, String...contentTypes) {
//         Set<ResolveInfo> apps = new LinkedHashSet<ResolveInfo>();
//         for (String type : contentTypes) {
//             List<ResolveInfo> appsByType = listAppsForType(context, type);
//             if(appsByType != null && appsByType.size() > 0) {
//                 apps.addAll(appsByType);
//             }
//         }
//         return apps;
//     }
// 
//     List<ResolveInfo> listAppsForType(Context context, String type) {
//         Intent intent = getSendIntent();
//         intent.setType(type);
// 
//         PackageManager p = context.getPackageManager();
// 
//         List<ResolveInfo> appList = p.queryIntentActivities(intent, 0);
// 
//         // Sort alphabetically.
//         Collections.sort(appList, new android.content.pm.ResolveInfo.DisplayNameComparator(p));
// 
//         return appList;
//     }
// 
//     // mockable
//     Intent getSendIntent() {
//         return new Intent(Intent.ACTION_SEND);
//     }
// 
// }
// 
// Path: sdk/src/com/sharethis/loopy/sdk/util/MD5Util.java
// public class MD5Util {
// 
//     public static String hash(String s) throws NoSuchAlgorithmException {
//         MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
//         digest.update(s.getBytes());
//         byte messageDigest[] = digest.digest();
//         StringBuilder hexString = new StringBuilder();
//         for (byte aMessageDigest : messageDigest) {
//             hexString.append(Integer.toHexString(0xFF & aMessageDigest));
//         }
//         return hexString.toString();
//     }
// }


// Path: sdk/src/com/sharethis/loopy/sdk/Device.java
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.provider.Settings;
import android.telephony.TelephonyManager;
import com.sharethis.loopy.sdk.util.AppUtils;
import com.sharethis.loopy.sdk.util.MD5Util;
import java.security.NoSuchAlgorithmException;

package com.sharethis.loopy.sdk;



/**
 * @author Jason Polites
 */
public class Device {

	private String modelName;
	private String androidVersion;
	private String androidId;
    private String md5Id;

    private String carrier;
    private boolean initialized = false;

    private final WifiState wifiState = new WifiState();

    Device onCreate(Context context) {
		modelName = android.os.Build.MODEL;
		androidVersion = String.valueOf(Build.VERSION.SDK_INT);
		androidId = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

        try {
            md5Id = MD5Util.hash(androidId);