Debian Codegraph @

core/java/android/service/games/CreateGameSessionResult.java

raw symbols SCIP
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
20 import android.annotation.Hide;
21 import android.annotation.NonNull;
22 import android.os.Parcel;
23 import android.os.Parcelable;
24 import android.view.SurfaceControlViewHost;
25
26 /**
27 * Internal result object that contains the successful creation of a game session.
28 *
29 * @see IGameSessionService#create(CreateGameSessionRequest, GameSessionViewHostConfiguration,
30 * com.android.internal.infra.AndroidFuture)
31 * @hide
32 */
33 @Hide
34 public final class CreateGameSessionResult implements Parcelable {
35
36 @NonNull
37 public static final Parcelable.Creator<CreateGameSessionResult> CREATOR =
38 new Parcelable.Creator<CreateGameSessionResult>() {
39 @Override
40 public CreateGameSessionResult createFromParcel(Parcel source) {
41 return new CreateGameSessionResult(
42 IGameSession.Stub.asInterface(source.readStrongBinder()),
43 source.readParcelable(
44 SurfaceControlViewHost.SurfacePackage.class.getClassLoader(),
45 SurfaceControlViewHost.SurfacePackage.class));
46 }
47
48 @Override
49 public CreateGameSessionResult[] newArray(int size) {
50 return new CreateGameSessionResult[0];
51 }
52 };
53
54 private final IGameSession mGameSession;
55 private final SurfaceControlViewHost.SurfacePackage mSurfacePackage;
56
57 public CreateGameSessionResult(
58 @NonNull IGameSession gameSession,
59 @NonNull SurfaceControlViewHost.SurfacePackage surfacePackage) {
60 mGameSession = gameSession;
61 mSurfacePackage = surfacePackage;
62 }
63
64 @NonNull
65 public IGameSession getGameSession() {
66 return mGameSession;
67 }
68
69 @NonNull
70 public SurfaceControlViewHost.SurfacePackage getSurfacePackage() {
71 return mSurfacePackage;
72 }
73
74 @Override
75 public int describeContents() {
76 return 0;
77 }
78
79 @Override
80 public void writeToParcel(@NonNull Parcel dest, int flags) {
81 dest.writeStrongBinder(mGameSession.asBinder());
82 dest.writeParcelable(mSurfacePackage, flags);
83 }
84 }