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