1/* 2 * Copyright (C) 2014 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 com.android.internal.content; 18 19import android.content.Intent; 20import android.os.Parcel; 21 22/** 23 * Subclass of Intent that also contains referrer (as a package name) information. 24 */ 25public class ReferrerIntent extends Intent { 26 public final String mReferrer; 27 28 public ReferrerIntent(Intent baseIntent, String referrer) { 29 super(baseIntent); 30 mReferrer = referrer; 31 } 32 33 public void writeToParcel(Parcel dest, int parcelableFlags) { 34 super.writeToParcel(dest, parcelableFlags); 35 dest.writeString(mReferrer); 36 } 37 38 ReferrerIntent(Parcel in) { 39 readFromParcel(in); 40 mReferrer = in.readString(); 41 } 42 43 public static final Creator<ReferrerIntent> CREATOR = new Creator<ReferrerIntent>() { 44 public ReferrerIntent createFromParcel(Parcel source) { 45 return new ReferrerIntent(source); 46 } 47 public ReferrerIntent[] newArray(int size) { 48 return new ReferrerIntent[size]; 49 } 50 }; 51} 52