1 /*
2  * Copyright (C) 2022 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.service.games.testing;
18 
19 import android.os.Parcel;
20 import android.os.Parcelable;
21 
22 import androidx.annotation.NonNull;
23 
24 public final class OnSystemBarVisibilityChangedInfo implements Parcelable {
25     private int mTimesShown;
26     private int mTimesHidden;
27 
28     public static final Creator<OnSystemBarVisibilityChangedInfo> CREATOR =
29             new Creator<OnSystemBarVisibilityChangedInfo>() {
30                 @Override
31                 public OnSystemBarVisibilityChangedInfo createFromParcel(Parcel in) {
32                     int timesShown = in.readInt();
33                     int timesHidden = in.readInt();
34                     return new OnSystemBarVisibilityChangedInfo(timesShown, timesHidden);
35                 }
36 
37                 @Override
38                 public OnSystemBarVisibilityChangedInfo[] newArray(int size) {
39                     return new OnSystemBarVisibilityChangedInfo[size];
40                 }
41             };
42 
OnSystemBarVisibilityChangedInfo()43     public OnSystemBarVisibilityChangedInfo() {
44         this(0, 0);
45     }
46 
OnSystemBarVisibilityChangedInfo(int timesShown, int timesHidden)47     public OnSystemBarVisibilityChangedInfo(int timesShown,
48             int timesHidden) {
49         mTimesShown = timesShown;
50         mTimesHidden = timesHidden;
51     }
52 
incrementTimesShown()53     public void incrementTimesShown() {
54         mTimesShown++;
55     }
56 
incrementTimesHidden()57     public void incrementTimesHidden() {
58         mTimesHidden++;
59     }
60 
getTimesShown()61     public int getTimesShown() {
62         return mTimesShown;
63     }
64 
getTimesHidden()65     public int getTimesHidden() {
66         return mTimesHidden;
67     }
68 
69     @Override
describeContents()70     public int describeContents() {
71         return 0;
72     }
73 
74     @Override
writeToParcel(@onNull Parcel dest, int flags)75     public void writeToParcel(@NonNull Parcel dest, int flags) {
76         dest.writeInt(mTimesShown);
77         dest.writeInt(mTimesHidden);
78     }
79 }
80