@@ -90,6 +90,8 @@ public static void test(Context ctx) throws PendingIntent.CanceledException {
9090
9191 static class TestSliceProvider extends SliceProvider {
9292
93+ private PendingIntent mPendingIntent ;
94+
9395 @ Override
9496 public Slice onBindSlice (Uri sliceUri ) {
9597 if (sliceUri .getAuthority ().equals ("1" )) {
@@ -110,7 +112,7 @@ public Slice onBindSlice(Uri sliceUri) {
110112 .setPrimaryAction (activityAction ));
111113 return listBuilder .build (); // Safe
112114
113- } else {
115+ } else if ( sliceUri . getAuthority (). equals ( "3" )) {
114116 Intent baseIntent = new Intent ();
115117 PendingIntent pi = PendingIntent .getActivity (getContext (), 0 , baseIntent ,
116118 PendingIntent .FLAG_IMMUTABLE ); // Sanitizer
@@ -119,6 +121,14 @@ public Slice onBindSlice(Uri sliceUri) {
119121 listBuilder .addRow (new ListBuilder .RowBuilder ().setTitle ("Title" )
120122 .setPrimaryAction (activityAction ));
121123 return listBuilder .build (); // Safe
124+
125+ } else {
126+ // Testing implicit field read flows:
127+ // mPendingIntent is set in onCreateSliceProvider
128+ SliceAction action = SliceAction .createDeeplink (mPendingIntent , null , 0 , "" );
129+ ListBuilder listBuilder = new ListBuilder (getContext (), sliceUri , 0 );
130+ listBuilder .addRow (new ListBuilder .RowBuilder (sliceUri ).setPrimaryAction (action ));
131+ return listBuilder .build (); // $hasTaintFlow
122132 }
123133 }
124134
@@ -136,12 +146,17 @@ public PendingIntent onCreatePermissionRequest(Uri sliceUri, String callingPacka
136146 }
137147 }
138148
139- // Implementations needed for compilation
140149 @ Override
141150 public boolean onCreateSliceProvider () {
151+ // Testing implicit field read flows:
152+ // mPendingIntent is used in onBindSlice
153+ Intent baseIntent = new Intent ();
154+ mPendingIntent = PendingIntent .getActivity (getContext (), 0 , baseIntent , 0 );
142155 return true ;
143156 }
144157
158+ // Implementations needed for compilation
159+
145160 @ Override
146161 public AssetFileDescriptor openTypedAssetFile (Uri uri , String mimeTypeFilter , Bundle opts ,
147162 CancellationSignal signal ) throws RemoteException , FileNotFoundException {
0 commit comments