1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 * Copyright (C) 2016 Mopria Alliance, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18package com.android.bips.ipp;
19
20import android.os.AsyncTask;
21import android.util.Log;
22
23/** A background task that requests cancellation of a specific job */
24class CancelJobTask extends AsyncTask<Void, Void, Void> {
25    private static final String TAG = CancelJobTask.class.getSimpleName();
26    private static final boolean DEBUG = false;
27
28    private final Backend mBackend;
29    private final int mJobId;
30
31    CancelJobTask(Backend backend, int jobId) {
32        mBackend = backend;
33        mJobId = jobId;
34    }
35
36    @Override
37    protected Void doInBackground(Void... voids) {
38        if (DEBUG) Log.d(TAG, "doInBackground() for " + mJobId);
39
40        // Success will result in a jobCallback.
41        mBackend.nativeCancelJob(mJobId);
42        return null;
43    }
44}
45