Java – Samsung pass SDK to change standby text in fingerprint dialog box

I am using pass SDK v1 2.1. According to the programming guide, there is a method to change the standby text displayed in the fingerprint dialog box The guide says that you must check whether spass is enabled DEVICE_ FINGERPRINT_ AVAILABLE_ The password function calls changestandbystring as follows:

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

I tried Android 5.0 with Android 6.0 and Galaxy S5 x. Using it on X's Galaxy S5, I got an exception

IllegalStateException: setStandbyString is not supported.

It seems a little strange that if the method in changestandbystring returns true, the exception is called, and the result is that the methods called during the check are the same

isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD);

So there seems to be something wrong, any idea?

This is the code generated when debugging with 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");
            }
        }
    }

Note that method D () is called in two cases. When you check the feature to see whether it is enabled and when to change the text, it should look like if (! This. D()) in changestandbystring, just as in other methods:

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 a new IllegalStateException ("setdialogtitle." is not supported.); Only when this B () returns false, which occurs when the flag is spass DEVICE_ FINGERPRINT_ CUSTOMIZED_ Method called from isfeaturedonabled when dialog (spass.device_fingerprint_customized_dialog = 2)

Solution

The programming guide doc is wrong This function can be activated if isfeatureenabled (spam.device_fingerprint_available_password) returns false You can check code samples to see how to use this feature

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>