String function ( PhoneNumber arg0 , Locale arg1 , String arg2 ) { String loc0 = phoneUtil . getRegionCodeForNumber ( arg0 ) ; if ( arg2 . equals ( loc0 ) ) { return getDescriptionForValidNumber ( arg0 , arg1 ) ; } return getRegionDisplayName ( loc0 , arg1 ) ; }
as per #getdescriptionforvalidnumber phonenumber , locale but also considers theregion of the user . if the phone number is from the same region as the user , only a lower-level description will be returned , if one exists . otherwise , the phone number 's region will be returned , with optionally some more detailed information . for example , for a user from the region `` us '' united states , we would show `` mountain view , ca '' for a particular number , omitting the united states from the description . for a user from the united kingdom region `` gb '' , for the same number we may show `` mountain view , ca , united states '' or even just `` united states '' . this method assumes the validity of the number passed in has already been checked . concode_field_sep PrefixFileReader prefixFileReader concode_elem_sep PhoneNumberOfflineGeocoder instance concode_elem_sep PhoneNumberUtil phoneUtil concode_elem_sep String MAPPING_DATA_DIRECTORY concode_field_sep boolean canBeGeocoded concode_elem_sep String getCountryNameForNumber concode_elem_sep PhoneNumberOfflineGeocoder getInstance concode_elem_sep String getRegionDisplayName concode_elem_sep String getDescriptionForNumber concode_elem_sep String getDescriptionForNumber