1/*
2 * Copyright (C) 2017 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
17syntax = "proto2";
18package android.service.pm;
19
20import "frameworks/base/core/proto/android/content/featureinfo.proto";
21import "frameworks/base/core/proto/android/privacy.proto";
22
23option java_multiple_files = true;
24option java_outer_classname = "PackageServiceProto";
25
26message PackageServiceDumpProto {
27    option (android.msg_privacy).dest = DEST_AUTOMATIC;
28
29    message PackageShortProto {
30        option (android.msg_privacy).dest = DEST_AUTOMATIC;
31
32        // Name of package. e.g. "com.android.providers.telephony".
33        optional string name = 1;
34        // UID for this package as assigned by Android OS.
35        optional int32 uid = 2;
36    }
37    message SharedLibraryProto {
38        option (android.msg_privacy).dest = DEST_AUTOMATIC;
39
40        optional string name = 1;
41        // True if library path is not null (jar), false otherwise (apk)
42        optional bool is_jar = 2;
43        // Should be filled if is_jar is true
44        optional string path = 3;
45        // Should be filled if is_jar is false
46        optional string apk = 4;
47    }
48    message SharedUserProto {
49        option (android.msg_privacy).dest = DEST_AUTOMATIC;
50
51        optional int32 uid = 1;
52        // Name of the shared UID. eg: android.uid.bluetooth
53        optional string name = 2;
54    }
55
56    // Installed packages.
57    optional PackageShortProto required_verifier_package = 1;
58    optional PackageShortProto verifier_package = 2;
59    repeated SharedLibraryProto shared_libraries = 3;
60    repeated android.content.pm.FeatureInfoProto features = 4;
61    repeated PackageProto packages = 5;
62    repeated SharedUserProto shared_users = 6;
63    // Messages from the settings problem file
64    repeated string messages = 7 [ (android.privacy).dest = DEST_EXPLICIT ];
65}
66
67message PackageProto {
68    option (android.msg_privacy).dest = DEST_AUTOMATIC;
69
70    message SplitProto {
71        option (android.msg_privacy).dest = DEST_AUTOMATIC;
72
73        // The split name of package, e.g. base
74        optional string name = 1;
75        optional int32 revision_code = 2;
76    }
77    message UserInfoProto {
78        option (android.msg_privacy).dest = DEST_AUTOMATIC;
79
80        enum InstallType {
81            NOT_INSTALLED_FOR_USER = 0;
82            FULL_APP_INSTALL = 1;
83            INSTANT_APP_INSTALL = 2;
84        }
85        // Enum values gotten from PackageManger.java
86        enum EnabledState {
87            // This component or application is in its default enabled state
88            // (as specified in its manifest).
89            COMPONENT_ENABLED_STATE_DEFAULT = 0;
90            // This component or application has been explictily enabled, regardless
91            // of what it has specified in its manifest.
92            COMPONENT_ENABLED_STATE_ENABLED = 1;
93            // This component or application has been explicitly disabled, regardless of
94            // what it has specified in its manifest.
95            COMPONENT_ENABLED_STATE_DISABLED = 2;
96            // The user has explicitly disabled the application, regardless of what it has
97            // specified in its manifest.
98            COMPONENT_ENABLED_STATE_DISABLED_USER = 3;
99            // This application should be considered, until the point where the user actually
100            // wants to use it.
101            COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4;
102        }
103
104        // Information about the state of an archived app.
105        // All fields are gathered at the time of archival.
106        message ArchiveState {
107            option (android.msg_privacy).dest = DEST_AUTOMATIC;
108
109            message ArchiveActivityInfo {
110                // Corresponds to android:label in the app's locale at the time of archival.
111                optional string title = 1;
112
113                // Icon of the archived app.
114                optional string icon_bitmap_path = 2;
115
116                // Only set if the app defined a monochrome icon.
117                optional string monochrome_icon_bitmap_path = 3;
118
119                // The component name of the original activity (pre-archival).
120                optional string original_component_name = 4;
121            }
122
123            /** Information about main activities. */
124            repeated ArchiveActivityInfo activity_infos = 1;
125
126            // Corresponds to android:label of the installer responsible for the unarchival of the
127            // app. Stored in the installer's locale at the time of archival.
128            optional string installer_title = 2;
129        }
130
131        optional int32 id = 1;
132        optional InstallType install_type = 2;
133        // Is the app restricted by owner / admin
134        optional bool is_hidden = 3;
135        optional bool is_suspended = 4;
136        optional bool is_stopped = 5;
137        optional bool is_launched = 6;
138        optional EnabledState enabled_state = 7;
139        optional string last_disabled_app_caller = 8;
140        repeated string suspending_package = 9;
141        optional int32 distraction_flags = 10;
142        // UTC timestamp of first install for the user
143        optional int32 first_install_time_ms = 11;
144        optional ArchiveState archive_state = 12;
145        repeated int32 suspending_user = 13;
146    }
147
148    message InstallSourceProto {
149        option (android.msg_privacy).dest = DEST_AUTOMATIC;
150
151        // The package that requested the installation of this one.
152        optional string initiating_package_name = 1;
153
154        // The package on behalf of which the initiiating package requested the install.
155        optional string originating_package_name = 2;
156
157        // The package that is the update owner.
158        optional string update_owner_package_name = 3;
159    }
160
161    message StatesProto {
162        reserved 1;
163        optional bool is_loading = 2;
164    }
165
166    // TODO (b/170263003) refactor to permissiongr
167    // Runtime permission state that are granted for users.
168    message UserPermissionsProto {
169        option (android.msg_privacy).dest = DEST_AUTOMATIC;
170        // User id.
171        optional int32 id = 1;
172        // Pre-granted Android permissions.
173        repeated string granted_permissions = 2;
174    }
175
176    // Name of package. e.g. "com.android.providers.telephony".
177    optional string name = 1;
178    // UID for this package as assigned by Android OS.
179    optional int32 uid = 2;
180    // Package's reported version.
181    optional int32 version_code = 3;
182    // Package's reported version string (what's displayed to the user).
183    optional string version_string = 4;
184    reserved 5;
185    // Millisecond UTC timestamp of latest update adjusted to Google's server clock.
186    optional int64 update_time_ms = 6;
187    // From "dumpsys package" - name of package which installed this one.
188    // Typically "" if system app or "com.android.vending" if Play Store.
189    optional string installer_name = 7;
190    // Split APKs.
191    repeated SplitProto splits = 8;
192    // Per-user package info.
193    repeated UserInfoProto users = 9;
194    // Where the request to install this package came from,
195    optional InstallSourceProto install_source = 10;
196    // Whether the package is still loading
197    optional StatesProto states = 11;
198    // Granted runtime permissions for users.
199    repeated UserPermissionsProto user_permissions = 12;
200}
201