1 /*
2  * Copyright (C) 2020 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 com.android.server.pm.parsing.pkg;
18 
19 import android.annotation.Nullable;
20 import android.content.pm.ApplicationInfo;
21 import android.content.pm.PackageInfo;
22 
23 /**
24  * Methods that normal consumers should not have access to. This usually means the field is stateful
25  * or deprecated and should be access through {@link AndroidPackageUtils} or a system manager
26  * class.
27  * <p>
28  * This is a separate interface, not implemented by the base {@link AndroidPackage} because Java
29  * doesn't support non-public interface methods. The class must be cast to this interface.
30  * <p>
31  * Because they exist in different packages, some methods are duplicated from
32  * android.content.pm.parsing.ParsingPackageHidden.
33  */
34 interface AndroidPackageHidden {
35 
36     /**
37      * @see ApplicationInfo#primaryCpuAbi
38      */
39     @Nullable
getPrimaryCpuAbi()40     String getPrimaryCpuAbi();
41 
42     /**
43      * @see ApplicationInfo#secondaryCpuAbi
44      */
45     @Nullable
getSecondaryCpuAbi()46     String getSecondaryCpuAbi();
47 
48     /**
49      * @see PackageInfo#versionCode
50      * @see ApplicationInfo#versionCode
51      */
52     @Deprecated
getVersionCode()53     int getVersionCode();
54 
55     /**
56      * @see PackageInfo#versionCodeMajor
57      */
getVersionCodeMajor()58     int getVersionCodeMajor();
59 
60     // TODO(b/135203078): Hide and enforce going through PackageInfoUtils
toAppInfoWithoutState()61     ApplicationInfo toAppInfoWithoutState();
62 
63     // TODO: Remove these booleans and store the value directly inside PackageState
isSystem()64     boolean isSystem();
65 
isSystemExt()66     boolean isSystemExt();
67 
isPrivileged()68     boolean isPrivileged();
69 
isOem()70     boolean isOem();
71 
isVendor()72     boolean isVendor();
73 
isProduct()74     boolean isProduct();
75 
isOdm()76     boolean isOdm();
77 }
78