Skip to content

Commit

Permalink
Support requesting Do Not Disturb access
Browse files Browse the repository at this point in the history
The respective permission is declared in the manifest
and a shortcut to the respective settings is in the Kõnele developer menu.

It seems that this would only be needed if Kõnele is used
while background audio is playing and the app that plays it
ignores the request to pause it.

Having access to Do Not Disturb setting allows us to mute the audio
stream (on N and higher). This has always seemed to work on the phone,
but crashes on TV if Do Not Disturb access was not granted.
  • Loading branch information
Kaljurand committed Dec 26, 2019
1 parent d63f8ea commit 11e036e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
applicationId 'ee.ioc.phon.android.speak'
minSdkVersion 16
targetSdkVersion 29
versionCode 1711
versionName '1.7.11'
versionCode 1712
versionName '1.7.12'
}

compileOptions {
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
-->
<uses-permission android:name="com.android.alarm.permission.SET_ALARM" />

<!-- TODO: investigate if we need this permission (and enable it during runtime), to
mute the audio stream during recognition. -->
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />

<!-- Custom permission required by GetPutPreferenceActivity to be able to read/write the Kõnele settings. -->
<!--
<uses-permission android:name="ee.ioc.phon.android.speak.permission.GET_PUT_SETTING" />
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@
android:targetClass="ee.ioc.phon.android.speak.demo.ImeListDemo"
android:targetPackage="ee.ioc.phon.android.speak" />
</Preference>
<!-- TODO: localize -->
<Preference
android:summary="Switch on if background audio does not stop during recognition"
android:title="Do Not Disturb access">
<intent android:action="android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS" />
</Preference>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceCategory>
Expand Down

0 comments on commit 11e036e

Please sign in to comment.