1 /*
2  * Copyright (C) 2016 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 com.android.settings.search2;
18 
19 import android.content.Intent;
20 import android.os.Parcel;
21 
22 /**
23  * Encapsulates the standard intent based results as seen in first party apps and Settings results.
24  */
25 public class IntentPayload extends ResultPayload {
26     public final Intent intent;
27 
IntentPayload(Parcel in)28     private IntentPayload(Parcel in) {
29         intent = in.readParcelable(IntentPayload.class.getClassLoader());
30     }
31 
IntentPayload(Intent newIntent)32     public IntentPayload(Intent newIntent) {
33         intent = newIntent;
34     }
35 
getType()36     @ResultPayload.PayloadType public int getType() {
37         return PayloadType.INTENT;
38     }
39 
40     @Override
describeContents()41     public int describeContents() {
42         return 0;
43     }
44 
45     @Override
writeToParcel(Parcel dest, int flags)46     public void writeToParcel(Parcel dest, int flags) {
47         dest.writeParcelable(intent, flags);
48     }
49 
50     public static final Creator<IntentPayload> CREATOR = new Creator<IntentPayload>() {
51         @Override
52         public IntentPayload createFromParcel(Parcel in) {
53             return new IntentPayload(in);
54         }
55 
56         @Override
57         public IntentPayload[] newArray(int size) {
58             return new IntentPayload[size];
59         }
60     };
61 
62 }