1 /*
2  * Copyright (C) 2021 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 import android.content.pm.ApplicationInfo;
18 
19 public class ApplicationInfoCompat {
20     private final ApplicationInfo mInfo;
21 
ApplicationInfoCompat(ApplicationInfo info)22     public ApplicationInfoCompat(ApplicationInfo info) {
23         this.mInfo = info;
24         this.enabledSetting = info.enabledSetting;
25 
26         this.volumeUuid = info.volumeUuid;
27         this.privateFlags = info.privateFlags;
28     }
29 
isSystemApp()30     public boolean isSystemApp() {
31         return this.mInfo.isSystemApp();
32     }
33 
34     public int enabledSetting;
35     public String volumeUuid;
36 
37     /**
38      * Value for {@link #privateFlags}: whether this app is pre-installed on the
39      * OEM partition of the system image.
40      */
41     public static final int PRIVATE_FLAG_OEM = ApplicationInfo.PRIVATE_FLAG_OEM;
42 
43     public static final int PRIVATE_FLAG_HIDDEN = ApplicationInfo.PRIVATE_FLAG_HIDDEN;
44 
45     /**
46      * Value for {@link #privateFlags}: whether this app is pre-installed on the
47      * vendor partition of the system image.
48      */
49     public static final int PRIVATE_FLAG_VENDOR = ApplicationInfo.PRIVATE_FLAG_VENDOR;
50 
51     /**
52      * Value for {@link #privateFlags}: whether this app is pre-installed on the
53      * product partition of the system image.
54      */
55     public static final int PRIVATE_FLAG_PRODUCT = ApplicationInfo.PRIVATE_FLAG_PRODUCT;
56 
57     public @ApplicationInfo.ApplicationInfoPrivateFlags
58     int privateFlags;
59 
isInternal()60     public boolean isInternal() {
61         return mInfo.isInternal();
62     }
63 }
64