• 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.pkg;
18 
19 import android.annotation.NonNull;
20 import android.annotation.Nullable;
21 import android.content.pm.PackageManager;
22 import android.content.pm.overlay.OverlayPaths;
23 import android.os.UserHandle;
24 import android.util.ArraySet;
25 
26 import java.util.Map;
27 
28 /**
29  * The API surface for {@link PackageUserStateInternal}, for use by in-process mainline consumers.
30  *
31  * The parent of this class is {@link PackageState}, which handles non-user state, exposing this
32  * interface for per-user state.
33  *
34  * @hide
35  */
36 // TODO(b/173807334): Expose API
37 //@SystemApi(client = SystemApi.Client.SYSTEM_SERVER)
38 public interface PackageUserState {
39 
40     /** @hide */
41     @NonNull
42     PackageUserState DEFAULT = PackageUserStateInternal.DEFAULT;
43 
44     /**
45      * Combination of {@link #getOverlayPaths()} and {@link #getSharedLibraryOverlayPaths()}
46      * @hide
47      */
48     @Nullable
getAllOverlayPaths()49     OverlayPaths getAllOverlayPaths();
50 
51     /**
52      * Credential encrypted /data partition inode.
53      */
getCeDataInode()54     long getCeDataInode();
55 
56     /**
57      * Fully qualified class names of components explicitly disabled.
58      */
59     @NonNull
getDisabledComponents()60     ArraySet<String> getDisabledComponents();
61 
62     @PackageManager.DistractionRestriction
getDistractionFlags()63     int getDistractionFlags();
64 
65     /**
66      * Fully qualified class names of components explicitly enabled.
67      */
68     @NonNull
getEnabledComponents()69     ArraySet<String> getEnabledComponents();
70 
71     /**
72      * Retrieve the effective enabled state of the package itself.
73      */
74     @PackageManager.EnabledState
getEnabledState()75     int getEnabledState();
76 
77     /**
78      * @see PackageManager#setHarmfulAppWarning(String, CharSequence)
79      */
80     @Nullable
getHarmfulAppWarning()81     String getHarmfulAppWarning();
82 
83     @PackageManager.InstallReason
getInstallReason()84     int getInstallReason();
85 
86     /**
87      * Tracks the last calling package to set a specific enabled state for the package.
88      */
89     @Nullable
getLastDisableAppCaller()90     String getLastDisableAppCaller();
91 
92     /** @hide */
93     @Nullable
getOverlayPaths()94     OverlayPaths getOverlayPaths();
95 
96     /** @hide */
97     @NonNull
getSharedLibraryOverlayPaths()98     Map<String, OverlayPaths> getSharedLibraryOverlayPaths();
99 
100     @PackageManager.UninstallReason
getUninstallReason()101     int getUninstallReason();
102 
103     /**
104      * @return whether the given fully qualified class name is explicitly enabled
105      */
isComponentEnabled(@onNull String componentName)106     boolean isComponentEnabled(@NonNull String componentName);
107 
108     /**
109      * @return {@link #isComponentEnabled(String)} but for explicitly disabled
110      */
isComponentDisabled(@onNull String componentName)111     boolean isComponentDisabled(@NonNull String componentName);
112 
113     /**
114      * @see PackageManager#setApplicationHiddenSettingAsUser(String, boolean, UserHandle)
115      */
isHidden()116     boolean isHidden();
117 
118     /**
119      * @return whether the package is marked as installed for all users
120      */
isInstalled()121     boolean isInstalled();
122 
123     /**
124      * @return whether the package is marked as an ephemeral app, which restricts permissions,
125      * features, visibility
126      */
isInstantApp()127     boolean isInstantApp();
128 
129     /**
130      * @return whether the package has not been launched since being explicitly stopped
131      */
isNotLaunched()132     boolean isNotLaunched();
133 
134     /**
135      * @return whether the package has been stopped, which can occur if it's force-stopped, data
136      * cleared, or just been installed
137      */
isStopped()138     boolean isStopped();
139 
140     /**
141      * @return whether the package has been suspended, maybe by the device admin, disallowing its
142      * launch
143      */
isSuspended()144     boolean isSuspended();
145 
146     /**
147      * @return whether the package was installed as a virtual preload, which may be done as part
148      * of device infrastructure auto installation outside of the initial device image
149      */
isVirtualPreload()150     boolean isVirtualPreload();
151 
152     /**
153      * The "package:type/entry" form of the theme resource ID previously set as the splash screen.
154      * @see android.window.SplashScreen#setSplashScreenTheme(int)
155      * @see android.content.res.Resources#getResourceName(int)
156      */
157     @Nullable
getSplashScreenTheme()158     String getSplashScreenTheme();
159 
160     /**
161      * In epoch milliseconds. The timestamp of the first install of the app of the particular user
162      * on the device, surviving past app updates. Different users might have a different first
163      * install time.
164      *
165      * This does not survive full removal of the app (i.e., uninstalls for all users).
166      */
getFirstInstallTime()167     long getFirstInstallTime();
168 }
169