blob: 6f9df652a079e48ae6456bc2616230c2ae92cd6d [file] [log] [blame]
Christopher Tate487529a2009-04-29 14:03:25 -07001/*
2 * Copyright (C) 2009 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
17package com.android.internal.backup;
18
Christopher Tate7b881282009-06-07 13:52:37 -070019import android.content.pm.PackageInfo;
Christopher Tatee10be802009-05-07 17:22:16 -070020import android.os.ParcelFileDescriptor;
21
Christopher Tate487529a2009-04-29 14:03:25 -070022/** {@hide} */
23interface IBackupTransport {
Christopher Tatee10be802009-05-07 17:22:16 -070024/* STOPSHIP - don't ship with this comment in place
25 Things the transport interface has to do:
26 1. set up the connection to the destination
27 - set up encryption
28 - for Google cloud, log in using the user's gaia credential or whatever
Christopher Tate7b881282009-06-07 13:52:37 -070029 - for adb, just set up the all-in-one destination file
Christopher Tatee10be802009-05-07 17:22:16 -070030 2. send each app's backup transaction
31 - parse the data file for key/value pointers etc
32 - send key/blobsize set to the Google cloud, get back quota ok/rejected response
33 - sd/adb doesn't preflight; no per-app quota
34 - app's entire change is essentially atomic
35 - cloud transaction encrypts then sends each key/value pair separately; we already
36 parsed the data when preflighting so we don't have to again here
37 - sd target streams raw data into encryption envelope then to sd?
38 3. shut down connection to destination
39 - cloud: tear down connection etc
Christopher Tate7b881282009-06-07 13:52:37 -070040 - adb: close the file
Christopher Tatee10be802009-05-07 17:22:16 -070041*/
42 /**
43 * Establish a connection to the back-end data repository, if necessary. If the transport
44 * needs to initialize state that is not tied to individual applications' backup operations,
45 * this is where it should be done.
46 *
47 * @return Zero on success; a nonzero error code on failure.
48 */
49 int startSession();
50
51 /**
52 * Send one application's data to the backup destination.
53 *
Christopher Tate7b881282009-06-07 13:52:37 -070054 * @param package The identity of the application whose data is being backed up. This
55 * specifically includes the signature list for the package.
Christopher Tatee10be802009-05-07 17:22:16 -070056 * @param data The data stream that resulted from invoking the application's
Christopher Tate7b881282009-06-07 13:52:37 -070057 * BackupService.doBackup() method. This may be a pipe rather than a file on
58 * persistent media, so it may not be seekable.
Christopher Tatee10be802009-05-07 17:22:16 -070059 * @return Zero on success; a nonzero error code on failure.
60 */
Christopher Tate7b881282009-06-07 13:52:37 -070061 int performBackup(in PackageInfo packageInfo, in ParcelFileDescriptor data);
Christopher Tatee10be802009-05-07 17:22:16 -070062
63 /**
64 * Terminate the backup session, closing files, freeing memory, and cleaning up whatever
65 * other state the transport required.
66 *
67 * @return Zero on success; a nonzero error code on failure. Even on failure, the session
68 * is torn down and must be restarted if another backup is attempted.
69 */
70 int endSession();
Christopher Tate487529a2009-04-29 14:03:25 -070071}