1 /*
2  * Copyright (C) 2015 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 android.os;
18 
19 import android.os.IUpdateEngineCallback;
20 import android.os.ParcelFileDescriptor;
21 
22 /** @hide */
23 interface IUpdateEngine {
24   /** @hide */
applyPayload(String url, in long payload_offset, in long payload_size, in String[] headerKeyValuePairs)25   void applyPayload(String url,
26                     in long payload_offset,
27                     in long payload_size,
28                     in String[] headerKeyValuePairs);
29   /** @hide */
applyPayloadFd(in ParcelFileDescriptor pfd, in long payload_offset, in long payload_size, in String[] headerKeyValuePairs)30   void applyPayloadFd(in ParcelFileDescriptor pfd,
31                       in long payload_offset,
32                       in long payload_size,
33                       in String[] headerKeyValuePairs);
34   /** @hide */
bind(IUpdateEngineCallback callback)35   boolean bind(IUpdateEngineCallback callback);
36   /** @hide */
unbind(IUpdateEngineCallback callback)37   boolean unbind(IUpdateEngineCallback callback);
38   /** @hide */
suspend()39   void suspend();
40   /** @hide */
resume()41   void resume();
42   /** @hide */
cancel()43   void cancel();
44   /** @hide */
resetStatus()45   void resetStatus();
46   /** @hide */
verifyPayloadApplicable(in String metadataFilename)47   boolean verifyPayloadApplicable(in String metadataFilename);
48   /**
49    * Allocate space on userdata partition.
50    *
51    * @return 0 indicates allocation is successful.
52    *   Non-zero indicates space is insufficient. The returned value is the
53    *   total required space (in bytes) on userdata partition.
54    *
55    * @throws ServiceSpecificException for other errors.
56    *
57    * @hide
58    */
allocateSpaceForPayload(in String metadataFilename, in String[] headerKeyValuePairs)59   long allocateSpaceForPayload(in String metadataFilename,
60                                in String[] headerKeyValuePairs);
61   /** @hide
62    *
63    * Wait for merge to finish, and clean up necessary files.
64    *
65    * @param callback Report status updates in callback (not the one previously
66    * bound with {@link #bind()}).
67    * {@link IUpdateEngineCallback#onStatusUpdate} is called with
68    * CLEANUP_PREVIOUS_UPDATE and a progress value during the cleanup.
69    * {@link IUpdateEngineCallback#onPayloadApplicationComplete} is called at
70    * the end with SUCCESS if successful. ERROR if transient errors (e.g. merged
71    * but needs reboot). DEVICE_CORRUPTED for permanent errors.
72    */
cleanupSuccessfulUpdate(IUpdateEngineCallback callback)73   void cleanupSuccessfulUpdate(IUpdateEngineCallback callback);
74 }
75