导航菜单

页面标题

页面副标题

95爱播免登录版 v3.1.9 - UpdateService.java 源代码

正在查看: 95爱播免登录版 v3.1.9 应用的 UpdateService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.showself.service;

import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import androidx.core.app.h;
import com.mifeng.ui.R;
import com.r.m.b.j;
import com.r.m.d.z;
import com.showself.ui.ShowSelfApp;
import com.showself.utils.Utils;
import org.greenrobot.eventbus.ThreadMode;
import org.greenrobot.eventbus.m;

public class UpdateService extends Service {
    private NotificationManager a;
    private Notification b;
    private h.c d;
    private final Handler c = new Handler();

    private int f2333e = 2;

    class a implements Runnable {
        final String a;

        class RunnableC0065a implements Runnable {
            final int a;

            RunnableC0065a(int i2) {
                this.a = i2;
            }

            @Override
            public void run() {
                UpdateService.this.d.f(UpdateService.this.getString(2131689532));
                UpdateService.this.d.e("下载中:" + this.a + "%");
                UpdateService.this.d.i(100, this.a, false);
                UpdateService.this.a.notify(UpdateService.this.f2333e, UpdateService.this.d.a());
            }
        }

        class b implements Runnable {
            b() {
            }

            @Override
            public void run() {
                UpdateService.this.g();
            }
        }

        a(String str) {
            this.a = str;
        }

        public void b(int i2) {
            UpdateService.this.c.post(new RunnableC0065a(i2));
        }

        public void d() {
            UpdateService.this.a.cancel(UpdateService.this.f2333e);
        }

        @Override
        public void run() {
            throw new UnsupportedOperationException("Method not decompiled: com.showself.service.UpdateService.a.run():void");
        }
    }

    class b implements Runnable {
        b() {
        }

        @Override
        public void run() {
            UpdateService.this.a.cancel(R.layout.notification_item);
        }
    }

    static class c {
        static final int[] a;

        static {
            int[] iArr = new int[j.a.values().length];
            a = iArr;
            try {
                iArr[j.a.INSTALL_APK.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                a[j.a.CHECKANDINSTALL_APK.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    private void f() {
        h.c cVar = new h.c(this, "update");
        cVar.f(getString(2131689532));
        cVar.j(R.drawable.mifeng);
        cVar.e("下载");
        cVar.h(true);
        cVar.i(100, 0, false);
        cVar.k(System.currentTimeMillis());
        cVar.d(false);
        this.d = cVar;
        this.a = (NotificationManager) getSystemService("notification");
        if (Build.VERSION.SDK_INT >= 26) {
            this.a.createNotificationChannel(new NotificationChannel("update", getPackageName(), 3));
        }
        Notification a2 = this.d.a();
        this.b = a2;
        this.a.notify(this.f2333e, a2);
    }

    public void g() {
        if (Build.VERSION.SDK_INT < 26) {
            h();
            return;
        }
        if (getPackageManager().canRequestPackageInstalls()) {
            h();
            return;
        }
        Object topActivity = com.showself.ui.c.getTopActivity();
        if (topActivity instanceof com.showself.ui.c) {
            ((com.showself.ui.c) topActivity).requestPermission();
        }
    }

    private void h() {
        Uri fromFile;
        if (Build.VERSION.SDK_INT >= 24) {
            fromFile = androidx.core.a.b.e(this, ShowSelfApp.h().getPackageName() + ".fileprovider", z.a);
        } else {
            fromFile = Uri.fromFile(z.a);
        }
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.addFlags(268435456);
        intent.addFlags(1);
        intent.setDataAndType(fromFile, "application/vnd.android.package-archive");
        startActivity(intent);
        new Handler().postDelayed(new b(), 1000L);
        stopSelf();
    }

    static void i() {
        Utils.a1("网络不给力,请稍后再试");
        ShowSelfApp.q = false;
    }

    private void j(String str) {
        new Thread(new a(str)).start();
    }

    public void k() {
        this.c.post(new Runnable() {
            @Override
            public final void run() {
                UpdateService.i();
            }
        });
    }

    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        org.greenrobot.eventbus.c.c().o(this);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        org.greenrobot.eventbus.c.c().q(this);
    }

    @m(threadMode = ThreadMode.MAIN)
    public void onEvent(j jVar) {
        if (jVar == null) {
            return;
        }
        int i2 = c.a[jVar.a.ordinal()];
        if (i2 == 1) {
            h();
        } else if (i2 != 2) {
            return;
        }
        g();
    }

    @Override
    public int onStartCommand(Intent intent, int i2, int i3) {
        if (intent != null) {
            String stringExtra = intent.getStringExtra("Key_Down_Url");
            z.a();
            f();
            j(stringExtra);
        }
        return super.onStartCommand(intent, i2, i3);
    }
}