@Override public int hashCode() { int result = icon; result = 31 * result + title.hashCode(); result = 31 * result + actionIntent.hashCode(); return result; } }
@Override public int hashCode() { int result = observerId; result = 31 * result + packageNames.hashCode(); result = 31 * result + (int) (timeLimit ^ (timeLimit >>> 32)); result = 31 * result + timeUnit.hashCode(); result = 31 * result + callbackIntent.hashCode(); return result; } }
@Test public void testHashCode() { Context ctx = ApplicationProvider.getApplicationContext(); PendingIntent pendingIntent1 = PendingIntent.getActivity(ctx, 99, new Intent("activity"), 100); assertThat(pendingIntent1.hashCode()) .isEqualTo(PendingIntent.getActivity(ctx, 99, new Intent("activity"), 100).hashCode()); assertThat(pendingIntent1.hashCode()) .isNotEqualTo(PendingIntent.getActivity(ctx, 99, new Intent("activity2"), 100).hashCode()); assertThat(pendingIntent1.hashCode()) .isNotEqualTo(PendingIntent.getActivity(ctx, 999, new Intent("activity"), 100).hashCode()); } }
protected void appendActions(Notification notification, String key, Notification.Action[] actions) { Notification.Action[] appliedActions = new Notification.Action[notification.actions.length + actions.length]; for (Notification.Action action : notification.actions) { action.actionIntent = PendingIntent.getBroadcast(this, action.actionIntent.hashCode(), new Intent().setAction(INTENT_ACTION_PROXY_ACTION).putExtra(INTENT_EXTRA_PROXY_INTENT, action.actionIntent).putExtra(INTENT_EXTRA_NOTIFICATION_KEY, key), PendingIntent.FLAG_UPDATE_CURRENT); } System.arraycopy(notification.actions, 0, appliedActions, 0, notification.actions.length); System.arraycopy(actions, 0, appliedActions, notification.actions.length, actions.length); notification.actions = appliedActions; }
@Override public int hashCode() { int result = observerId; result = 31 * result + packageNames.hashCode(); result = 31 * result + (int) (timeLimit ^ (timeLimit >>> 32)); result = 31 * result + timeUnit.hashCode(); result = 31 * result + callbackIntent.hashCode(); return result; } }
public static void dump(String tag, PendingIntent intent) { if (intent == null) { Log.v(tag, "no pending intent found"); return; } Log.v(tag, "PendingIntent[@" + Integer.toHexString(intent.hashCode()) + "] content:"); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { dumpJellyBeanMr1(tag, intent); } else { dumpDefault(tag, intent); } }