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.internal.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
26  * {@link com.android.server.pm.parsing.pkg.AndroidPackageUtils} or a system manager 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  * @hide
34  */
35 // TODO: remove public after moved PackageImpl and AndroidPackageUtils
36 public interface AndroidPackageHidden {
37 
38     /**
39      * @see ApplicationInfo#primaryCpuAbi
40      */
41     @Nullable
getPrimaryCpuAbi()42     String getPrimaryCpuAbi();
43 
44     /**
45      * @see ApplicationInfo#secondaryCpuAbi
46      */
47     @Nullable
getSecondaryCpuAbi()48     String getSecondaryCpuAbi();
49 
50     /**
51      * @see PackageInfo#versionCode
52      * @see ApplicationInfo#versionCode
53      */
54     @Deprecated
getVersionCode()55     int getVersionCode();
56 
57     /**
58      * @see PackageInfo#versionCodeMajor
59      */
getVersionCodeMajor()60     int getVersionCodeMajor();
61 
62     // TODO(b/135203078): Hide and enforce going through PackageInfoUtils
toAppInfoWithoutState()63     ApplicationInfo toAppInfoWithoutState();
64 
65     // TODO: Remove these booleans and store the value directly inside PackageState
isSystem()66     boolean isSystem();
67 
isSystemExt()68     boolean isSystemExt();
69 
isPrivileged()70     boolean isPrivileged();
71 
isOem()72     boolean isOem();
73 
isVendor()74     boolean isVendor();
75 
isProduct()76     boolean isProduct();
77 
isOdm()78     boolean isOdm();
79 }
80