| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.telecom; |
| 18 |
|
| 19 |
import android.annotation.SystemApi; |
| 20 |
import android.content.ComponentName; |
| 21 |
import android.content.Context; |
| 22 |
import android.graphics.drawable.Drawable; |
| 23 |
import android.graphics.drawable.Icon; |
| 24 |
import android.os.Bundle; |
| 25 |
import android.os.Parcel; |
| 26 |
import android.os.Parcelable; |
| 27 |
|
| 28 |
import java.util.Objects; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
public final class StatusHints implements Parcelable { |
| 34 |
|
| 35 |
private final CharSequence mLabel; |
| 36 |
private final Icon mIcon; |
| 37 |
private final Bundle mExtras; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
@SystemApi @Deprecated |
| 43 |
public StatusHints(ComponentName packageName, CharSequence label, int iconResId, |
| 44 |
Bundle extras) { |
| 45 |
this(label, iconResId == 0 ? null : Icon.createWithResource(packageName.getPackageName(), |
| 46 |
iconResId), extras); |
| 47 |
} |
| 48 |
|
| 49 |
public StatusHints(CharSequence label, Icon icon, Bundle extras) { |
| 50 |
mLabel = label; |
| 51 |
mIcon = icon; |
| 52 |
mExtras = extras; |
| 53 |
} |
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
@SystemApi @Deprecated |
| 61 |
public ComponentName getPackageName() { |
| 62 |
|
| 63 |
return new ComponentName("", ""); |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
public CharSequence getLabel() { |
| 70 |
return mLabel; |
| 71 |
} |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
@SystemApi @Deprecated |
| 81 |
public int getIconResId() { |
| 82 |
|
| 83 |
return 0; |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
@SystemApi @Deprecated |
| 92 |
public Drawable getIcon(Context context) { |
| 93 |
return mIcon.loadDrawable(context); |
| 94 |
} |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
public Icon getIcon() { |
| 100 |
return mIcon; |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
public Bundle getExtras() { |
| 107 |
return mExtras; |
| 108 |
} |
| 109 |
|
| 110 |
@Override |
| 111 |
public int describeContents() { |
| 112 |
return 0; |
| 113 |
} |
| 114 |
|
| 115 |
@Override |
| 116 |
public void writeToParcel(Parcel out, int flags) { |
| 117 |
out.writeCharSequence(mLabel); |
| 118 |
out.writeParcelable(mIcon, 0); |
| 119 |
out.writeParcelable(mExtras, 0); |
| 120 |
} |
| 121 |
|
| 122 |
public static final @android.annotation.NonNull Creator<StatusHints> CREATOR |
| 123 |
= new Creator<StatusHints>() { |
| 124 |
public StatusHints createFromParcel(Parcel in) { |
| 125 |
return new StatusHints(in); |
| 126 |
} |
| 127 |
|
| 128 |
public StatusHints[] newArray(int size) { |
| 129 |
return new StatusHints[size]; |
| 130 |
} |
| 131 |
}; |
| 132 |
|
| 133 |
private StatusHints(Parcel in) { |
| 134 |
mLabel = in.readCharSequence(); |
| 135 |
mIcon = in.readParcelable(getClass().getClassLoader(), android.graphics.drawable.Icon.class); |
| 136 |
mExtras = in.readParcelable(getClass().getClassLoader(), android.os.Bundle.class); |
| 137 |
} |
| 138 |
|
| 139 |
@Override |
| 140 |
public boolean equals(Object other) { |
| 141 |
if (other != null && other instanceof StatusHints) { |
| 142 |
StatusHints otherHints = (StatusHints) other; |
| 143 |
return Objects.equals(otherHints.getLabel(), getLabel()) && |
| 144 |
Objects.equals(otherHints.getIcon(), getIcon()) && |
| 145 |
Objects.equals(otherHints.getExtras(), getExtras()); |
| 146 |
} |
| 147 |
return false; |
| 148 |
} |
| 149 |
|
| 150 |
@Override |
| 151 |
public int hashCode() { |
| 152 |
return Objects.hashCode(mLabel) + Objects.hashCode(mIcon) + Objects.hashCode(mExtras); |
| 153 |
} |
| 154 |
} |