• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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.pm;
18 
19 import android.annotation.IntDef;
20 import android.annotation.NonNull;
21 import android.annotation.Nullable;
22 import android.annotation.SystemApi;
23 
24 import java.io.IOException;
25 import java.lang.annotation.Retention;
26 import java.lang.annotation.RetentionPolicy;
27 import java.util.List;
28 
29 /**
30  * In-process API for server side PackageManager related infrastructure.
31  *
32  * For now, avoiding adding methods that rely on package data until we solve the snapshot
33  * consistency problem.
34  *
35  * @hide
36  */
37 @SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
38 public interface PackageManagerLocal {
39 
40     /**
41      * Indicates if operation should include device encrypted storage.
42      */
43     int FLAG_STORAGE_DE = Installer.FLAG_STORAGE_DE;
44     /**
45      * Indicates if operation should include credential encrypted storage.
46      */
47     int FLAG_STORAGE_CE = Installer.FLAG_STORAGE_CE;
48 
49     /**
50      * Constants for use with {@link #reconcileSdkData} to specify which storage areas should be
51      * included for operation.
52      *
53      * @hide
54      */
55     @IntDef(prefix = "FLAG_STORAGE_",  value = {
56             FLAG_STORAGE_DE,
57             FLAG_STORAGE_CE,
58     })
59     @Retention(RetentionPolicy.SOURCE)
60     public @interface StorageFlags {}
61 
62     /**
63      * Reconcile sdk data sub-directories for the given {@code packagName}.
64      *
65      * Sub directories are created if they do not exist already. If there is an existing per-
66      * sdk directory that is missing from {@code subDirNames}, then it is removed.
67      *
68      * Sdk package path is created if it doesn't exist before creating per-sdk directories.
69      *
70      * @param volumeUuid the volume in which the sdk data should be prepared.
71      * @param packageName package name of the app for which sdk data directory will be prepared.
72      * @param subDirNames names of sub directories that should be reconciled against.
73      * @param userId id of the user to whom the package belongs to.
74      * @param appId id of the package.
75      * @param previousAppId previous id of the package if package is being updated.
76      * @param flags flags from StorageManager to indicate which storage areas should be included.
77      * @param seInfo seInfo tag to be used for selinux policy.
78      * @throws IOException If any error occurs during the operation.
79      */
reconcileSdkData(@ullable String volumeUuid, @NonNull String packageName, @NonNull List<String> subDirNames, int userId, int appId, int previousAppId, @NonNull String seInfo, @StorageFlags int flags)80     void reconcileSdkData(@Nullable String volumeUuid, @NonNull String packageName,
81             @NonNull List<String> subDirNames, int userId, int appId, int previousAppId,
82             @NonNull String seInfo, @StorageFlags int flags) throws IOException;
83 }
84