The expand feature is provided by the Android System for different notification styles. You need a view which displays a list of options that the user can pick from. So you need to create a Custom View and populate it with your options.
You can set the custom view using Notification.DecoratedCustomViewStyle()
provided by Android Notification System.
If you want different appearances for collapsed and expanded view then you use the following methods to set them -
setStyle(new Notification.DecoratedCustomViewStyle())
.setCustomContentView(remoteViews)
.setCustomBigContentView(bigRemoteView);
You will need to add different pending intent for all the options you specify in your layout.
For example -
RemoteViews firstOption = ....;
Intent firstOptionIntent = // add some argument in this intent which depicts this option
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, flags);
setOnClickPendingIntent(R.id.<option_layout_id>, pendingIntent);
// similary for other options
RemoteViews secondOption = ....;
To add a dropdown list on notification action click, you need to use 2 different layouts, one for the collapsed view and one for the expanded view -
Notification customNotification = new NotificationCompat.Builder(context, CHANNEL_ID)
.setSmallIcon(R.drawable.notification_icon)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout) // collapsed view layout
.setCustomBigContentView(notificationLayoutExpanded) // expanded view layout
.build();