When tap on notification's action button, if it is handled in a service the notification drawer could be closed with
public void onReceive(final Context context, final Intent intent) {
... ...
Intent it = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
context.sendBroadcast(it);
}
But from android 12 it is deprecated and not be able to close the notification drawer. And this is in a library which does not have an active accessibility service. How to close the notification drawer when tap on notification's action button?
This is not an answer to this question, but I thought it still might be helpful for other people:
If the app happens to have a TileService running, you can use startActivityAndCollapse to start an activity and collapse the notification panel.