1 /*
2  * Copyright (C) 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 package android.os.image;
17 
18 import android.gsi.GsiProgress;
19 
20 /** {@hide} */
21 interface IDynamicSystemService
22 {
23     /**
24      * Start DynamicSystem installation. This call may take 60~90 seconds. The caller
25      * may use another thread to call the getStartProgress() to get the progress.
26      *
27      * @param systemSize system size in bytes
28      * @param userdataSize userdata size in bytes
29      * @return true if the call succeeds
30      */
startInstallation(long systemSize, long userdataSize)31     boolean startInstallation(long systemSize, long userdataSize);
32 
33     /**
34      * Query the progress of the current installation operation. This can be called while
35      * the installation is in progress.
36      *
37      * @return GsiProgress
38      */
getInstallationProgress()39     GsiProgress getInstallationProgress();
40 
41     /**
42      * Abort the installation process. Note this method must be called in a thread other
43      * than the one calling the startInstallation method as the startInstallation
44      * method will not return until it is finished.
45      *
46      * @return true if the call succeeds
47      */
abort()48     boolean abort();
49 
50     /**
51      * @return true if the device is running an DynamicAnroid image
52      */
isInUse()53     boolean isInUse();
54 
55     /**
56      * @return true if the device has an DynamicSystem image installed
57      */
isInstalled()58     boolean isInstalled();
59 
60     /**
61      * @return true if the device has an DynamicSystem image enabled
62      */
isEnabled()63     boolean isEnabled();
64 
65     /**
66      * Remove DynamicSystem installation if present
67      *
68      * @return true if the call succeeds
69      */
remove()70     boolean remove();
71 
72     /**
73      * Enable or disable DynamicSystem.
74      *
75      * @return true if the call succeeds
76      */
setEnable(boolean enable)77     boolean setEnable(boolean enable);
78 
79     /**
80      * Write a chunk of the DynamicSystem system image
81      *
82      * @return true if the call succeeds
83      */
write(in byte[] buf)84     boolean write(in byte[] buf);
85 
86     /**
87      * Finish write and make device to boot into the it after reboot.
88      *
89      * @return true if the call succeeds
90      */
commit()91     boolean commit();
92 }
93