• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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 com.android.server.pm.parsing.pkg.AndroidPackage;
20 
21 import java.util.Collections;
22 import java.util.Map;
23 
24 /**
25  * Package scan results and related request details used to reconcile the potential addition of
26  * one or more packages to the system.
27  *
28  * Reconcile will take a set of package details that need to be committed to the system and make
29  * sure that they are valid in the context of the system and the other installing apps. Any
30  * invalid state or app will result in a failed reconciliation and thus whatever operation (such
31  * as install) led to the request.
32  */
33 final class ReconcileRequest {
34     public final Map<String, ScanResult> mScannedPackages;
35 
36     public final Map<String, AndroidPackage> mAllPackages;
37     public final Map<String, InstallArgs> mInstallArgs;
38     public final Map<String, PackageInstalledInfo> mInstallResults;
39     public final Map<String, PrepareResult> mPreparedPackages;
40     public final Map<String, Settings.VersionInfo> mVersionInfos;
41 
ReconcileRequest(Map<String, ScanResult> scannedPackages, Map<String, InstallArgs> installArgs, Map<String, PackageInstalledInfo> installResults, Map<String, PrepareResult> preparedPackages, Map<String, AndroidPackage> allPackages, Map<String, Settings.VersionInfo> versionInfos)42     ReconcileRequest(Map<String, ScanResult> scannedPackages,
43             Map<String, InstallArgs> installArgs,
44             Map<String, PackageInstalledInfo> installResults,
45             Map<String, PrepareResult> preparedPackages,
46             Map<String, AndroidPackage> allPackages,
47             Map<String, Settings.VersionInfo> versionInfos) {
48         mScannedPackages = scannedPackages;
49         mInstallArgs = installArgs;
50         mInstallResults = installResults;
51         mPreparedPackages = preparedPackages;
52         mAllPackages = allPackages;
53         mVersionInfos = versionInfos;
54     }
55 
ReconcileRequest(Map<String, ScanResult> scannedPackages, Map<String, AndroidPackage> allPackages, Map<String, Settings.VersionInfo> versionInfos)56     ReconcileRequest(Map<String, ScanResult> scannedPackages,
57             Map<String, AndroidPackage> allPackages,
58             Map<String, Settings.VersionInfo> versionInfos) {
59         this(scannedPackages, Collections.emptyMap(), Collections.emptyMap(),
60                 Collections.emptyMap(), allPackages, versionInfos);
61     }
62 }
63