Home | History | Annotate | Download | only in os
      1 /*
      2  * Copyright (C) 2009 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 com.android.internal.os;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 /**
     23  * implementation of PkgUsageStats associated with an
     24  * application package.
     25  *  @hide
     26  */
     27 public class PkgUsageStats implements Parcelable {
     28     public String packageName;
     29     public int launchCount;
     30     public long usageTime;
     31 
     32     public static final Parcelable.Creator<PkgUsageStats> CREATOR
     33     = new Parcelable.Creator<PkgUsageStats>() {
     34         public PkgUsageStats createFromParcel(Parcel in) {
     35             return new PkgUsageStats(in);
     36         }
     37 
     38         public PkgUsageStats[] newArray(int size) {
     39             return new PkgUsageStats[size];
     40         }
     41     };
     42 
     43     public String toString() {
     44         return "PkgUsageStats{"
     45         + Integer.toHexString(System.identityHashCode(this))
     46         + " " + packageName + "}";
     47     }
     48 
     49     public PkgUsageStats(String pkgName, int count, long time) {
     50         packageName = pkgName;
     51         launchCount = count;
     52         usageTime = time;
     53     }
     54 
     55     public PkgUsageStats(Parcel source) {
     56         packageName = source.readString();
     57         launchCount = source.readInt();
     58         usageTime = source.readLong();
     59     }
     60 
     61     public PkgUsageStats(PkgUsageStats pStats) {
     62         packageName = pStats.packageName;
     63         launchCount = pStats.launchCount;
     64         usageTime = pStats.usageTime;
     65     }
     66 
     67     public int describeContents() {
     68         return 0;
     69     }
     70 
     71     public void writeToParcel(Parcel dest, int parcelableFlags){
     72         dest.writeString(packageName);
     73         dest.writeInt(launchCount);
     74         dest.writeLong(usageTime);
     75     }
     76 }
     77