@@ -93,18 +93,34 @@ public void testNoAction() throws Exception {
93
93
}
94
94
95
95
@ Test
96
- public void testPendingIntentImmutable () throws Exception {
96
+ public void testPendingIntentFlags () throws Exception {
97
97
Bundle notif = new Bundle ();
98
98
notif .putString (IterableConstants .ITERABLE_DATA_KEY , getResourceString ("push_payload_action_buttons.json" ));
99
99
100
100
IterableNotificationBuilder iterableNotification = postNotification (notif );
101
101
StatusBarNotification statusBarNotification = mNotificationManager .getActiveNotifications ()[0 ];
102
102
Notification notification = statusBarNotification .getNotification ();
103
103
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
+
108
124
}
109
125
110
126
}
0 commit comments