PackageManagerInternal.java revision 2d5b465fa9235e66ec176f6d6ffaaa0c18143e41
1/*
2 * Copyright (C) 2015 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
17package android.content.pm;
18
19import android.content.ComponentName;
20import android.content.pm.PackageManager.NameNotFoundException;
21
22import java.util.List;
23
24/**
25 * Package manager local system service interface.
26 *
27 * @hide Only for use within the system server.
28 */
29public abstract class PackageManagerInternal {
30
31    /**
32     * Provider for package names.
33     */
34    public interface PackagesProvider {
35
36        /**
37         * Gets the packages for a given user.
38         * @param userId The user id.
39         * @return The package names.
40         */
41        public String[] getPackages(int userId);
42    }
43
44    /**
45     * Provider for package names.
46     */
47    public interface SyncAdapterPackagesProvider {
48
49        /**
50         * Gets the sync adapter packages for given authority and user.
51         * @param authority The authority.
52         * @param userId The user id.
53         * @return The package names.
54         */
55        public String[] getPackages(String authority, int userId);
56    }
57
58    /**
59     * Sets the location provider packages provider.
60     * @param provider The packages provider.
61     */
62    public abstract void setLocationPackagesProvider(PackagesProvider provider);
63
64    /**
65     * Sets the voice interaction packages provider.
66     * @param provider The packages provider.
67     */
68    public abstract void setVoiceInteractionPackagesProvider(PackagesProvider provider);
69
70    /**
71     * Sets the SMS packages provider.
72     * @param provider The packages provider.
73     */
74    public abstract void setSmsAppPackagesProvider(PackagesProvider provider);
75
76    /**
77     * Sets the dialer packages provider.
78     * @param provider The packages provider.
79     */
80    public abstract void setDialerAppPackagesProvider(PackagesProvider provider);
81
82    /**
83     * Sets the sim call manager packages provider.
84     * @param provider The packages provider.
85     */
86    public abstract void setSimCallManagerPackagesProvider(PackagesProvider provider);
87
88    /**
89     * Sets the sync adapter packages provider.
90     * @param provider The provider.
91     */
92    public abstract void setSyncAdapterPackagesprovider(SyncAdapterPackagesProvider provider);
93
94    /**
95     * Requests granting of the default permissions to the current default SMS app.
96     * @param packageName The default SMS package name.
97     * @param userId The user for which to grant the permissions.
98     */
99    public abstract void grantDefaultPermissionsToDefaultSmsApp(String packageName, int userId);
100
101    /**
102     * Requests granting of the default permissions to the current default dialer app.
103     * @param packageName The default dialer package name.
104     * @param userId The user for which to grant the permissions.
105     */
106    public abstract void grantDefaultPermissionsToDefaultDialerApp(String packageName, int userId);
107
108    /**
109     * Requests granting of the default permissions to the current default sim call manager.
110     * @param packageName The default sim call manager package name.
111     * @param userId The user for which to grant the permissions.
112     */
113    public abstract void grantDefaultPermissionsToDefaultSimCallManager(String packageName,
114            int userId);
115
116    /**
117     * Sets a list of apps to keep in PM's internal data structures and as APKs even if no user has
118     * currently installed it. The apps are not preloaded.
119     * @param packageList List of package names to keep cached.
120     */
121    public abstract void setKeepUninstalledPackages(List<String> packageList);
122
123    /**
124     * Gets whether some of the permissions used by this package require a user
125     * review before any of the app components can run.
126     * @param packageName The package name for which to check.
127     * @param userId The user under which to check.
128     * @return True a permissions review is required.
129     */
130    public abstract boolean isPermissionsReviewRequired(String packageName, int userId);
131
132    /**
133     * Gets all of the information we know about a particular package.
134     *
135     * @param packageName The package name to find.
136     * @param userId The user under which to check.
137     *
138     * @return An {@link ApplicationInfo} containing information about the
139     *         package.
140     * @throws NameNotFoundException if a package with the given name cannot be
141     *             found on the system.
142     */
143    public abstract ApplicationInfo getApplicationInfo(String packageName, int userId);
144
145    /**
146     * Interface to {@link com.android.server.pm.PackageManagerService#getHomeActivitiesAsUser}.
147     */
148    public abstract ComponentName getHomeActivitiesAsUser(List<ResolveInfo> allHomeCandidates,
149            int userId);
150}
151