blob: 087a4fec49c19247b4b48e3dd82204e8d1169f33 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
2 * Copyright (C) 2007 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package android.content.pm;
18
19import android.os.Parcel;
20import android.os.Parcelable;
Dianne Hackborneb034652009-09-07 00:49:58 -070021import android.util.Printer;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080022
23/**
24 * Information you can retrieve about a particular application
25 * service. This corresponds to information collected from the
26 * AndroidManifest.xml's <service> tags.
27 */
28public class ServiceInfo extends ComponentInfo
29 implements Parcelable {
30 /**
31 * Optional name of a permission required to be able to access this
32 * Service. From the "permission" attribute.
33 */
34 public String permission;
35
36 public ServiceInfo() {
37 }
38
39 public ServiceInfo(ServiceInfo orig) {
40 super(orig);
41 permission = orig.permission;
42 }
43
Dianne Hackborneb034652009-09-07 00:49:58 -070044 public void dump(Printer pw, String prefix) {
45 super.dumpFront(pw, prefix);
46 pw.println(prefix + "permission=" + permission);
47 }
48
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080049 public String toString() {
50 return "ServiceInfo{"
51 + Integer.toHexString(System.identityHashCode(this))
52 + " " + name + "}";
53 }
54
55 public int describeContents() {
56 return 0;
57 }
58
59 public void writeToParcel(Parcel dest, int parcelableFlags) {
60 super.writeToParcel(dest, parcelableFlags);
61 dest.writeString(permission);
62 }
63
64 public static final Creator<ServiceInfo> CREATOR =
65 new Creator<ServiceInfo>() {
66 public ServiceInfo createFromParcel(Parcel source) {
67 return new ServiceInfo(source);
68 }
69 public ServiceInfo[] newArray(int size) {
70 return new ServiceInfo[size];
71 }
72 };
73
74 private ServiceInfo(Parcel source) {
75 super(source);
76 permission = source.readString();
77 }
78}