Tile in QuickSettings not working after updating SDK to 31

224 views Asked by At

In my application we have a Tile in the QuickSettings of Android. It is a toggleable Tile.

It was working fine in SDK 30, until I updated the SDK to 31. I read the documentation and the changes in Android 12, but I could not find anything wrong in my code. I guess it is some manifest attribute, but I could not find the solution.

The behaviour is that if I target SDK 31, the Tile is unclickable and is "Unavailable".

The related part of the manifest is like the following:

<service
        android:name="<mypackagename>.QuickSettingsTileService"
        android:exported="false"
        android:label="@string/app_name"
        android:icon="@drawable/<myapp>icon_on"
        android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
    <intent-filter>
        <action android:name="android.service.quicksettings.action.QS_TILE" />
    </intent-filter>
    <meta-data android:name="android.service.quicksettings.ACTIVE_TILE" android:value="true" />
</service>
1

There are 1 answers

0
n3mo On BEST ANSWER

So, I found the solution. The exported attribute must be set to true, that is:

android:exported="true"

in the manifest.

Actually, from the documentation here, quoting:

If "true", the activity is accessible to any app, and is launchable by its exact class name.
If "false", the activity can be launched only by components of the same application, applications with the same user ID, or privileged system components. This is the default value when there are no intent filters.

I would not guessed that, because I though the Tile was managed by some privileged system component.

Please leave comments if you have more information about "why" I needed to export the service.