Skip to content

Commit fef9ee3

Browse files
osama10restyled-commitslazarkov
authoredMay 16, 2024··
Update Matter SDK to show Authorisation dialog only for account login flow. (project-chip#33470)
* [Problem] Authorisation dialogue wasn't disabled when user disabled it from settings [Solution] Put a condition to check if user has authorised it. if not, then dialogue will not be shown. [Test] Tested-by: Lazar Kovacic <kovacic.lazar@gmail.com> * Restyled by google-java-format * Update MatterCommissioningPrompter.java * Restyled by whitespace * Restyled by google-java-format --------- Co-authored-by: osamabb <osamabb@amazon.de> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Lazar Kovacic <kovacic.lazar@gmail.com>
1 parent 4d0a1f0 commit fef9ee3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/MatterCommissioningPrompter.java

+13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
import android.app.Activity;
66
import android.app.NotificationChannel;
77
import android.app.NotificationManager;
8+
import android.content.ContentResolver;
89
import android.content.Context;
910
import android.os.Build;
11+
import android.provider.Settings;
1012
import android.util.Log;
1113
import android.widget.EditText;
1214
import androidx.appcompat.app.AlertDialog;
@@ -45,6 +47,17 @@ public void promptForCommissionOkPermission(
4547
+ ". Commissionee: "
4648
+ commissioneeName);
4749

50+
ContentResolver contentResolver = context.getContentResolver();
51+
boolean authorisationDialogDisabled =
52+
Settings.Secure.getInt(contentResolver, "matter_show_authorisation_dialog", 0) == 0;
53+
// By default do not show authorisation dialog
54+
// only do so if customer or OS explicitly ask for it, by updating
55+
// matter_show_authorisation_dialog flag to 1
56+
if (authorisationDialogDisabled) {
57+
OnPromptAccepted();
58+
return;
59+
}
60+
4861
getActivity()
4962
.runOnUiThread(
5063
() -> {

0 commit comments

Comments
 (0)
Please sign in to comment.