导航菜单

页面标题

页面副标题

Biko v2.0.23 - PWETimerService.java 源代码

正在查看: Biko v2.0.23 应用的 PWETimerService.java JAVA 源代码文件

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


package com.easebuzz.payment.kit;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import datamodels.PWEStaticDataModel;
import java.util.Timer;
import java.util.TimerTask;

public class PWETimerService extends Service {
    private PWEPaymentInfoHandler paymentInfoHandler;
    private TimerTask sessionTimerTask;
    private Timer timerTransactionSession;

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

    @Override
    public void onCreate() {
        super.onCreate();
        this.timerTransactionSession = new Timer();
        this.paymentInfoHandler = new PWEPaymentInfoHandler(getApplicationContext());
        updateTransactionSessionTime();
    }

    public void updateTransactionSessionTime() {
        TimerTask timerTask = new TimerTask() {
            @Override
            public void run() {
                boolean z = true;
                if (PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES == 0 && PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS == 0) {
                    PWETimerService.this.paymentInfoHandler.setIsTxnSessionExpire(true);
                    PWETimerService.this.timerTransactionSession.cancel();
                } else {
                    if (PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES == 0) {
                        PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS--;
                    }
                    if (PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS > 0 && PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES > 0) {
                        PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS--;
                    }
                    if (PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS == 0 && PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES > 0) {
                        PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS = 60;
                        PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES--;
                    }
                    z = false;
                }
                Intent intent = new Intent("pwe_timer_broad_cast");
                intent.putExtra("is_session_expired", z);
                PWETimerService.this.sendBroadcast(intent);
            }
        };
        this.sessionTimerTask = timerTask;
        this.timerTransactionSession.scheduleAtFixedRate(timerTask, 0L, 1000L);
    }

    @Override
    public void onDestroy() {
        try {
            if (PWEStaticDataModel.TXN_SESSION_UPDATED_MINUTES <= 0 && PWEStaticDataModel.TXN_SESSION_UPDATED_SECONDS <= 0) {
                this.paymentInfoHandler.setIsTxnSessionExpire(true);
                this.timerTransactionSession.cancel();
            } else if (this.paymentInfoHandler.IsTxnTimerStopped()) {
                this.timerTransactionSession.cancel();
            }
        } catch (Exception unused) {
        }
    }

    @Override
    public int onStartCommand(Intent intent, int i, int i2) {
        return super.onStartCommand(intent, i, i2);
    }

    @Override
    public void onTaskRemoved(Intent intent) {
        super.onTaskRemoved(intent);
    }
}