blob: 618f88c66d0fe5d435f0444f41044c3d0a88de59 [file] [log] [blame]
Todd Kennedy757186e2017-08-02 07:49:20 -07001/*
2**
3** Copyright 2017, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9** http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18package android.content.pm;
19
20/**
21 * Parallel implementation of certain {@link PackageManager} APIs that need to
22 * be exposed to native code.
23 * <p>These APIs are a parallel definition to the APIs in PackageManager, so,
24 * they can technically diverge. However, it's good practice to keep these
25 * APIs in sync with each other.
26 * <p>Because these APIs are exposed to native code, it's possible they will
27 * be exposed to privileged components [such as UID 0]. Care should be taken
28 * to avoid exposing potential security holes for methods where permission
29 * checks are bypassed based upon UID alone.
30 *
31 * @hide
32 */
33interface IPackageManagerNative {
34 /**
35 * Returns a set of names for the given UIDs.
36 * IMPORTANT: Unlike the Java version of this API, unknown UIDs are
37 * not represented by 'null's. Instead, they are represented by empty
38 * strings.
39 */
40 @utf8InCpp String[] getNamesForUids(in int[] uids);
Ray Essick13afdfc2017-09-19 08:49:23 -070041
42 /**
43 * Returns the name of the installer (a package) which installed the named
44 * package. Preloaded packages return the string "preload". Sideloaded packages
45 * return an empty string. Unknown or unknowable are returned as empty strings.
46 */
47
48 @utf8InCpp String getInstallerForPackage(in String packageName);
49
50 /**
51 * Returns the version code of the named package.
52 * Unknown or unknowable versions are returned as 0.
53 */
54
Dianne Hackborne2a8e8d2017-11-27 14:02:15 -080055 long getVersionCodeForPackage(in String packageName);
Ray Essick13afdfc2017-09-19 08:49:23 -070056
Kevin Rocarde45eb312019-02-22 09:49:24 -080057 /**
58 * Return if each app, identified by its package name allows its audio to be recorded.
59 * Unknown packages are mapped to false.
60 */
61 boolean[] isAudioPlaybackCaptureAllowed(in @utf8InCpp String[] packageNames);
Przemyslaw Szczepaniak097e2952019-03-07 11:04:18 +000062
63 /* ApplicationInfo.isSystemApp() == true */
64 const int LOCATION_SYSTEM = 0x1;
65 /* ApplicationInfo.isVendor() == true */
66 const int LOCATION_VENDOR = 0x2;
67 /* ApplicationInfo.isProduct() == true */
68 const int LOCATION_PRODUCT = 0x4;
Przemyslaw Szczepaniak097e2952019-03-07 11:04:18 +000069
70 /**
71 * Returns a set of bitflags about package location.
72 * LOCATION_SYSTEM: getApplicationInfo(packageName).isSystemApp()
73 * LOCATION_VENDOR: getApplicationInfo(packageName).isVendor()
74 * LOCATION_PRODUCT: getApplicationInfo(packageName).isProduct()
Przemyslaw Szczepaniak097e2952019-03-07 11:04:18 +000075 */
76 int getLocationFlags(in @utf8InCpp String packageName);
Brian Stack7aa40b62019-04-18 17:14:59 -070077
78 /**
79 * Returns the target SDK version for the given package.
80 * Unknown packages will cause the call to fail. The caller must check the
81 * returned Status before using the result of this function.
82 */
83 int getTargetSdkVersionForPackage(in String packageName);
Nikita Ioffe535e1ac2019-05-16 18:16:59 +010084
85 /**
86 * Returns the name of module metadata package, or empty string if device doesn't have such
87 * package.
88 */
89 @utf8InCpp String getModuleMetadataPackageName();
Yan Wang7851e172020-02-04 11:44:03 -080090
91 /* Returns the names of all packages. */
92 @utf8InCpp String[] getAllPackages();
Todd Kennedy757186e2017-08-02 07:49:20 -070093}