1 /* 2 * Copyright (C) 2018 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.app.usage; 18 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * A pair of {package, bucket} to denote the app standby bucket for a given package. 24 * Used as a vehicle of data across the binder IPC. 25 * 26 * Note we're not moving this class to the jobscheduler apex, because it's consumed by 27 * UsageStatsManager, which is not updatable anyway, so making this updatable isn't really 28 * beneficial. 29 * @hide 30 */ 31 public final class AppStandbyInfo implements Parcelable { 32 33 public String mPackageName; 34 public @UsageStatsManager.StandbyBuckets int mStandbyBucket; 35 AppStandbyInfo(Parcel in)36 private AppStandbyInfo(Parcel in) { 37 mPackageName = in.readString(); 38 mStandbyBucket = in.readInt(); 39 } 40 AppStandbyInfo(String packageName, int bucket)41 public AppStandbyInfo(String packageName, int bucket) { 42 mPackageName = packageName; 43 mStandbyBucket = bucket; 44 } 45 46 @Override describeContents()47 public int describeContents() { 48 return 0; 49 } 50 51 @Override writeToParcel(Parcel dest, int flags)52 public void writeToParcel(Parcel dest, int flags) { 53 dest.writeString(mPackageName); 54 dest.writeInt(mStandbyBucket); 55 } 56 57 public static final @android.annotation.NonNull Creator<AppStandbyInfo> CREATOR = new Creator<AppStandbyInfo>() { 58 @Override 59 public AppStandbyInfo createFromParcel(Parcel source) { 60 return new AppStandbyInfo(source); 61 } 62 63 @Override 64 public AppStandbyInfo[] newArray(int size) { 65 return new AppStandbyInfo[size]; 66 } 67 }; 68 } 69