The below link does answer the question about alternatives.
Environment.getExternalStorageDirectory() deprecated in API level 29 java
It answers how to not use the external storage directory and use the internal app specific directories. And also how to access media files using the other available API's. Non media files can be accessed only via the System picker, which is the main concern here. I am using my app as a file manager and I will request for MANAGE_EXTERNAL_STORAGE and will follow the process which is totally fine for me.
But the issue is , I want to replace this deprecated function with its alternative. The function which gives me the external storage directory path which looks something like: storage/emulated/0/
But I get from the alternatives mentioned in android developers page and the above link is : storage/Android/users/data/0/com.mypackagename.myapp/
I can still use the deprecated function as it still works , but for filemanagers or antivirus apps(which have special access with MANAGE_EXTERNAL_STORAGE permission), what is alternative for Environment.getExternalStorageDirectory() , if Google says that it is deprecated. Without using this deprecated function , there is no way that any filemanagers can get the path of the external storage directory.