leobelizquierdo leobelizquierdo - 1 month ago 12
Android Question

Samsung pass sdk change standby text in fingerprint dialog

I'm using pass sdk v1.2.1, according to programming guide there is a method to change the standby text showing in the fingerprint dialog. The guide say that you have to check if the feature

Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD
is enable to call
changeStandbyString
, something like this:

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


I try to use it on Galaxy S5 with Android 6.0 and Galaxy S5 Android 5.x.x in both I get the exception

IllegalStateException: setStandbyString is not supported.


What it seem a little odd is that the exception gets called if a method inside
changeStandbyString
returns true which turns out is the same method called when you check

isFeatureEnabled(Spass.DEVICE_FINGERPRINT_AVAILABLE_PASSWORD);


so looks like something is 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 the method
d()
is the one called in both situation, when you check for the featured to see if is enable and when you change the text, looks like it should be
if(!this.d())
in
changeStandbyString
, as it does in others methods like:

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;
}
}


Here
throw new IllegalStateException("setDialogTitle is not supported.");
only happens if
this.b()
returns false which is the method called from
isFeaturedEnabled
when the flag is
Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG
(
Spass.DEVICE_FINGERPRINT_CUSTOMIZED_DIALOG = 2
).

Answer

The Programming Guide doc is wrong. If isFeatureEnabled(Spass. DEVICE_FINGERPRINT_AVAILABLE_PASSWORD) returns false, then this function can be activated. You can check out the code samples to take a closer look of how use this feature.

Comments