I am sure you looked at this but just in case...
https://developer.android.com/guide/practices/screens-distribution.html
It appears that with current devices pushing the envelope of size and pixel density, there is no full proof way of excluding
large or high density phones (or normal sized tablets with phone capabilities if that is what you want).
And you probably do not want to tell a user that the App can't be installed because it has phone capabilities.
That is why I asked Why not phones? Is it the size? Or cellular access? Or security?
Your code in post #1 is correct for allowing only large and xlarge screens. But then some phones with high pixel densities will be allowed during
installation. You can tweak that somewhat, but ultimately after filtering out most small screens at installation, the remaining with high density and
small physical size will have to be excluded at run time.