How to get the device locale after changing the application locale

I asked something similar and found this answer, sorry if it is late:

To find the system locale use:

defaultLocale = Resources.getSystem().getConfiguration().locale;

It gets the system locale, no matter which default locale is set for the app/activity.


I am absolutely unsure how portable this is to different devices:

try {
    Process exec = Runtime.getRuntime().exec(new String[]{"getprop", "persist.sys.language"});
    String locale = new BufferedReader(new InputStreamReader(exec.getInputStream())).readLine();
    exec.destroy();
    Log.e("", "Device locale: "+locale);
} catch (IOException e) {
    e.printStackTrace();
}

And if you want the country part: persist.sys.country