4

There are applications to change Android device language (locale) via an ADB command. This has required granting the CHANGE_CONFIGURATION permission for the app before language can be changed.

On Android 6.0 (API level 23, Nexus 6 device), however, granting the required permission is no longer allowed, since the command adb shell pm grant net.sanapeli.adbchangelanguage android.permission.CHANGE_CONFIGURATION (package name from ADB Change Language app as an example) yields

Operation not allowed: java.lang.SecurityException: Permission android.permission.CHANGE_CONFIGURATION is not a changeable permission type

How can you change the language/locale on Android OS version 6.0 without rooting the device? Can this be done with a helper app, or a direct ADB command, or by launching some intent vai ADB?

Related question from 2010: Change language programmatically in Android

Community
  • 1
  • 1
Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98

2 Answers2

1

The SecurityException no longer exists on the public image of Android OS 6.0 (Marshmallow) version. This was confirmed on Nexus 6 and Nexus 9 devices. Case closed.

Juuso Ohtonen
  • 8,826
  • 9
  • 65
  • 98
0

I was able to get this working by putting my app in /system/priv-app, so it becomes a privileged system app. As root:

mount -o remount,rw /system
mkdir /system/priv-app/MyApp
cp /sdcard/myapp.apk /system/priv-app/MyApp/MyApp.apk
chcon "u:object_r:system_file:s0" /system/priv-app/MyApp
chcon "u:object_r:system_file:s0" /system/priv-app/MyApp/MyApp.apk
mount -o remount,ro /system

Chcon sets the proper SELinux security context.

weiyin
  • 6,819
  • 4
  • 47
  • 58
  • 1
    the purpose of the app is to provide the ability to control the locale on a stock production (i.e. unrooted) device. on a rooted device why bother with the app? – Alex P. Aug 26 '15 at 02:16
  • Thanks, but I really can't use this solution if I have to root my device. I edited my question, asking how to do this without rooting. – Juuso Ohtonen Aug 26 '15 at 03:28