blob: 2317e4a807f663b9b1f74e17bc88f477145141f9 [file] [log] [blame]
Winson Chung3fb0f252019-01-08 17:41:55 -08001/*
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
17package android.app.contentsuggestions;
18
19import android.annotation.NonNull;
20import android.annotation.SystemApi;
21import android.os.Bundle;
22import android.os.Parcel;
23import android.os.Parcelable;
24
25/**
Zak Cohenb399c842019-01-18 14:36:55 -080026 * Represents the classification of a content suggestion. The result of a
27 * {@link ClassificationsRequest} to {@link ContentSuggestionsManager}.
28 *
Winson Chung3fb0f252019-01-08 17:41:55 -080029 * @hide
30 */
31@SystemApi
32public final class ContentClassification implements Parcelable {
33 @NonNull
34 private final String mClassificationId;
35 @NonNull
36 private final Bundle mExtras;
37
Zak Cohenb399c842019-01-18 14:36:55 -080038 /**
39 * Default constructor.
40 *
41 * @param classificationId implementation specific id for the selection / classification.
42 * @param extras containing the classification data.
43 */
Winson Chung3fb0f252019-01-08 17:41:55 -080044 public ContentClassification(@NonNull String classificationId, @NonNull Bundle extras) {
45 mClassificationId = classificationId;
46 mExtras = extras;
47 }
48
49 /**
50 * Return the classification id.
51 */
Zak Cohenb399c842019-01-18 14:36:55 -080052 public @NonNull String getId() {
Winson Chung3fb0f252019-01-08 17:41:55 -080053 return mClassificationId;
54 }
55
56 /**
57 * Return the classification extras.
58 */
Zak Cohenb399c842019-01-18 14:36:55 -080059 public @NonNull Bundle getExtras() {
Winson Chung3fb0f252019-01-08 17:41:55 -080060 return mExtras;
61 }
62
63 @Override
64 public int describeContents() {
65 return 0;
66 }
67
68 @Override
69 public void writeToParcel(Parcel dest, int flags) {
70 dest.writeString(mClassificationId);
71 dest.writeBundle(mExtras);
72 }
73
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -070074 public static final @android.annotation.NonNull Creator<ContentClassification> CREATOR =
Winson Chung3fb0f252019-01-08 17:41:55 -080075 new Creator<ContentClassification>() {
76 @Override
77 public ContentClassification createFromParcel(Parcel source) {
78 return new ContentClassification(
79 source.readString(),
80 source.readBundle());
81 }
82
83 @Override
84 public ContentClassification[] newArray(int size) {
85 return new ContentClassification[size];
86 }
87 };
88}