1 /* 2 * Copyright (C) 2018 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.apex; 18 19 import android.apex.ApexInfo; 20 import android.apex.ApexInfoList; 21 import android.apex.ApexSessionInfo; 22 import android.apex.ApexSessionParams; 23 24 interface IApexService { submitStagedSession(in ApexSessionParams params, out ApexInfoList packages)25 void submitStagedSession(in ApexSessionParams params, out ApexInfoList packages); markStagedSessionReady(int session_id)26 void markStagedSessionReady(int session_id); markStagedSessionSuccessful(int session_id)27 void markStagedSessionSuccessful(int session_id); 28 getSessions()29 ApexSessionInfo[] getSessions(); getStagedSessionInfo(int session_id)30 ApexSessionInfo getStagedSessionInfo(int session_id); getActivePackages()31 ApexInfo[] getActivePackages(); getAllPackages()32 ApexInfo[] getAllPackages(); 33 abortStagedSession(int session_id)34 void abortStagedSession(int session_id); revertActiveSessions()35 void revertActiveSessions(); 36 37 /** 38 * Copies the CE apex data directory for the given user to the backup 39 * location, and returns the inode of the snapshot directory. 40 */ snapshotCeData(int user_id, int rollback_id, in @utf8InCpp String apex_name)41 long snapshotCeData(int user_id, int rollback_id, in @utf8InCpp String apex_name); 42 43 /** 44 * Restores the snapshot of the CE apex data directory for the given user and 45 * apex. Note the snapshot will be deleted after restoration succeeded. 46 */ restoreCeData(int user_id, int rollback_id, in @utf8InCpp String apex_name)47 void restoreCeData(int user_id, int rollback_id, in @utf8InCpp String apex_name); 48 49 /** 50 * Deletes device-encrypted snapshots for the given rollback id. 51 */ destroyDeSnapshots(int rollback_id)52 void destroyDeSnapshots(int rollback_id); 53 54 /** 55 * Deletes all credential-encrypted snapshots for the given user, except for 56 * those listed in retain_rollback_ids. 57 */ destroyCeSnapshotsNotSpecified(int user_id, in int[] retain_rollback_ids)58 void destroyCeSnapshotsNotSpecified(int user_id, in int[] retain_rollback_ids); 59 unstagePackages(in @tf8InCpp List<String> active_package_paths)60 void unstagePackages(in @utf8InCpp List<String> active_package_paths); 61 62 /** 63 * Returns the active package corresponding to |package_name| and null 64 * if none exists. 65 */ getActivePackage(in @tf8InCpp String package_name)66 ApexInfo getActivePackage(in @utf8InCpp String package_name); 67 68 /** 69 * Not meant for use outside of testing. The call will not be 70 * functional on user builds. 71 */ activatePackage(in @tf8InCpp String package_path)72 void activatePackage(in @utf8InCpp String package_path); 73 /** 74 * Not meant for use outside of testing. The call will not be 75 * functional on user builds. 76 */ deactivatePackage(in @tf8InCpp String package_path)77 void deactivatePackage(in @utf8InCpp String package_path); 78 /** 79 * Not meant for use outside of testing. The call will not be 80 * functional on user builds. 81 */ preinstallPackages(in @tf8InCpp List<String> package_tmp_paths)82 void preinstallPackages(in @utf8InCpp List<String> package_tmp_paths); 83 /** 84 * Not meant for use outside of testing. The call will not be 85 * functional on user builds. 86 */ postinstallPackages(in @tf8InCpp List<String> package_tmp_paths)87 void postinstallPackages(in @utf8InCpp List<String> package_tmp_paths); 88 /** 89 * Not meant for use outside of testing. The call will not be 90 * functional on user builds. 91 */ stagePackages(in @tf8InCpp List<String> package_tmp_paths)92 void stagePackages(in @utf8InCpp List<String> package_tmp_paths); 93 /** 94 * Not meant for use outside of testing. The call will not be 95 * functional on user builds. 96 */ resumeRevertIfNeeded()97 void resumeRevertIfNeeded(); 98 /** 99 * Forces apexd to remount all active packages. 100 * 101 * This call is mostly useful for speeding up development of APEXes. 102 * Instead of going through a full APEX installation that requires a reboot, 103 * developers can incorporate this method in much faster `adb sync` based 104 * workflow: 105 * 106 * 1. adb shell stop 107 * 2. adb sync 108 * 3. adb shell cmd -w apexservice remountPackages 109 * 4. adb shell start 110 * 111 * Note, that for an APEX package will be successfully remounted only if 112 * there are no alive processes holding a reference to it. 113 * 114 * Not meant for use outside of testing. This call will not be functional 115 * on user builds. Only root is allowed to call this method. 116 */ remountPackages()117 void remountPackages(); 118 /** 119 * Forces apexd to recollect pre-installed data from the given |paths|. 120 * 121 * Not meant for use outside of testing. This call will not be functional 122 * on user builds. Only root is allowed to call this method. 123 */ recollectPreinstalledData(in @tf8InCpp List<String> paths)124 void recollectPreinstalledData(in @utf8InCpp List<String> paths); 125 } 126