Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android 4.2 filters out CHANGE_CONFIGURATION permission?

Tags:

android

I come across a weird problem, I got an application allowing to freely change the font size on Android Device (Font Size Setter). It uses introspection to call some internal Android apis. To do this call, it needs the following permission : android.permission.CHANGE_CONFIGURATION. It worked like a charm under Android 4.0 and up to 4.2 where it does not work anymore. Digging into logs I found out that I can't update font size because it misses this permission. Debbuging to check effective permissions, I got these when inspecting the PackageInfo corresponding to my app

requestedPermissions = {java.lang.String[2]@830038778728}
    [0] = {java.lang.String@830038778760}"android.permission.CHANGE_CONFIGURATION"
    [1] = {java.lang.String@830038778896}"android.permission.WRITE_SETTINGS"
requestedPermissionsFlags = {int[2]@830038779016}
    [0] = 1
    [1] = 3

Does somebody got any clue about what's going on, or any workaround idea ? Thanks a lot for reading me.

Per request, the AndroidManifest.xml file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="fr.gatay.android.fss"
          android:versionCode="1"
          android:versionName="1.0">
    <uses-sdk android:minSdkVersion="14"/>
    <uses-permission android:name="android.permission.CHANGE_CONFIGURATION" />
    <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
    <application android:label="@string/app_name" android:icon="@drawable/app_icon">
        <activity android:name=".MainActivity"
        android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
like image 477
Cedric Gatay Avatar asked Nov 18 '12 12:11

Cedric Gatay


People also ask

What does READ_PHONE_STATE permission do?

Allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any PhoneAccounts registered on the device. Used to determine the state of the mobile app. Jacob to provide additional details on exact functions.

Why does your app need to use the Request_install_packages permission?

REQUEST_INSTALL_PACKAGES permission provides apps with the ability to install new packages on a user's device.


1 Answers

Check this post http://blog.sightidea.com/?p=44

You can ask your user to grant permission to the app with adb tool:

>adb shell
>pm grant com.yourapp.packagename android.permission.CHANGE_CONFIGURATION
like image 169
situee Avatar answered Nov 14 '22 23:11

situee