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; 18 19 import android.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.content.Intent; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 25 import com.android.internal.annotations.VisibleForTesting; 26 27 28 /** @hide */ 29 @VisibleForTesting 30 public final class GameSessionActivityResult implements Parcelable { 31 32 public static final Creator<GameSessionActivityResult> CREATOR = 33 new Creator<GameSessionActivityResult>() { 34 @Override 35 public GameSessionActivityResult createFromParcel(Parcel in) { 36 int resultCode = in.readInt(); 37 Intent data = in.readParcelable(Intent.class.getClassLoader(), Intent.class); 38 return new GameSessionActivityResult(resultCode, data); 39 } 40 41 @Override 42 public GameSessionActivityResult[] newArray(int size) { 43 return new GameSessionActivityResult[size]; 44 } 45 }; 46 47 private final int mResultCode; 48 @Nullable 49 private final Intent mData; 50 GameSessionActivityResult(int resultCode, @Nullable Intent data)51 public GameSessionActivityResult(int resultCode, @Nullable Intent data) { 52 mResultCode = resultCode; 53 mData = data; 54 } 55 getResultCode()56 public int getResultCode() { 57 return mResultCode; 58 } 59 60 @Nullable getData()61 public Intent getData() { 62 return mData; 63 } 64 65 @Override describeContents()66 public int describeContents() { 67 return 0; 68 } 69 70 @Override writeToParcel(@onNull Parcel dest, int flags)71 public void writeToParcel(@NonNull Parcel dest, int flags) { 72 dest.writeInt(mResultCode); 73 dest.writeParcelable(mData, flags); 74 } 75 } 76