1 /*
2  * Copyright 2019, The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.managedprovisioning.provisioning;
18 
19 import com.android.managedprovisioning.model.ProvisioningParams;
20 
21 /**
22  * Interface for communication from activities to provisioning managers.
23  */
24 public interface ProvisioningManagerInterface {
25 
26     /**
27      * Initiate a new provisioning process, unless one is already ongoing.
28      *
29      * @param params {@link ProvisioningParams} associated with the new provisioning process.
30      */
maybeStartProvisioning(final ProvisioningParams params)31     void maybeStartProvisioning(final ProvisioningParams params);
32 
33     /**
34      * Cancel the ongoing provisioning process.
35      */
cancelProvisioning()36     void cancelProvisioning();
37 
38     /**
39      * Register a listener for updates of the provisioning progress.
40      *
41      * <p>Registering a listener will immediately result in the last callback being sent to the
42      * listener. All callbacks will occur on the UI thread.</p>
43      *
44      * @param callback listener to be registered.
45      */
registerListener(ProvisioningManagerCallback callback)46     void registerListener(ProvisioningManagerCallback callback);
47 
48     /**
49      * Unregister a listener from updates of the provisioning progress.
50      *
51      * @param callback listener to be unregistered.
52      */
unregisterListener(ProvisioningManagerCallback callback)53     void unregisterListener(ProvisioningManagerCallback callback);
54 }
55