They've added in 28(P) the function
AudioManager.getStreamMinVolume(int streamType)
I've checked two phones. One returned 0 (max 15) the other one returned 1 (max 8). I assume that AndroidPhones somehow use "Steps". Setting the StreamVolume to 0 didn't work on the phone where the minVolume returned 1. Even setting the StreamVolume with
adjustStreamVolume(streamType, ADJUST_MUTE, 0)
failed.
Are there Phones that use percentage from 0 to 100 because
public static final int ADJUST_MUTE = -100;
? And my question: How to get the minStreamVolume for a specific streamType pre Pie?
Here is the formal way to find the minimum volume of a stream type.
/**
* Returns the minimum volume index for a particular stream.
*
* @param streamType The stream type whose minimum volume index is returned.
* @return The minimum valid volume index for the stream.
* @see #getStreamVolume(int)
* @hide
*/
public int getStreamMinVolume(int streamType) {
IAudioService service = getService();
try {
return service.getStreamMinVolume(streamType);
} catch (RemoteException e) {
Log.e(TAG, "Dead object in getStreamMinVolume", e);
return 0;
}
}
/**
* Returns the current volume index for a particular stream.
*
* @param streamType The stream type whose volume index is returned.