Skip to content

Instantly share code, notes, and snippets.

@alximw
Last active October 28, 2019 13:36
Show Gist options
  • Save alximw/2f8f839968b9c8f9486ccb0dbae17617 to your computer and use it in GitHub Desktop.
Save alximw/2f8f839968b9c8f9486ccb0dbae17617 to your computer and use it in GitHub Desktop.

Revisions

  1. alximw revised this gist Oct 28, 2019. No changes.
  2. alximw created this gist Oct 28, 2019.
    180 changes: 180 additions & 0 deletions InfoGathering.java
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,180 @@
    package safiap.framework.sdk.b;

    import android.content.Context;
    import android.content.SharedPreferences.Editor;
    import android.net.wifi.WifiInfo;
    import android.net.wifi.WifiManager;
    import android.os.Build.VERSION;
    import android.os.Build;
    import android.telephony.TelephonyManager;
    import android.text.TextUtils;
    import safiap.framework.util.MyLogger;

    public final class c {
    private static MyLogger a = null;
    private static final String b = "saf_framework";
    private static final String c = "imei";
    private static final String d = "mac";
    private String e;
    private static String f;
    private static String g;
    private static String h;
    private Context i;
    private TelephonyManager j;

    static {
    c.a = MyLogger.getLogger("DeviceInfo");
    c.f = Build.MANUFACTURER;
    c.g = Build.MODEL;
    c.h = Build.VERSION.RELEASE;
    }

    public c(Context arg3) {
    if(arg3 == null) {
    c.a.v("Incoming Context is null!");
    }
    else {
    this.i = arg3;
    this.j = (TelephonyManager)this.i.getSystemService("phone");
    }
    }

    private boolean a(String arg4) {
    boolean v0 = false;
    if(arg4 != null && arg4.length() == 15) {
    SharedPreferences.Editor v0_1 = this.i.getSharedPreferences("saf_framework", 0).edit();
    v0_1.putString("imei", arg4);
    v0 = v0_1.commit();
    }

    return v0;
    }

    public final String a() {
    String v0 = this.i.getSharedPreferences("saf_framework", 0).getString("imei", "");
    if(TextUtils.isEmpty(v0)) {
    v0 = null;
    if(this.j != null) {
    v0 = this.j.getDeviceId();
    }

    c.a.d("IMEI=" + v0);
    if(v0 != null && v0.length() == 15) {
    SharedPreferences.Editor v1 = this.i.getSharedPreferences("saf_framework", 0).edit();
    v1.putString("imei", v0);
    v1.commit();
    }
    }

    return v0;
    }

    private boolean b(String arg4) {
    boolean v0 = false;
    if(arg4 != null && arg4.length() == 12) {
    SharedPreferences.Editor v0_1 = this.i.getSharedPreferences("saf_framework", 0).edit();
    v0_1.putString("mac", arg4);
    v0 = v0_1.commit();
    }

    return v0;
    }

    public final String b() {
    String v0;
    if(TextUtils.isEmpty(this.e)) {
    if(this.j != null) {
    this.e = this.j.getSubscriberId();
    }

    c.a.d("mIMSINumber get from card = " + this.e);
    v0 = this.e;
    }
    else {
    v0 = this.e;
    }

    return v0;
    }

    public final String c() {
    String v0 = this.i.getSharedPreferences("saf_framework", 0).getString("mac", "");
    if(TextUtils.isEmpty(v0)) {
    WifiInfo v1 = ((WifiManager)this.i.getSystemService("wifi")).getConnectionInfo();
    v0 = null;
    if(v1 != null) {
    v0 = v1.getMacAddress();
    if(v0 != null) {
    v0 = v0.replace(":", "");
    }
    }

    if(v0 != null && v0.length() == 12) {
    SharedPreferences.Editor v1_1 = this.i.getSharedPreferences("saf_framework", 0).edit();
    v1_1.putString("mac", v0);
    v1_1.commit();
    }
    }

    return v0;
    }

    public final String d() {
    String v0 = this.c();
    if(TextUtils.isEmpty(v0)) {
    v0 = this.a();
    if(TextUtils.isEmpty(v0)) {
    v0 = this.b();
    if(v0 == null) {
    v0 = "";
    }
    }
    }

    return a.a(v0);
    }

    public static String e() {
    return c.g;
    }

    public static String f() {
    return c.f;
    }

    public static String g() {
    return c.h;
    }

    private String h() {
    String v0 = null;
    if(this.j != null) {
    v0 = this.j.getDeviceId();
    }

    c.a.d("IMEI=" + v0);
    return v0;
    }

    private String i() {
    return this.i.getSharedPreferences("saf_framework", 0).getString("imei", "");
    }

    private String j() {
    WifiInfo v1 = ((WifiManager)this.i.getSystemService("wifi")).getConnectionInfo();
    String v0 = null;
    if(v1 != null) {
    v0 = v1.getMacAddress();
    if(v0 != null) {
    v0 = v0.replace(":", "");
    }
    }

    return v0;
    }

    private String k() {
    return this.i.getSharedPreferences("saf_framework", 0).getString("mac", "");
    }
    }