1eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad/*
2eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * Copyright (C) 2015 The Android Open Source Project
3eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad *
4eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * Licensed under the Apache License, Version 2.0 (the "License");
5eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * you may not use this file except in compliance with the License.
6eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * You may obtain a copy of the License at
7eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad *
8eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad *      http://www.apache.org/licenses/LICENSE-2.0
9eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad *
10eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * Unless required by applicable law or agreed to in writing, software
11eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * distributed under the License is distributed on an "AS IS" BASIS,
12eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * See the License for the specific language governing permissions and
14eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * limitations under the License.
15eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad */
16eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
17eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstadpackage android.content.om;
18eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
19eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstadimport android.content.om.OverlayInfo;
20eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
21eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad/**
22eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * Api for getting information about overlay packages.
23eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad *
24eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad * {@hide}
25eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad */
26eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstadinterface IOverlayManager {
27eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
28eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Returns information about all installed overlay packages for the
29eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * specified user. If there are no installed overlay packages for this user,
30eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * an empty map is returned (i.e. null is never returned). The returned map is a
31eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * mapping of target package names to lists of overlays. Each list for a
32eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * given target package is sorted in priority order, with the overlay with
33eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * the highest priority at the end of the list.
34eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
35eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user to get the OverlayInfos for.
36eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @return A Map<String, List<OverlayInfo>> with target package names
37eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *         mapped to lists of overlays; if no overlays exist for the
38eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *         requested user, an empty map is returned.
39eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
40eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    Map getAllOverlays(in int userId);
41eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
42eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
43eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Returns information about all overlays for the given target package for
44eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * the specified user. The returned list is ordered according to the
45eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * overlay priority with the highest priority at the end of the list.
46eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
47eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param targetPackageName The name of the target package.
48eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user to get the OverlayInfos for.
49eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @return A list of OverlayInfo objects; if no overlays exist for the
50eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *         requested package, an empty list is returned.
51eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
52eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    List getOverlayInfosForTarget(in String targetPackageName, in int userId);
53eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
54eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
55eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Returns information about the overlay with the given package name for the
56eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * specified user.
57eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
58eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param packageName The name of the overlay package.
59eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user to get the OverlayInfo for.
60eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @return The OverlayInfo for the overlay package; or null if no such
61eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *         overlay package exists.
62eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
63eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    OverlayInfo getOverlayInfo(in String packageName, in int userId);
64eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
65eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
66eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Request that an overlay package be enabled or disabled when possible to
67eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * do so.
68eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
69eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * It is always possible to disable an overlay, but due to technical and
70eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * security reasons it may not always be possible to enable an overlay. An
71eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * example of the latter is when the related target package is not
72eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * installed. If the technical obstacle is later overcome, the overlay is
73eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * automatically enabled at that point in time.
74eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
75eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * An enabled overlay is a part of target package's resources, i.e. it will
76eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * be part of any lookups performed via {@link android.content.res.Resources}
77eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * and {@link android.content.res.AssetManager}. A disabled overlay will no
78eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * longer affect the resources of the target package. If the target is
79eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * currently running, its outdated resources will be replaced by new ones.
80eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * This happens the same way as when an application enters or exits split
81eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * window mode.
82eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
83eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param packageName The name of the overlay package.
84eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param enable true to enable the overlay, false to disable it.
85eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user for which to change the overlay.
86eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @return true if the system successfully registered the request, false
87eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *         otherwise.
88eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
89eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    boolean setEnabled(in String packageName, in boolean enable, in int userId);
90eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
91eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
92929ed8d2f46209026cfa6f4baa68b551d54401a0Jason Monk     * Version of setEnabled that will also disable any other overlays for the target package.
93929ed8d2f46209026cfa6f4baa68b551d54401a0Jason Monk     */
94929ed8d2f46209026cfa6f4baa68b551d54401a0Jason Monk    boolean setEnabledExclusive(in String packageName, in boolean enable, in int userId);
95929ed8d2f46209026cfa6f4baa68b551d54401a0Jason Monk
96929ed8d2f46209026cfa6f4baa68b551d54401a0Jason Monk    /**
97eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Change the priority of the given overlay to be just higher than the
98eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * overlay with package name newParentPackageName. Both overlay packages
99eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * must have the same target and user.
100eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
101eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @see getOverlayInfosForTarget
102eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
103eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param packageName The name of the overlay package whose priority should
104eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *        be adjusted.
105eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param newParentPackageName The name of the overlay package the newly
106eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *        adjusted overlay package should just outrank.
107eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user for which to change the overlay.
108eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
109eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    boolean setPriority(in String packageName, in String newParentPackageName, in int userId);
110eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
111eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
112eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Change the priority of the given overlay to the highest priority relative to
113eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * the other overlays with the same target and user.
114eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
115eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @see getOverlayInfosForTarget
116eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
117eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param packageName The name of the overlay package whose priority should
118eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *        be adjusted.
119eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user for which to change the overlay.
120eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
121eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    boolean setHighestPriority(in String packageName, in int userId);
122eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad
123eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    /**
124eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * Change the priority of the overlay to the lowest priority relative to
125eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * the other overlays for the same target and user.
126eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
127eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @see getOverlayInfosForTarget
128eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *
129eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param packageName The name of the overlay package whose priority should
130eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     *        be adjusted.
131eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     * @param userId The user for which to change the overlay.
132eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad     */
133eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad    boolean setLowestPriority(in String packageName, in int userId);
134eabc9e95768e7ac9acc3b32dc9ac2edf99c9e2c5Mårten Kongstad}
135