导航菜单

页面标题

页面副标题

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

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

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


package chat.service;

import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.IBinder;
import android.os.SystemClock;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import chat.entity.SjChatLoginResultInfo;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.jivesoftware.smack.PacketListener;

public class SJChatService extends Service {
    private static SJChatService f;

    public PacketListener f2026a;

    private d.d.c f2027b;

    private e f2028c;

    private SjChatLoginResultInfo f2029d;
    private Timer e;

    class a extends Thread {
        a() {
        }

        @Override
        public void run() {
            d.g.b.h().j(SJChatService.this.f2029d.getUserId());
        }
    }

    class b extends TimerTask {
        b() {
        }

        @Override
        public void run() {
            try {
                if (SJChatService.this.f2029d == null || SJChatService.this.f2029d.getUserId() == 0) {
                    SJChatService.this.f2029d = d.i.g.h();
                }
                if (SJChatService.this.m() && SJChatService.this.f2029d.getSessionId() != null) {
                    long i = d.i.g.i(SJChatService.this.f2029d.getUserId());
                    if (i == 0) {
                        d.i.g.n(SJChatService.this.f2029d.getUserId());
                    } else if (System.currentTimeMillis() - i > 86400000) {
                        d.i.g.n(SJChatService.this.f2029d.getUserId());
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    class c extends Thread {
        c() {
        }

        @Override
        public void run() {
            if (SJChatService.this.f2029d == null || SJChatService.this.f2029d.getUserId() == 0) {
                SJChatService.this.f2029d = d.i.g.h();
            }
            if (SJChatService.this.f2029d.getUserId() != 0) {
                d.g.b.h().s(0);
            }
        }
    }

    class d implements Runnable {
        d(SJChatService sJChatService) {
        }

        @Override
        public void run() {
            d.g.b.h().e();
        }
    }

    private class e extends BroadcastReceiver {
        private e() {
        }

        @Override
        public void onReceive(Context context, Intent intent) {
            if (intent != null) {
                if ("com.showself.action_enter_background".equals(intent.getAction())) {
                    SJChatService.this.r();
                    SJChatService.this.o();
                    SJChatService.this.s();
                } else if ("com.showself.action_enter_foreground".equals(intent.getAction())) {
                    SJChatService.this.n();
                    SJChatService.this.p();
                    SJChatService.this.o();
                } else if ("com.showself.action_finish_launch".equals(intent.getAction())) {
                    SJChatService.this.n();
                    SJChatService.this.p();
                    SJChatService.this.o();
                }
            }
        }

        e(SJChatService sJChatService, a aVar) {
            this();
        }
    }

    private class f extends PhoneStateListener {
        private f() {
        }

        @Override
        public void onCallStateChanged(int i, String str) {
            if (i == 1) {
                SJChatService.this.sendBroadcast(new Intent("com.showself.pause_play"));
            }
            super.onCallStateChanged(i, str);
        }

        f(SJChatService sJChatService, a aVar) {
            this();
        }
    }

    public class g implements PacketListener {
        public g() {
        }

        public void processPacket(org.jivesoftware.smack.packet.Packet r52) {
            throw new UnsupportedOperationException("Method not decompiled: chat.service.SJChatService.g.processPacket(org.jivesoftware.smack.packet.Packet):void");
        }
    }

    public static SJChatService k() {
        return f;
    }

    public boolean m() {
        String packageName = getPackageName();
        List<ActivityManager.RunningTaskInfo> runningTasks = ((ActivityManager) getSystemService("activity")).getRunningTasks(1);
        return runningTasks.size() > 0 && packageName.equals(runningTasks.get(0).topActivity.getPackageName());
    }

    public void n() {
        SjChatLoginResultInfo sjChatLoginResultInfo = this.f2029d;
        if (sjChatLoginResultInfo == null || sjChatLoginResultInfo.getSessionId() == null) {
            return;
        }
        r();
        this.e = new Timer();
        int notificationInterval = this.f2029d.getNotificationInterval();
        if (notificationInterval < 60) {
            notificationInterval = 60;
        }
        this.e.scheduleAtFixedRate(new b(), 0L, notificationInterval * 1000);
    }

    public void o() {
        q();
        AlarmManager alarmManager = (AlarmManager) getSystemService("alarm");
        if (m()) {
            int j = d.i.g.d().j();
            Intent intent = new Intent(getApplicationContext(), (Class<?>) SJChatService.class);
            intent.setAction("com.showself.ui.mid_notification");
            alarmManager.setRepeating(3, SystemClock.elapsedRealtime(), j * 1000, PendingIntent.getService(getApplicationContext(), 0, intent, 134217728));
        }
    }

    public void p() {
        if (d.i.g.k()) {
            return;
        }
        new c().start();
    }

    private void q() {
        try {
            AlarmManager alarmManager = (AlarmManager) getSystemService("alarm");
            Intent intent = new Intent(getApplicationContext(), (Class<?>) SJChatService.class);
            intent.setAction("com.showself.ui.mid_notification");
            alarmManager.cancel(PendingIntent.getService(getApplicationContext(), 0, intent, 134217728));
        } catch (Exception e2) {
            e2.printStackTrace();
        }
    }

    public void r() {
        Timer timer = this.e;
        if (timer != null) {
            timer.cancel();
            this.e = null;
        }
    }

    public void s() {
        if (d.i.g.k()) {
            return;
        }
        new Thread(new d(this)).start();
    }

    public void l() {
        this.f2026a = new g();
    }

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

    @Override
    public void onCreate() {
        super.onCreate();
        this.f2029d = d.i.g.h();
        f = this;
        a aVar = null;
        this.f2028c = new e(this, aVar);
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("com.showself.action_enter_background");
        intentFilter.addAction("com.showself.action_enter_foreground");
        intentFilter.addAction("com.showself.action_finish_launch");
        registerReceiver(this.f2028c, intentFilter);
        if (!d.g.b.h().o() && !d.i.g.k()) {
            new a().start();
        }
        n();
        o();
        try {
            ((TelephonyManager) getSystemService("phone")).listen(new f(this, aVar), 32);
        } catch (Exception unused) {
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        unregisterReceiver(this.f2028c);
    }

    @Override
    public void onStart(Intent intent, int i) {
        f = this;
        super.onStart(intent, i);
    }

    @Override
    public int onStartCommand(Intent intent, int i, int i2) {
        SjChatLoginResultInfo sjChatLoginResultInfo;
        String action = intent != null ? intent.getAction() : null;
        if (action != null && action.equals("com.showself.ui.mid_notification") && ((sjChatLoginResultInfo = this.f2029d) == null || sjChatLoginResultInfo.getUserId() == 0)) {
            this.f2029d = d.i.g.h();
        }
        return super.onStartCommand(intent, i, i2);
    }
}