三星通过 SDK 更改指纹对话框中的待机文本

Samsung pass sdk change standby text in fingerprint dialog

我正在使用 pass sdk v1.2.1,根据 programming guide 有一种方法可以更改指纹对话框中显示的待机文本。指南说你必须检查功能 Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD 是否启用才能调用 changeStandbyString,像这样:

 if(pass.isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)) {
    mSpassFingerprint.changeStandbyString("Touch your fingerprint or press the button for launching own menu”);
 }

我尝试在 Android 6.0 和 Galaxy S5 Android 5.x.x 的 Galaxy S5 上使用它,但两者都出现异常

IllegalStateException: setStandbyString is not supported.

看起来有点奇怪的是,如果 changeStandbyString returns 中的方法为真,则异常会被调用,结果与您检查

时调用的方法相同
isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD); 

看起来有点不对劲,有什么想法吗?

这是用android studio调试时生成的代码:

public void changeStandbyString(String var1) {
        this.f();
        if(this.d()) {
            throw new IllegalStateException("setStandbyString is not supported.");
        } else if(var1 == null) {
            throw new IllegalArgumentException("the standby text passed is null.");
        } else if(var1.length() > 100) {
            throw new IllegalArgumentException("the standby text passed is longer than 100 characters.");
        } else {
            this.m = var1;
        }
    }

public boolean isFeatureEnabled(int var1) {
        if(this.a == null) {
            throw new IllegalStateException("initialize() is not Called first.");
        } else {
            switch(var1) {
            case 0:
                return this.a.a();
            case 1:
            case 2:
                return this.a.b();
            case 3:
                return this.a.c();
            case 4:
                return this.a.d();
            default:
                throw new IllegalArgumentException("type passed is not valid");
            }
        }
    }

请注意,方法 d() 是在这两种情况下调用的方法,当您检查特色以查看是否启用时以及当您更改文本时,看起来应该是 if(!this.d())changeStandbyString 中,就像在其他方法中一样:

public void setDialogTitle(String var1, int var2) {
        this.f();
        if(!this.b()) {
            throw new IllegalStateException("setDialogTitle is not supported.");
        } else if(var1 == null) {
            throw new IllegalArgumentException("the titletext passed is null.");
        } else if(var1.length() > 256) {
            throw new IllegalArgumentException("the title text passed is longer than 256 characters.");
        } else if(var2 >>> 24 != 0) {
            throw new IllegalArgumentException("alpha value is not supported in the titleColor.");
        } else {
            this.f = var1;
            this.g = var2 + -16777216;
        }
    }

此处 throw new IllegalStateException("setDialogTitle is not supported."); 仅在 this.b() returns false 时发生,这是当标志为 Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG 时从 isFeaturedEnabled 调用的方法(Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG = 2).

编程指南文档有误。如果isFeatureEnabled(Spass. DEVICE_FINGERPRINT_AVAILABLE_PASSWORD) returns false,则可以激活此功能。您可以查看 code samples 以详细了解如何使用此功能。