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