Home | History | Annotate | Download | only in pm
      1 /*
      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 
     17 package android.content.pm;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 import android.util.Printer;
     22 
     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  */
     28 public 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 
     44     public void dump(Printer pw, String prefix) {
     45         super.dumpFront(pw, prefix);
     46         pw.println(prefix + "permission=" + permission);
     47     }
     48 
     49     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 }
     79