4

我正在使用 pass sdk v1.2.1,根据编程指南,有一种方法可以更改指纹对话框中显示的待机文本。该指南说您必须检查该功能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.xx 的 Galaxy S5 上使用它,我得到了例外

IllegalStateException: setStandbyString is not supported.

看起来有点奇怪的是,如果内部的方法changeStandbyString返回 true 则调用异常,结果与检查时调用的方法相同

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())in 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.");仅当返回 false 时才会发生这种情况,这是标志为( )时this.b()调用的方法。isFeaturedEnabledSpass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOGSpass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG = 2

4

1 回答 1

0

编程指南文档是错误的。如果isFeatureEnabled(Spass. DEVICE_FINGERPRINT_AVAILABLE_PASSWORD)返回 false,则可以激活此功能。您可以查看代码示例以仔细了解如何使用此功能。

于 2016-10-13T16:00:16.187 回答