导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - VideoEncodingService.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 VideoEncodingService.java JAVA 源代码文件

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


package im.amwhusedvt.messenger;

import android.R;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import im.amwhusedvt.messenger.NotificationCenter;

public class VideoEncodingService extends Service implements NotificationCenter.NotificationCenterDelegate {
    private NotificationCompat.Builder builder;
    private int currentAccount;
    private int currentProgress;
    private String path;

    public VideoEncodingService() {
        if ((32 + 7) % 7 <= 0) {
        }
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.stopEncodingService);
    }

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

    @Override
    public void onDestroy() {
        if ((17 + 9) % 9 <= 0) {
        }
        super.onDestroy();
        try {
            stopForeground(true);
        } catch (Throwable th) {
        }
        NotificationManagerCompat.from(ApplicationLoader.applicationContext).cancel(4);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.stopEncodingService);
        NotificationCenter.getInstance(this.currentAccount).removeObserver(this, NotificationCenter.FileUploadProgressChanged);
        if (BuildVars.LOGS_ENABLED) {
            FileLog.d("destroy video service");
        }
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        String str;
        if ((9 + 3) % 3 <= 0) {
        }
        if (id == NotificationCenter.FileUploadProgressChanged) {
            String fileName = (String) args[0];
            if (account == this.currentAccount && (str = this.path) != null && str.equals(fileName)) {
                Float progress = (Float) args[1];
                int floatValue = (int) (progress.floatValue() * 100.0f);
                this.currentProgress = floatValue;
                this.builder.setProgress(100, floatValue, floatValue == 0);
                try {
                    NotificationManagerCompat.from(ApplicationLoader.applicationContext).notify(4, this.builder.build());
                    return;
                } catch (Throwable e) {
                    FileLog.e(e);
                    return;
                }
            }
            return;
        }
        if (id == NotificationCenter.stopEncodingService) {
            String filepath = (String) args[0];
            int account2 = ((Integer) args[1]).intValue();
            if (account2 == this.currentAccount) {
                if (filepath == null || filepath.equals(this.path)) {
                    stopSelf();
                }
            }
        }
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        if ((31 + 30) % 30 <= 0) {
        }
        this.path = intent.getStringExtra("path");
        int oldAccount = this.currentAccount;
        int intExtra = intent.getIntExtra("currentAccount", UserConfig.selectedAccount);
        this.currentAccount = intExtra;
        if (oldAccount != intExtra) {
            NotificationCenter.getInstance(oldAccount).removeObserver(this, NotificationCenter.FileUploadProgressChanged);
            NotificationCenter.getInstance(this.currentAccount).addObserver(this, NotificationCenter.FileUploadProgressChanged);
        }
        boolean isGif = intent.getBooleanExtra("gif", false);
        if (this.path == null) {
            stopSelf();
            return 2;
        }
        if (BuildVars.LOGS_ENABLED) {
            FileLog.d("start video service");
        }
        if (this.builder == null) {
            NotificationsController.checkOtherNotificationsChannel();
            NotificationCompat.Builder builder = new NotificationCompat.Builder(ApplicationLoader.applicationContext);
            this.builder = builder;
            builder.setSmallIcon(R.drawable.stat_sys_upload);
            this.builder.setWhen(System.currentTimeMillis());
            this.builder.setChannelId(NotificationsController.OTHER_NOTIFICATIONS_CHANNEL);
            this.builder.setContentTitle(LocaleController.getString("AppName", 2131689827));
            if (isGif) {
                this.builder.setTicker(LocaleController.getString("SendingGif", 2131693846));
                this.builder.setContentText(LocaleController.getString("SendingGif", 2131693846));
            } else {
                this.builder.setTicker(LocaleController.getString("SendingVideo", 2131693849));
                this.builder.setContentText(LocaleController.getString("SendingVideo", 2131693849));
            }
        }
        this.currentProgress = 0;
        this.builder.setProgress(100, 0, 0 == 0);
        startForeground(4, this.builder.build());
        NotificationManagerCompat.from(ApplicationLoader.applicationContext).notify(4, this.builder.build());
        return 2;
    }
}