1 /*
2  * Copyright (C) 2020 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.server.rollback;
18 
19 import android.annotation.NonNull;
20 import android.os.UserHandle;
21 
22 import java.util.List;
23 
24 /**
25  * A partial interface of IRollbackManager used by the system server only.
26  *
27  * @hide
28  */
29 public interface RollbackManagerInternal {
30     /**
31      * Exposed for use from the system server only. Callback from the package
32      * manager during the install flow when user data can be backed up and restored for a given
33      * package.
34      *
35      * @param packageName Name of the package to restore/backup user data for
36      * @param users Users whose data to be restored/backed up
37      * @param appId ID of the package to restore/backup user data for
38      * @param ceDataInode The index node of CE data to restore/backup
39      * @param seInfo The seinfo tag used by SELinux policy
40      * @param token Used to inform the package manager that the pending package install is finished
41      */
snapshotAndRestoreUserData(@onNull String packageName, @NonNull List<UserHandle> users, int appId, long ceDataInode, @NonNull String seInfo, int token)42     void snapshotAndRestoreUserData(@NonNull String packageName, @NonNull List<UserHandle> users,
43             int appId, long ceDataInode, @NonNull String seInfo, int token);
44 
45     /**
46      * Used by the staging manager to notify the RollbackManager that a session is
47      * being staged. In the case of multi-package sessions, the specified sessionId
48      * is that of the parent session.
49      *
50      * NOTE: This call is synchronous.
51      *
52      * @param sessionId The session ID that is being staged
53      * @return The rollback id if rollback was enabled successfully, or -1 if not.
54      */
notifyStagedSession(int sessionId)55     int notifyStagedSession(int sessionId);
56 }
57