How to check the password field is masked and also how to check password field is cleared (Android/IOS)?

I want to check the password field is masked and also i want to check password field is cleared .

It depends on the way the app is developed. In our case, we would be comparing the value attribute of the UIASecureTextField class for the password field, which is •••••••

I am using the appium java client v7.6.0 and when you use the getText() method it gets the clean text which is a possible error.
What I did for resolving this was with

driver.passwordTextField.getAttribute("password");

and it returns true or false depending on the case but if is a password field you will have a better way of validating it