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 android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.content.ComponentName;
22 import android.content.pm.FeatureInfo;
23 import android.content.pm.PackageManagerInternal;
24 import android.content.pm.TestUtilityService;
25 import android.os.Build;
26 import android.os.Handler;
27 import android.os.incremental.IncrementalManager;
28 import android.util.ArrayMap;
29 import android.util.ArraySet;
30 import android.util.DisplayMetrics;
31 
32 import com.android.internal.annotations.VisibleForTesting;
33 import com.android.internal.content.om.OverlayConfig;
34 import com.android.internal.pm.parsing.PackageParser2;
35 import com.android.server.pm.dex.ArtManagerService;
36 import com.android.server.pm.dex.DexManager;
37 import com.android.server.pm.dex.DynamicCodeLogger;
38 import com.android.server.pm.permission.LegacyPermissionManagerInternal;
39 import com.android.server.pm.pkg.AndroidPackage;
40 
41 import java.io.File;
42 import java.util.List;
43 import java.util.Set;
44 
45 @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
46 public final class PackageManagerServiceTestParams {
47     public ApexManager apexManager;
48     public @Nullable String appPredictionServicePackage;
49     public ArtManagerService artManagerService;
50     public @Nullable String configuratorPackage;
51     public int defParseFlags;
52     public DefaultAppProvider defaultAppProvider;
53     public DexManager dexManager;
54     public DynamicCodeLogger dynamicCodeLogger;
55     public List<ScanPartition> dirsToScanAsSystem;
56     public boolean factoryTest;
57     public ArrayMap<String, FeatureInfo> availableFeatures;
58     public Handler handler;
59     public @Nullable String incidentReportApproverPackage;
60     public IncrementalManager incrementalManager;
61     public PackageInstallerService installerService;
62     public InstantAppRegistry instantAppRegistry;
63     public final ChangedPackagesTracker changedPackagesTracker = new ChangedPackagesTracker();
64     public InstantAppResolverConnection instantAppResolverConnection;
65     public ComponentName instantAppResolverSettingsComponent;
66     public boolean isPreNmr1Upgrade;
67     public boolean isPreQupgrade;
68     public int priorSdkVersion = -1;
69     public boolean isUpgrade;
70     public LegacyPermissionManagerInternal legacyPermissionManagerInternal;
71     public DisplayMetrics Metrics;
72     public ModuleInfoProvider moduleInfoProvider;
73     public MovePackageHelper.MoveCallbacks moveCallbacks;
74     public boolean onlyCore;
75     public OverlayConfig overlayConfig;
76     public PackageDexOptimizer packageDexOptimizer;
77     public PackageParser2.Callback packageParserCallback;
78     public PendingPackageBroadcasts pendingPackageBroadcasts;
79     public PackageManagerInternal pmInternal;
80     public TestUtilityService testUtilityService;
81     public ProcessLoggingHandler processLoggingHandler;
82     public ProtectedPackages protectedPackages;
83     public @NonNull String requiredInstallerPackage;
84     public @NonNull String requiredPermissionControllerPackage;
85     public @NonNull String requiredUninstallerPackage;
86     public @NonNull String[] requiredVerifierPackages;
87     public String[] separateProcesses;
88     public @NonNull String servicesExtensionPackageName;
89     public @Nullable String setupWizardPackage;
90     public @NonNull String sharedSystemSharedLibraryPackageName;
91     public @Nullable String storageManagerPackage;
92     public @Nullable String defaultTextClassifierPackage;
93     public @Nullable String systemTextClassifierPackage;
94     public @Nullable String overlayConfigSignaturePackage;
95     public @NonNull String requiredSdkSandboxPackage;
96     public @Nullable String retailDemoPackage;
97     public @Nullable String recentsPackage;
98     public @Nullable String ambientContextDetectionPackage;
99     public @Nullable String wearableSensingPackage;
100     public ComponentName resolveComponentName;
101     public ArrayMap<String, AndroidPackage> packages;
102     public int sdkVersion;
103     public File appInstallDir;
104     public File appLib32InstallDir;
105     public boolean isEngBuild;
106     public boolean isUserDebugBuild;
107     public int sdkInt = Build.VERSION.SDK_INT;
108     public final String incrementalVersion = Build.VERSION.INCREMENTAL;
109     public BroadcastHelper broadcastHelper;
110     public AppDataHelper appDataHelper;
111     public InstallPackageHelper installPackageHelper;
112     public RemovePackageHelper removePackageHelper;
113     public InitAppsHelper initAndSystemPackageHelper;
114     public DeletePackageHelper deletePackageHelper;
115     public PreferredActivityHelper preferredActivityHelper;
116     public ResolveIntentHelper resolveIntentHelper;
117     public DexOptHelper dexOptHelper;
118     public SuspendPackageHelper suspendPackageHelper;
119     public DistractingPackageHelper distractingPackageHelper;
120     public StorageEventHelper storageEventHelper;
121     public final Set<String> initialNonStoppedSystemPackages = new ArraySet<>();
122     public boolean shouldStopSystemPackagesByDefault;
123     public FreeStorageHelper freeStorageHelper;
124     public PackageMonitorCallbackHelper packageMonitorCallbackHelper;
125 }
126