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

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


package com.qihoo.appstore.iconmanager;

import android.graphics.Bitmap;
import android.graphics.Matrix;
import android.util.DisplayMetrics;
import com.qihoo.appstore.resource.wallpaper.Wallpaper;
import com.qihoo.appstore.utils.aw;
import com.qihoo.appstore.utils.bk;
import com.qihoo.appstore.utils.db;
import com.qihoo.appstore.utils.de;
import com.qihoo.speedometer.Config;
import java.io.File;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Iterator;
import java.util.LinkedList;

public class d {

    private static final LinkedList f1749a = new LinkedList();

    private static m[] f1750b = null;
    private static final Object c = new Object();

    public static Bitmap a(Bitmap bitmap) {
        return b(bitmap);
    }

    public static Bitmap a(h hVar, j jVar) {
        Bitmap bitmap;
        Bitmap bitmap2;
        try {
            bitmap = (Bitmap) com.a.a.b.g.a().b().a(hVar.f);
        } catch (Exception e) {
            if (com.qihoo360.mobilesafe.a.a.f5313a) {
                bk.b("LoadingWallpaperHelper", "loadImage:" + e.toString());
            }
            e.printStackTrace();
        }
        if (bitmap != null) {
            return bitmap;
        }
        if (h.e() && (bitmap2 = (Bitmap) com.a.a.b.g.a().b().a(hVar.e)) != null) {
            return bitmap2;
        }
        if (hVar.m) {
            new e(hVar).start();
            return null;
        }
        a(hVar, jVar, null);
        return null;
    }

    public static f a(h hVar, j jVar, Wallpaper wallpaper, int i) {
        boolean z;
        Bitmap b2;
        boolean z2 = true;
        f fVar = new f();
        Bitmap bitmap = null;
        if (i == 0) {
            bitmap = b(wallpaper.a(0, 1));
            if (bitmap == null) {
                boolean z3 = h.d();
                Bitmap b3 = b(wallpaper.a(0, 2));
                if (b3 == null) {
                    bitmap = b3;
                } else {
                    z2 = z3;
                    bitmap = b3;
                }
            }
            z2 = false;
        } else if (i == 3) {
            bitmap = b(wallpaper.a(4, 1));
            if (bitmap == null && (bitmap = b(wallpaper.a(4, 2))) == null && (bitmap = b(wallpaper.a(3, 1))) == null) {
                z = h.d();
                b2 = b(wallpaper.a(3, 2));
                if (b2 == null) {
                    bitmap = b(wallpaper.a(0, 1));
                    if (bitmap == null) {
                        bitmap = b(wallpaper.a(0, 2));
                    }
                }
                z2 = z;
                bitmap = b2;
            }
            z2 = false;
        } else {
            if (i == 4) {
                fVar.d = true;
                String a2 = wallpaper.a(4, 1);
                bitmap = b(a2);
                if (bitmap == null) {
                    if (h.d()) {
                        if (new File(com.qihoo.appstore.cache.file.c.a().c().c(), aw.b(a2)).exists()) {
                            fVar.c = true;
                        }
                        z = true;
                    } else {
                        z = false;
                    }
                    String a3 = wallpaper.a(4, 2);
                    b2 = b(a3);
                    if (b2 == null) {
                        fVar.d = false;
                        if (new File(com.qihoo.appstore.cache.file.c.a().c().c(), aw.b(a3)).exists()) {
                            fVar.c = true;
                        }
                        fVar.e = true;
                        bitmap = b(wallpaper.a(3, 1));
                        if (bitmap == null && (bitmap = b(wallpaper.a(3, 2))) == null) {
                            fVar.e = false;
                            fVar.f = true;
                            bitmap = b(wallpaper.a(0, 1));
                            if (bitmap == null && (bitmap = b(wallpaper.a(0, 2))) == null) {
                                fVar.f = false;
                            }
                        }
                    }
                    z2 = z;
                    bitmap = b2;
                }
            }
            z2 = false;
        }
        if (z2) {
            try {
                a(hVar, jVar, null);
            } catch (Exception e) {
                if (com.qihoo360.mobilesafe.a.a.f5313a) {
                    bk.b("LoadingWallpaperHelper", "loadImage:" + e.toString());
                }
            }
        }
        fVar.f1752a = bitmap;
        fVar.f1753b = z2;
        return fVar;
    }

    public static LinkedList a() {
        return f1749a;
    }

    private static void a(h hVar, j jVar, Object obj) {
        b();
        h c2 = c(hVar.a());
        if (c2 != null) {
            if (c2.f1754a == 1 || c2.f1754a == 0) {
                c2.a(jVar);
                return;
            } else if (c2.f1754a == 4) {
                a(hVar, jVar, obj, c2.o);
                return;
            } else if (c2.f1754a == 2) {
                a(hVar, jVar, obj, c2.o);
                return;
            }
        }
        b(hVar, jVar, obj);
    }

    private static void a(h hVar, j jVar, Object obj, m mVar) {
        hVar.a(jVar);
        if (mVar.f1759b != null) {
            throw new RuntimeException("do not support multiple pending request.");
        }
        mVar.f1759b = hVar;
    }

    public static Bitmap b(Bitmap bitmap) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        Matrix matrix = new Matrix();
        DisplayMetrics b2 = de.b();
        matrix.postScale((b2.widthPixels * 2.0f) / width, b2.heightPixels / height);
        try {
            return Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
        } catch (Throwable th) {
            return bitmap;
        }
    }

    private static Bitmap b(String str) {
        return (Bitmap) com.a.a.b.g.a().b().a(str);
    }

    private static synchronized void b() {
        synchronized (d.class) {
            synchronized (c) {
                if (f1750b == null || f1750b.length <= 0 || f1750b[0] == null) {
                    f1750b = new m[9];
                    for (int i = 0; i < f1750b.length; i++) {
                        f1750b[i] = new m("WorkerThread" + i);
                        f1750b[i].start();
                    }
                }
            }
        }
    }

    private static void b(h hVar, j jVar, Object obj) {
        hVar.a(jVar);
        synchronized (f1749a) {
            f1749a.add(hVar);
            f1749a.notifyAll();
        }
    }

    private static h c(String str) {
        if (str != null) {
            if (!Config.INVALID_IP.equals(str)) {
                for (m mVar : f1750b) {
                    if (mVar != null && mVar.f1758a != null && mVar.f1758a.a() != null && str.equals(mVar.f1758a.a())) {
                        return mVar.f1758a;
                    }
                    if (mVar != null && mVar.f1759b != null && mVar.f1759b.a() != null && str.equals(mVar.f1759b.a())) {
                        return mVar.f1759b;
                    }
                }
                synchronized (f1749a) {
                    Iterator it = f1749a.iterator();
                    while (it.hasNext()) {
                        h hVar = (h) it.next();
                        if (hVar.a().equals(str)) {
                            return hVar;
                        }
                    }
                    return null;
                }
            }
        }
        return null;
    }

    private static HttpURLConnection d(String str) {
        com.qihoo.appstore.http.netconfig.a a2 = com.qihoo.appstore.http.netconfig.c.b().a();
        String a3 = db.a(str);
        switch (a2.a()) {
            case -1:
            case 0:
            default:
                return null;
            case 1:
            case 3:
            case 5:
            case 6:
                return (HttpURLConnection) new URL(a3).openConnection();
            case 2:
            case 4:
                return (HttpURLConnection) new URL(a3).openConnection();
        }
    }

    public static HttpURLConnection e(String str) {
        HttpURLConnection d = d(str);
        if (d == null) {
            return null;
        }
        d.setDoInput(true);
        d.setRequestMethod("GET");
        d.setRequestProperty("Charset", "UTF-8");
        d.setRequestProperty("accept", "*/*");
        d.addRequestProperty("Accept-Encoding", "gzip,deflate");
        d.setConnectTimeout(45000);
        d.setReadTimeout(45000);
        d.setRequestProperty("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4, 360appstore");
        d.setRequestProperty("Referer", "http://www.so.com");
        d.connect();
        return d;
    }
}