@@ -93,18 +93,34 @@ public void testNoAction() throws Exception {
9393 }
9494
9595 @ Test
96- public void testPendingIntentImmutable () throws Exception {
96+ public void testPendingIntentFlags () throws Exception {
9797 Bundle notif = new Bundle ();
9898 notif .putString (IterableConstants .ITERABLE_DATA_KEY , getResourceString ("push_payload_action_buttons.json" ));
9999
100100 IterableNotificationBuilder iterableNotification = postNotification (notif );
101101 StatusBarNotification statusBarNotification = mNotificationManager .getActiveNotifications ()[0 ];
102102 Notification notification = statusBarNotification .getNotification ();
103103
104- assertTrue ((shadowOf (notification .contentIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
105- assertTrue ((shadowOf (notification .actions [0 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
106- assertTrue ((shadowOf (notification .actions [1 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
107- assertTrue ((shadowOf (notification .actions [2 ].actionIntent ).getFlags () & PendingIntent .FLAG_IMMUTABLE ) != 0 );
104+ // Test contentIntent (default action)
105+ int contentIntentFlags = shadowOf (notification .contentIntent ).getFlags ();
106+ assertTrue ((contentIntentFlags & PendingIntent .FLAG_UPDATE_CURRENT ) != 0 );
107+ assertTrue ((contentIntentFlags & PendingIntent .FLAG_IMMUTABLE ) != 0 ); // Should be immutable for default action
108+
109+ // Test deeplink button (default type, openApp=true)
110+ int deeplinkButtonFlags = shadowOf (notification .actions [0 ].actionIntent ).getFlags ();
111+ assertTrue ((deeplinkButtonFlags & PendingIntent .FLAG_UPDATE_CURRENT ) != 0 );
112+ assertTrue ((deeplinkButtonFlags & PendingIntent .FLAG_IMMUTABLE ) != 0 ); // Should be immutable for default type
113+
114+ // Test silent action button (default type, openApp=false)
115+ int silentActionFlags = shadowOf (notification .actions [1 ].actionIntent ).getFlags ();
116+ assertTrue ((silentActionFlags & PendingIntent .FLAG_UPDATE_CURRENT ) != 0 );
117+ assertTrue ((silentActionFlags & PendingIntent .FLAG_IMMUTABLE ) != 0 ); // Should be immutable for default type
118+
119+ // Test text input button
120+ int textInputFlags = shadowOf (notification .actions [2 ].actionIntent ).getFlags ();
121+ assertTrue ((textInputFlags & PendingIntent .FLAG_UPDATE_CURRENT ) != 0 );
122+ assertTrue ((textInputFlags & PendingIntent .FLAG_MUTABLE ) != 0 ); // Should be mutable for text input
123+
108124 }
109125
110126}
0 commit comments