1 /* 2 * Copyright (C) 2023 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.google.android.setupcompat.portal.v1_1; 18 19 import android.os.Bundle; 20 21 /** 22 * Interface for progress service to update progress to SUW. Clients should 23 * update progress at least once a minute, or set a pending reason to stop 24 * update progress. Without progress update and pending reason. We considering 25 * the progress service is no response will suspend it and unbinde service. 26 */ 27 interface IPortalProgressCallback { 28 /** 29 * Sets completed amount. 30 */ setProgressCount(int completed, int failed, int total)31 Bundle setProgressCount(int completed, int failed, int total) = 0; 32 33 /** 34 * Sets completed percentage. 35 */ setProgressPercentage(int percentage)36 Bundle setProgressPercentage(int percentage) = 1; 37 38 /** 39 * Sets the summary shows on portal activity. 40 */ 41 Bundle setSummary(String summary) = 2; 42 43 /** 44 * Let SUW knows the progress is pending now, and stop update progress. 45 * @param reasonResName The name of resource identifier. 46 * @param quantity The number used to get the correct string for the current language's 47 * plural rules 48 * @param formatArgs The format arguments that will be used for substitution. 49 */ setPendingReason(String reasonResName, int quantity, in int[] formatArgs, int reason)50 Bundle setPendingReason(String reasonResName, int quantity, in int[] formatArgs, int reason) = 3; 51 52 /** 53 * Once the progress completed, and service can be destroy. Call this function. 54 * SUW will unbind the service. 55 * @param resName The name of resource identifier. 56 * @param quantity The number used to get the correct string for the current language's 57 * plural rules 58 * @param formatArgs The format arguments that will be used for substitution. 59 */ setComplete(String resName, int quantity, in int[] formatArgs)60 Bundle setComplete(String resName, int quantity, in int[] formatArgs) = 4; 61 62 /** 63 * Once the progress failed, and not able to finish the progress. Should call 64 * this function. SUW will unbind service after receive setFailure. Client can 65 * registerProgressService again once the service is ready to execute. 66 * @param resName The name of resource identifier. 67 * @param quantity The number used to get the correct string for the current language's 68 * plural rules 69 * @param formatArgs The format arguments that will be used for substitution. 70 */ setFailure(String resName, int quantity, in int[] formatArgs)71 Bundle setFailure(String resName, int quantity, in int[] formatArgs) = 5; 72 } 73