360手机助手 v3.3.0版本的 MD5 值为:127c345ad16bbebee6e347381328afd0

以下内容为反编译后的 h.java 源代码,内容仅作参考


package com.qihoo.appstore.personnalcenter;

import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import com.qihoo.appstore.activities.MainActivity;
import com.qihoo.appstore.activities.UserInfoActivity1;
import com.qihoo.appstore.newHomePage.HomeActivity;
import com.qihoo.appstore.personnalcenter.friends.af;
import com.qihoo.appstore.personnalcenter.friends.am;
import com.qihoo.appstore.utils.bk;
import com.qihoo.appstore.utils.ct;
import com.qihoo.appstore.utils.de;
import com.qihoo.speedometer.Config;
import com.qihoo360.accounts.QihooAccount;
import com.qihoo360.accounts.a.a.z;
import com.qihoo360.mobilesafe.util.ag;
import java.net.URLEncoder;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;

public class h {
    private static Context d;
    private static final char[] e = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
    private static h f;

    public int f2975a = 1;

    Handler f2976b = new Handler(new i(this));
    Intent c;

    private h(Context context) {
        d = context.getApplicationContext();
        this.c = new Intent("com.qihoo.accountcenter.action.START_ACCOUNT_SERVICE");
    }

    public static h a(Context context) {
        synchronized ("Loginer") {
            if (f == null) {
                f = new h(context.getApplicationContext());
            }
        }
        return f;
    }

    public static String a() {
        new StringBuffer("https://passport.360.cn/api.php?");
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("&head_type=").append("q").append("&v=").append(de.f(d)).append("&method=CommonAccount.getUserInfo&format=json&from=mpc_zhushou&res_mode=1");
        String stringBuffer2 = stringBuffer.append("&sig=").append(de.g(stringBuffer.toString())).toString();
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("Loginer", "genaerate login url =" + stringBuffer2);
        }
        return a(stringBuffer2, "j8a7i2u6");
    }

    public static String a(String str, String str2) {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("https://passport.360.cn/api.php?parad=");
        stringBuffer.append(URLEncoder.encode(b(de.h(str), str2)));
        stringBuffer.append("&from=mpc_zhushou");
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("Loginer", "addDesSecreturl = " + stringBuffer.toString());
        }
        return stringBuffer.toString();
    }

    public static String a(byte[] bArr, String str) {
        if (bArr == null) {
            return null;
        }
        try {
            SecretKey generateSecret = SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(str.getBytes("UTF-8")));
            Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
            cipher.init(2, generateSecret, new IvParameterSpec(str.getBytes("UTF-8")));
            return new String(cipher.doFinal(bArr), "UTF-8");
        } catch (Exception e2) {
            return null;
        }
    }

    private static void a(int i) {
        for (int i2 = 0; i2 < i; i2++) {
            MainActivity.e().i();
        }
    }

    private static void a(Context context, String str, String str2) {
        if (ct.a(str2)) {
            str2 = Config.INVALID_IP;
        }
        g.a(context, str, str2);
    }

    public static void a(Context context, String str, String str2, p pVar) {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("Loginer", "autoLogin, account = " + str + ", qt = " + str2);
        }
        if (MainActivity.e() == null) {
            return;
        }
        if (TextUtils.isEmpty(str2) || TextUtils.isEmpty(str)) {
            if (pVar != null) {
                pVar.a();
                return;
            }
            return;
        }
        com.qihoo.appstore.personnalcenter.sdk.e f2 = MainActivity.f();
        if (f2 != null) {
            String[] a2 = f2.a(str2);
            String str3 = a2[0];
            String str4 = a2[1];
            if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                new z(context, com.qihoo.appstore.personnalcenter.sdk.e.b(), Looper.myLooper(), new k(pVar)).a(str, str3, str4, null, "q");
                return;
            }
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("Loginer", "autoLogin failed, q or t is empty.");
            }
            if (pVar != null) {
                pVar.a();
            }
        }
    }

    private static void a(Bundle bundle, String str, String str2) {
        if (ct.a(str2)) {
            return;
        }
        bundle.putString(str, str2);
    }

    public static void a(String str, String str2, int i, Intent intent, boolean z, String str3) {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.c("Loginer", "jumpAfterLogin, qid = " + str + ", = qt " + str2 + ", backStep = " + i + ", targetIntent = " + intent);
        }
        if (MainActivity.e() == null) {
            return;
        }
        if (com.qihoo.appstore.personnalcenter.friends.b.a(d, intent, str3)) {
            com.qihoo.appstore.personnalcenter.friends.b.a(str, str2, i, intent, z, str3);
        } else {
            b(str, str2, i, intent, z, str3);
        }
    }

    public static void a(String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, String str9, int i) {
        MainActivity e2 = MainActivity.e();
        if (e2 == null) {
            return;
        }
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.c("Loginer", "onLoginSucceed, account = " + str + ", = qid " + str2 + ", username = " + str4 + ", email = " + str5 + ", nickName = " + str6 + ", avatar = " + str7 + ", mobile = " + str8 + ", qt = " + str3 + ", loginRoute = " + str9);
        }
        a(e2, "account", str);
        a(e2, "qid", str2);
        a(e2, "qt", str3);
        a(e2, "user_name", str4);
        a(e2, "login_email", str5);
        a(e2, "nick_name", str6);
        a(e2, "head_pic", str7);
        a(e2, "mobile", str8);
        e2.a(true);
        HomeActivity.f2042a = true;
        e2.v = false;
        com.qihoo.appstore.personnalcenter.sdk.e f2 = MainActivity.f();
        if (f2 != null) {
            try {
                String[] a2 = f2.a(str3);
                String str10 = a2[0];
                String str11 = a2[1];
                Bundle bundle = new Bundle();
                a(bundle, "key_username", str4);
                a(bundle, "key_loginemail", str5);
                a(bundle, "key_nickname", str6);
                a(bundle, "key_avatorurl", str7);
                f2.a(new QihooAccount(str, str2, str10, str11, false, bundle));
            } catch (Exception e3) {
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.c("Loginer", "onLoginSucceed tryAttachAccount failed.", e3);
                }
            }
        }
        e2.e(true);
        a.a(e2);
        b(str9);
        if ("friend".equals(str9)) {
            SharedPreferences i2 = com.qihoo.appstore.personnalcenter.a.a.i();
            ag.a(i2.edit().putBoolean(com.qihoo.appstore.personnalcenter.a.a.e("PREF_KEY_NO_SHOW_FRIEND_ASSOCIATION_CONFIRMED_FROM_FRIEND_FEED_"), true));
            ag.a(i2.edit().putBoolean("PREF_KEY_HAS_SHOW_READ_CONTACTS_CONFIRM", true));
        }
        try {
            android.support.v4.a.c.a(e2).a(new Intent("BROADCAST_ACTION_LOGIN_STATE_CHANGED"));
        } catch (Exception e4) {
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.d("Loginer", "failed to send BROADCAST_ACTION_LOGIN_STATE_CHANGED broadcast.", e4);
            }
        }
        af.c = true;
        af.b();
        if (com.qihoo.appstore.e.d.m.b(d)) {
            com.qihoo.appstore.provider.a.a.a().g();
        }
        am.b();
        new Thread(new l(i, str, str2, str3)).start();
    }

    public static byte[] a(String str) {
        if (str == null || str.length() <= 0) {
            return null;
        }
        try {
            return com.qihoo.appstore.utils.h.a(str, 2);
        } catch (Exception e2) {
            e2.printStackTrace();
            return null;
        }
    }

    public static String b(String str, String str2) {
        try {
            SecretKey generateSecret = SecretKeyFactory.getInstance("DES").generateSecret(new DESKeySpec(str2.getBytes()));
            Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
            cipher.init(1, generateSecret, new IvParameterSpec(str2.getBytes()));
            return new String(com.qihoo.appstore.utils.h.c(cipher.doFinal(str.getBytes()), 2));
        } catch (Exception e2) {
            return Config.INVALID_IP;
        }
    }

    public static void b(String str) {
        if (MainActivity.e() == null) {
            return;
        }
        g.a(MainActivity.e(), "KEY_PERSONNAL_CENTER_LOGIN_ROUTE", str);
    }

    private static void b(String str, String str2, int i, Intent intent, boolean z, String str3) {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.c("Loginer", "doJump, qid = " + str + ", = qt " + str2 + ", backStep = " + i + ", targetIntent = " + intent);
        }
        MainActivity e2 = MainActivity.e();
        if (e2 == null) {
            return;
        }
        String str4 = UserInfoActivity1.r;
        a(i);
        if (z) {
            a.b();
        }
        if (intent != null) {
            if (new ComponentName(d, (Class<?>) UserInfoActivity1.class).equals(intent.getComponent())) {
                int a2 = e2.a(UserInfoActivity1.class);
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.c("Loginer", "jumpAfterLogin extraStep = " + a2);
                }
                a(a2);
            }
            intent.putExtra("jumpAfterLogin", true);
            UserInfoActivity1.r = str4;
            if (intent.getBooleanExtra("BUNDLE_TARGET_INTENT_BY_START_CHILD", true)) {
                e2.b(intent);
            } else {
                e2.startActivity(intent);
            }
        }
    }

    public static String c() {
        if (MainActivity.e() == null) {
            return Config.INVALID_IP;
        }
        String b2 = g.b(MainActivity.e(), "KEY_PERSONNAL_CENTER_LOGIN_ROUTE", Config.INVALID_IP);
        g.a(MainActivity.e(), "KEY_PERSONNAL_CENTER_LOGIN_ROUTE", Config.INVALID_IP);
        return b2;
    }

    public static String c(String str, String str2) {
        return a(a(str), str2);
    }

    public static String d() {
        return MainActivity.e() == null ? Config.INVALID_IP : g.b(MainActivity.e(), "KEY_PERSONNAL_CENTER_LOGIN_ROUTE", Config.INVALID_IP);
    }

    public void a(Context context, m mVar) {
        new n(this, mVar).c((Object[]) new Void[0]);
    }

    public void a(p pVar) {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("Loginer", "auto login");
        }
        new com.qihoo.appstore.personnalcenter.sdk.a(d, pVar).a();
    }

    public void a(String str, String str2, String str3, String str4, o oVar) {
        new com.qihoo360.accounts.a.a.q(d, com.qihoo.appstore.personnalcenter.sdk.e.b(), Looper.getMainLooper(), new j(this, str2, oVar)).a(str, str3, str4);
    }

    public void b() {
        if (com.qihoo360.mobilesafe.a.a.f5313a) {
            bk.b("liruifeng", "loginer clear");
        }
        try {
            d.stopService(this.c);
        } catch (Exception e2) {
        }
    }
}