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.om; 18 19 import android.content.om.OverlayInfo; 20 21 /** 22 * Api for getting information about overlay packages. 23 * 24 * {@hide} 25 */ 26 interface IOverlayManager { 27 /** 28 * Returns information about all installed overlay packages for the 29 * specified user. If there are no installed overlay packages for this user, 30 * an empty map is returned (i.e. null is never returned). The returned map is a 31 * mapping of target package names to lists of overlays. Each list for a 32 * given target package is sorted in priority order, with the overlay with 33 * the highest priority at the end of the list. 34 * 35 * @param userId The user to get the OverlayInfos for. 36 * @return A Map<String, List<OverlayInfo>> with target package names 37 * mapped to lists of overlays; if no overlays exist for the 38 * requested user, an empty map is returned. 39 */ 40 @UnsupportedAppUsage getAllOverlays(in int userId)41 Map getAllOverlays(in int userId); 42 43 /** 44 * Returns information about all overlays for the given target package for 45 * the specified user. The returned list is ordered according to the 46 * overlay priority with the highest priority at the end of the list. 47 * 48 * @param targetPackageName The name of the target package. 49 * @param userId The user to get the OverlayInfos for. 50 * @return A list of OverlayInfo objects; if no overlays exist for the 51 * requested package, an empty list is returned. 52 */ getOverlayInfosForTarget(in String targetPackageName, in int userId)53 List getOverlayInfosForTarget(in String targetPackageName, in int userId); 54 55 /** 56 * Returns information about the overlay with the given package name for the 57 * specified user. 58 * 59 * @param packageName The name of the overlay package. 60 * @param userId The user to get the OverlayInfo for. 61 * @return The OverlayInfo for the overlay package; or null if no such 62 * overlay package exists. 63 */ 64 @UnsupportedAppUsage getOverlayInfo(in String packageName, in int userId)65 OverlayInfo getOverlayInfo(in String packageName, in int userId); 66 67 /** 68 * Request that an overlay package be enabled or disabled when possible to 69 * do so. 70 * 71 * It is always possible to disable an overlay, but due to technical and 72 * security reasons it may not always be possible to enable an overlay. An 73 * example of the latter is when the related target package is not 74 * installed. If the technical obstacle is later overcome, the overlay is 75 * automatically enabled at that point in time. 76 * 77 * An enabled overlay is a part of target package's resources, i.e. it will 78 * be part of any lookups performed via {@link android.content.res.Resources} 79 * and {@link android.content.res.AssetManager}. A disabled overlay will no 80 * longer affect the resources of the target package. If the target is 81 * currently running, its outdated resources will be replaced by new ones. 82 * This happens the same way as when an application enters or exits split 83 * window mode. 84 * 85 * @param packageName The name of the overlay package. 86 * @param enable true to enable the overlay, false to disable it. 87 * @param userId The user for which to change the overlay. 88 * @return true if the system successfully registered the request, false otherwise. 89 */ setEnabled(in String packageName, in boolean enable, in int userId)90 boolean setEnabled(in String packageName, in boolean enable, in int userId); 91 92 /** 93 * Request that an overlay package is enabled and any other overlay packages with the same 94 * target package are disabled. 95 * 96 * See {@link #setEnabled} for the details on overlay packages. 97 * 98 * @param packageName the name of the overlay package to enable. 99 * @param enabled must be true, otherwise the operation fails. 100 * @param userId The user for which to change the overlay. 101 * @return true if the system successfully registered the request, false otherwise. 102 */ setEnabledExclusive(in String packageName, in boolean enable, in int userId)103 boolean setEnabledExclusive(in String packageName, in boolean enable, in int userId); 104 105 /** 106 * Request that an overlay package is enabled and any other overlay packages with the same 107 * target package and category are disabled. 108 * 109 * See {@link #setEnabled} for the details on overlay packages. 110 * 111 * @param packageName the name of the overlay package to enable. 112 * @param userId The user for which to change the overlay. 113 * @return true if the system successfully registered the request, false otherwise. 114 */ setEnabledExclusiveInCategory(in String packageName, in int userId)115 boolean setEnabledExclusiveInCategory(in String packageName, in int userId); 116 117 /** 118 * Change the priority of the given overlay to be just higher than the 119 * overlay with package name newParentPackageName. Both overlay packages 120 * must have the same target and user. 121 * 122 * @see getOverlayInfosForTarget 123 * 124 * @param packageName The name of the overlay package whose priority should 125 * be adjusted. 126 * @param newParentPackageName The name of the overlay package the newly 127 * adjusted overlay package should just outrank. 128 * @param userId The user for which to change the overlay. 129 */ setPriority(in String packageName, in String newParentPackageName, in int userId)130 boolean setPriority(in String packageName, in String newParentPackageName, in int userId); 131 132 /** 133 * Change the priority of the given overlay to the highest priority relative to 134 * the other overlays with the same target and user. 135 * 136 * @see getOverlayInfosForTarget 137 * 138 * @param packageName The name of the overlay package whose priority should 139 * be adjusted. 140 * @param userId The user for which to change the overlay. 141 */ setHighestPriority(in String packageName, in int userId)142 boolean setHighestPriority(in String packageName, in int userId); 143 144 /** 145 * Change the priority of the overlay to the lowest priority relative to 146 * the other overlays for the same target and user. 147 * 148 * @see getOverlayInfosForTarget 149 * 150 * @param packageName The name of the overlay package whose priority should 151 * be adjusted. 152 * @param userId The user for which to change the overlay. 153 */ setLowestPriority(in String packageName, in int userId)154 boolean setLowestPriority(in String packageName, in int userId); 155 156 /** 157 * Returns the list of default overlay packages, or an empty array if there are none. 158 */ getDefaultOverlayPackages()159 String[] getDefaultOverlayPackages(); 160 } 161