导航菜单

页面标题

页面副标题

Adobe Acrobat v15.3 - ARFileURLDownloadService.java 源代码

正在查看: Adobe Acrobat v15.3 应用的 ARFileURLDownloadService.java JAVA 源代码文件

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


package com.adobe.reader.misc;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
import com.adobe.libs.c.a.g;

public class ARFileURLDownloadService extends g {
    public static final String BROADCAST_URL_CANCEL_DOWNLOAD = "com.adobe.reader.misc.ARFileURLDownloadService.URLCancelDownload";
    public static final String BROADCAST_URL_DISMISS_DOWNLOAD = "com.adobe.reader.misc.ARFileURLDownloadService.URLDismissDownload";
    public static final String BROADCAST_URL_DOWNLOAD_COMPLETE = "com.adobe.reader.misc.ARFileURLDownloadService.URLDownloadComplete";
    private BroadcastReceiver broadcastReceiver_cancelUrlDownload = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            String str = (String) intent.getExtras().getCharSequence(ARFileTransferActivity.FILE_ID_KEY);
            if (ARFileURLDownloadService.this.mURLFileDownloadAsyncTask == null || !ARFileURLDownloadService.this.mURLFileDownloadAsyncTask.getFileID().equals(str)) {
                return;
            }
            ARFileURLDownloadService.this.cancelFileTransferAsyncTask(ARFileURLDownloadService.this.mURLFileDownloadAsyncTask);
            ARFileURLDownloadService.this.mURLFileDownloadAsyncTask = null;
        }
    };
    private ARURLFileDownloadAsyncTask mURLFileDownloadAsyncTask;

    public void cancelFileTransferAsyncTask(ARURLFileDownloadAsyncTask aRURLFileDownloadAsyncTask) {
        if (aRURLFileDownloadAsyncTask == null || aRURLFileDownloadAsyncTask.getStatus() == AsyncTask.Status.FINISHED) {
            return;
        }
        aRURLFileDownloadAsyncTask.cancel(true);
    }

    private void cancelTasks() {
        cancelFileTransferAsyncTask(this.mURLFileDownloadAsyncTask);
    }

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

    @Override
    public void onCreate() {
        super.onCreate();
        LocalBroadcastManager.getInstance(this).registerReceiver(this.broadcastReceiver_cancelUrlDownload, new IntentFilter(BROADCAST_URL_CANCEL_DOWNLOAD));
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        cancelTasks();
        LocalBroadcastManager.getInstance(this).unregisterReceiver(this.broadcastReceiver_cancelUrlDownload);
    }

    @Override
    public int onStartCommandRAW(Intent intent, int i, int i2) {
        if (intent == null) {
            return 2;
        }
        Bundle extras = intent.getExtras();
        if (this.mURLFileDownloadAsyncTask != null) {
            Intent intent2 = new Intent(BROADCAST_URL_DISMISS_DOWNLOAD);
            Bundle bundle = new Bundle();
            bundle.putCharSequence(ARFileTransferActivity.FILE_ID_KEY, this.mURLFileDownloadAsyncTask.getFileID());
            intent2.putExtras(bundle);
            LocalBroadcastManager.getInstance(this).sendBroadcast(intent2);
            cancelFileTransferAsyncTask(this.mURLFileDownloadAsyncTask);
            this.mURLFileDownloadAsyncTask = null;
        }
        this.mURLFileDownloadAsyncTask = new ARURLFileDownloadAsyncTask(this, (Uri) extras.getParcelable(ARFileTransferActivity.FILE_PATH_KEY), (String) extras.getCharSequence(ARFileTransferActivity.FILE_ID_KEY), true);
        this.mURLFileDownloadAsyncTask.taskExecute(new Void[0]);
        return 2;
    }
}