PackageUserState.java revision d4ac8d7b3de27a9f0e4c6af2496ca71d794e42d1
1/*
2 * Copyright (C) 2012 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
17package android.content.pm;
18
19import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
20
21import java.util.HashSet;
22
23/**
24 * Per-user state information about a package.
25 * @hide
26 */
27public class PackageUserState {
28    public boolean stopped;
29    public boolean notLaunched;
30    public boolean installed;
31    public int enabled;
32
33    public HashSet<String> disabledComponents;
34    public HashSet<String> enabledComponents;
35
36    public PackageUserState() {
37        this(true);
38    }
39
40    /** @hide */
41    public PackageUserState(boolean isSystem) {
42        if (!isSystem) {
43            stopped = notLaunched = true;
44        }
45        installed = true;
46        enabled = COMPONENT_ENABLED_STATE_DEFAULT;
47    }
48
49    public PackageUserState(PackageUserState o) {
50        installed = o.installed;
51        stopped = o.stopped;
52        notLaunched = o.notLaunched;
53        enabled = o.enabled;
54        disabledComponents = o.disabledComponents != null
55                ? new HashSet<String>(o.disabledComponents) : null;
56        enabledComponents = o.enabledComponents != null
57                ? new HashSet<String>(o.enabledComponents) : null;
58    }
59}