Skip to content

Commit

Permalink
Update Matter SDK to show Authorisation dialog only for account login…
Browse files Browse the repository at this point in the history
… flow. (#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>
  • Loading branch information
4 people committed May 16, 2024
1 parent 4d0a1f0 commit fef9ee3
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
import android.app.Activity;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.ContentResolver;
import android.content.Context;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import android.widget.EditText;
import androidx.appcompat.app.AlertDialog;
Expand Down Expand Up @@ -45,6 +47,17 @@ public void promptForCommissionOkPermission(
+ ". Commissionee: "
+ commissioneeName);

ContentResolver contentResolver = context.getContentResolver();
boolean authorisationDialogDisabled =
Settings.Secure.getInt(contentResolver, "matter_show_authorisation_dialog", 0) == 0;
// By default do not show authorisation dialog
// only do so if customer or OS explicitly ask for it, by updating
// matter_show_authorisation_dialog flag to 1
if (authorisationDialogDisabled) {
OnPromptAccepted();
return;
}

getActivity()
.runOnUiThread(
() -> {
Expand Down

0 comments on commit fef9ee3

Please sign in to comment.