1 /* 2 * Copyright (C) 2007 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.internal.telephony.cat; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 import android.graphics.Bitmap; 21 import android.os.Build; 22 import android.os.Parcel; 23 import android.os.Parcelable; 24 25 public class TextMessage implements Parcelable { 26 public String title = ""; 27 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 28 public String text = null; 29 public Bitmap icon = null; 30 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 31 public boolean iconSelfExplanatory = false; 32 public boolean isHighPriority = false; 33 public boolean responseNeeded = true; 34 public boolean userClear = false; 35 public Duration duration = null; 36 37 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) TextMessage()38 TextMessage() { 39 } 40 TextMessage(Parcel in)41 private TextMessage(Parcel in) { 42 title = in.readString(); 43 text = in.readString(); 44 icon = in.readParcelable(Bitmap.class.getClassLoader()); 45 iconSelfExplanatory = in.readInt() == 1 ? true : false; 46 isHighPriority = in.readInt() == 1 ? true : false; 47 responseNeeded = in.readInt() == 1 ? true : false; 48 userClear = in.readInt() == 1 ? true : false; 49 duration = in.readParcelable(null); 50 } 51 52 @Override describeContents()53 public int describeContents() { 54 return 0; 55 } 56 57 @Override writeToParcel(Parcel dest, int flags)58 public void writeToParcel(Parcel dest, int flags) { 59 dest.writeString(title); 60 dest.writeString(text); 61 dest.writeParcelable(icon, 0); 62 dest.writeInt(iconSelfExplanatory ? 1 : 0); 63 dest.writeInt(isHighPriority ? 1 : 0); 64 dest.writeInt(responseNeeded ? 1 : 0); 65 dest.writeInt(userClear ? 1 : 0); 66 dest.writeParcelable(duration, 0); 67 } 68 69 public static final Parcelable.Creator<TextMessage> CREATOR = new Parcelable.Creator<TextMessage>() { 70 @Override 71 public TextMessage createFromParcel(Parcel in) { 72 return new TextMessage(in); 73 } 74 75 @Override 76 public TextMessage[] newArray(int size) { 77 return new TextMessage[size]; 78 } 79 }; 80 81 @Override toString()82 public String toString() { 83 return "title=" + title + " text=" + text + " icon=" + icon + 84 " iconSelfExplanatory=" + iconSelfExplanatory + " isHighPriority=" + 85 isHighPriority + " responseNeeded=" + responseNeeded + " userClear=" + 86 userClear + " duration=" + duration; 87 } 88 } 89