导航菜单

页面标题

页面副标题

Hopscotch v9.7.2 - TransferService.java 源代码

正在查看: Hopscotch v9.7.2 应用的 TransferService.java JAVA 源代码文件

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


package com.amazonaws.mobileconnectors.s3.transferutility;

import android.app.Notification;
import android.app.Service;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.IBinder;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Map;

public class TransferService extends Service {
    private static final int ANDROID_OREO = 26;
    private static final Log LOGGER = LogFactory.b(TransferService.class);
    public static TransferNetworkLossHandler b;
    public boolean a = true;
    private int ongoingNotificationId = 1;
    private boolean removeNotification = true;

    @Override
    public final void dump(FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
        if ((getApplicationInfo().flags & 2) == 0) {
            return;
        }
        printWriter.printf("network status: %s\n", Boolean.valueOf(b.d()));
        Map<Integer, TransferRecord> e = TransferStatusUpdater.c(this).e();
        printWriter.printf("# of active transfers: %d\n", Integer.valueOf(e.size()));
        for (TransferRecord transferRecord : e.values()) {
            printWriter.printf("bucket: %s, key: %s, status: %s, total size: %d, current: %d\n", transferRecord.k, transferRecord.l, transferRecord.j, Long.valueOf(transferRecord.f), Long.valueOf(transferRecord.g));
        }
        printWriter.flush();
    }

    @Override
    public final IBinder onBind(Intent intent) {
        throw new UnsupportedOperationException("Can't bind to TransferService");
    }

    @Override
    public final void onCreate() {
        super.onCreate();
        Log log = LOGGER;
        log.a("Starting Transfer Service to listen for network connectivity changes.");
        b = TransferNetworkLossHandler.c(getApplicationContext());
        synchronized (this) {
            if (this.a) {
                try {
                    log.a("Registering the network receiver");
                    registerReceiver(b, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
                    this.a = false;
                } catch (IllegalArgumentException unused) {
                    LOGGER.b("Ignoring the exception trying to register the receiver for connectivity change.");
                } catch (IllegalStateException unused2) {
                    LOGGER.b("Ignoring the leak in registering the receiver.");
                }
            }
        }
    }

    @Override
    public final void onDestroy() {
        throw new UnsupportedOperationException("Method not decompiled: com.amazonaws.mobileconnectors.s3.transferutility.TransferService.onDestroy():void");
    }

    @Override
    public final int onStartCommand(Intent intent, int i, int i2) {
        if (Build.VERSION.SDK_INT >= 26) {
            try {
                synchronized (this) {
                    try {
                        Notification notification = (Notification) intent.getParcelableExtra("notification");
                        if (notification != null) {
                            this.ongoingNotificationId = intent.getIntExtra("ongoing-notification-id", this.ongoingNotificationId);
                            this.removeNotification = intent.getBooleanExtra("remove-notification", this.removeNotification);
                            LOGGER.a("Putting the service in Foreground state.");
                            startForeground(this.ongoingNotificationId, notification);
                        } else {
                            LOGGER.h("No notification is passed in the intent. Unable to transition to foreground.");
                        }
                    } finally {
                    }
                }
            } catch (Exception e) {
                LOGGER.h("Error in moving the service to foreground state: " + e);
            }
            return 1;
        }
        synchronized (this) {
            if (this.a) {
                try {
                    LOGGER.a("Registering the network receiver");
                    registerReceiver(b, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
                    this.a = false;
                } catch (IllegalArgumentException unused) {
                    LOGGER.b("Ignoring the exception trying to register the receiver for connectivity change.");
                } catch (IllegalStateException unused2) {
                    LOGGER.b("Ignoring the leak in registering the receiver.");
                }
            }
            return 1;
        }
    }
}