导航菜单

页面标题

页面副标题

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

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

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


package com.adobe.reader.services;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
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;
import com.adobe.libs.services.a.y;
import com.adobe.libs.services.d.h;
import com.adobe.libs.services.e.a;
import com.adobe.reader.misc.ARFileTransferActivity;
import com.adobe.reader.services.blueheron.ARBlueHeronClass3FileUploadAsyncTask;
import com.adobe.reader.services.blueheron.ARBlueHeronFileDownloadAsyncTask;
import com.adobe.reader.services.blueheron.ARBlueHeronFileUpdateAsyncTask;
import com.adobe.reader.services.blueheron.ARBlueHeronUploadAssetAsyncTask;
import com.adobe.reader.services.blueheron.ARBlueHeronUploadAssetUnmanagedAsyncTask;
import com.adobe.reader.services.cpdf.ARCreatePDFAsyncTask;
import com.adobe.reader.services.epdf.ARExportPDFAsyncTask;
import java.io.File;

public class ARFileTransferService extends g {
    public static final String BROADCAST_CANCEL_DOWNLOAD = "com.adobe.reader.ARFileTransferService.cloud.CancelDownload";
    public static final String BROADCAST_CANCEL_PROMOTE = "com.adobe.reader.ARFileTransferService.cloud.CancelPromote";
    public static final String BROADCAST_CANCEL_UPLOAD = "com.adobe.reader.ARFileTransferService.cloud.CancelUpload";
    public static final String BROADCAST_DOWNLOAD_COMPLETE = "com.adobe.reader.ARFileTransferService.cloud.DownloadComplete";
    public static final String BROADCAST_UPDATE_COMPLETE = "com.adobe.reader.ARFileTransferService.cloud.UpdateComplete";
    public static final String BROADCAST_UPLOAD_COMPLETE = "com.adobe.reader.ARFileTransferService.cloud.UploadComplete";
    private ARBlueHeronClass3FileUploadAsyncTask mClass3DocUploadAsyncTask;
    private h mCreatePDFAsyncTask;
    private ARBlueHeronFileDownloadAsyncTask mDownloadAsyncTask;
    private a mExportPDFAsyncTask;
    private ARBlueHeronUploadAssetUnmanagedAsyncTask mUnmanagedUploadAsyncTask;
    private ARBlueHeronFileUpdateAsyncTask mUpdateAsyncTask;
    private ARBlueHeronUploadAssetAsyncTask mUploadAsyncTask;
    private BroadcastReceiver broadcastReceiver_cancelUpload = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            ARFileTransferService.this.cancelFileTransferAsyncTask(ARFileTransferService.this.mUploadAsyncTask);
        }
    };
    private BroadcastReceiver mBroadcastReceiverCancelPromotion = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            ARFileTransferService.this.cancelFileTransferAsyncTask(ARFileTransferService.this.mClass3DocUploadAsyncTask);
        }
    };
    private BroadcastReceiver broadcastReceiver_cancelDownload = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            ARFileTransferService.this.cancelFileTransferAsyncTask(ARFileTransferService.this.mDownloadAsyncTask);
        }
    };

    public enum TRANSFER_TYPE {
        DOWNLOAD,
        UPLOAD,
        UPDATE,
        EXPORT,
        CREATE,
        CLASS3_UPLOAD
    }

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

    private void cancelTasks() {
        cancelFileTransferAsyncTask(this.mDownloadAsyncTask);
        cancelFileTransferAsyncTask(this.mUploadAsyncTask);
        cancelFileTransferAsyncTask(this.mClass3DocUploadAsyncTask);
        cancelFileTransferAsyncTask(this.mUpdateAsyncTask);
    }

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

    @Override
    public void onCreate() {
        super.onCreate();
        LocalBroadcastManager.getInstance(this).registerReceiver(this.broadcastReceiver_cancelUpload, new IntentFilter(BROADCAST_CANCEL_UPLOAD));
        LocalBroadcastManager.getInstance(this).registerReceiver(this.mBroadcastReceiverCancelPromotion, new IntentFilter(BROADCAST_CANCEL_PROMOTE));
        LocalBroadcastManager.getInstance(this).registerReceiver(this.broadcastReceiver_cancelDownload, new IntentFilter(BROADCAST_CANCEL_DOWNLOAD));
    }

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

    @Override
    public int onStartCommandRAW(Intent intent, int i, int i2) {
        if (intent == null) {
            return 2;
        }
        Bundle extras = intent.getExtras();
        AROutboxFileEntry outboxFileEntryFromJSONStr = AROutboxFileEntry.getOutboxFileEntryFromJSONStr(extras.getString(ARFileTransferActivity.FILE_ENTRY_KEY));
        int i3 = extras.getInt(ARFileTransferActivity.TRANSFER_TYPE_KEY, -1);
        if (outboxFileEntryFromJSONStr != null) {
            i3 = outboxFileEntryFromJSONStr.getTransferType().ordinal();
        }
        TRANSFER_TYPE transfer_type = TRANSFER_TYPE.values()[i3];
        File file = new File(outboxFileEntryFromJSONStr.getFilePath());
        String absolutePath = file.getAbsolutePath();
        String cloudSource = outboxFileEntryFromJSONStr.getCloudSource();
        if (transfer_type == TRANSFER_TYPE.DOWNLOAD) {
            this.mDownloadAsyncTask = new ARBlueHeronFileDownloadAsyncTask(this, absolutePath, outboxFileEntryFromJSONStr.getFileID(), outboxFileEntryFromJSONStr.getCloudModifiedDate(), true, cloudSource);
            this.mDownloadAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        if (transfer_type == TRANSFER_TYPE.UPLOAD) {
            this.mUploadAsyncTask = new ARBlueHeronUploadAssetAsyncTask(this, absolutePath, true, false, extras.getString(ARFileTransferActivity.FOLDER_ID_KEY), cloudSource);
            this.mUploadAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        if (transfer_type == TRANSFER_TYPE.CLASS3_UPLOAD) {
            this.mClass3DocUploadAsyncTask = new ARBlueHeronClass3FileUploadAsyncTask(this, outboxFileEntryFromJSONStr.getFilePath(), outboxFileEntryFromJSONStr.getFileID());
            this.mClass3DocUploadAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        if (transfer_type == TRANSFER_TYPE.UPDATE) {
            this.mUpdateAsyncTask = new ARBlueHeronFileUpdateAsyncTask(this, absolutePath, outboxFileEntryFromJSONStr.getFileID(), intent.getBooleanExtra(ARFileTransferActivity.IS_MODAL_KEY, false), cloudSource);
            this.mUpdateAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        if (transfer_type == TRANSFER_TYPE.EXPORT) {
            String fileID = outboxFileEntryFromJSONStr.getFileID();
            if (fileID != null) {
                this.mExportPDFAsyncTask = new ARExportPDFAsyncTask(this, absolutePath, fileID, false, outboxFileEntryFromJSONStr.getFormat(), outboxFileEntryFromJSONStr.getLanguage(), cloudSource);
                this.mExportPDFAsyncTask.taskExecute(new Void[0]);
                return 2;
            }
            this.mUnmanagedUploadAsyncTask = new ARBlueHeronUploadAssetUnmanagedAsyncTask(this, absolutePath, transfer_type, outboxFileEntryFromJSONStr.getFormat(), outboxFileEntryFromJSONStr.getLanguage());
            this.mUnmanagedUploadAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        if (transfer_type != TRANSFER_TYPE.CREATE) {
            return 2;
        }
        String fileID2 = outboxFileEntryFromJSONStr.getFileID();
        if (fileID2 != null) {
            this.mCreatePDFAsyncTask = new ARCreatePDFAsyncTask(this, file.getAbsolutePath(), fileID2, false, cloudSource);
            this.mCreatePDFAsyncTask.taskExecute(new Void[0]);
            return 2;
        }
        this.mUnmanagedUploadAsyncTask = new ARBlueHeronUploadAssetUnmanagedAsyncTask(this, absolutePath, transfer_type);
        this.mUnmanagedUploadAsyncTask.taskExecute(new Void[0]);
        return 2;
    }
}