Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OPPO R9 指纹识别问题 #11

Closed
QuincySx opened this issue May 20, 2017 · 3 comments
Closed

OPPO R9 指纹识别问题 #11

QuincySx opened this issue May 20, 2017 · 3 comments

Comments

@QuincySx
Copy link

OPPO R9 系统版本是 5.1
但是官方声称是基于官方源码修改的,支持官方API
作者的库无法在OPPO R9上使用

FingerprintManagerCompatApi23 类下的 这个方法
private static FingerprintManager getFingerprintManagerOrNull(Context context) {
return context.getSystemService(FingerprintManager.class);
}

我对 OPPO R9 进行的单独判断

private static FingerprintManager getFingerprintManagerOrNull(Context context) {
return (FingerprintManager) context.getSystemService(FINGERPRINT_SERVICE);
}

可以正常使用 OPPO R9 指纹识别

@uccmawei
Copy link
Owner

@QuincySx 这么神奇?我没有OPPO机器,我这里没法测试这点

public final T getSystemService(Class serviceClass) {
// Because subclasses may override getSystemService(String) we cannot
// perform a lookup by class alone. We must first map the class to its
// service name then invoke the string-based method.
String serviceName = getSystemServiceName(serviceClass);
return serviceName != null ? (T)getSystemService(serviceName) : null;
}

但是根据代码来看,2个方法最后都是调用到同一个方法的呀,除非是OPPO把这段代码改掉了?

getSystemServiceName(FingerprintManager.class)
Context.FINGERPRINT_SERVICE

context.getSystemService(FingerprintManager.class);
context.getSystemService(FINGERPRINT_SERVICE);

你可以对比下这几个方法或者常量在你的OPPO机器上的返回值吗?

@QuincySx
Copy link
Author

1.使用这个方法会抛出异常
context.getSystemService(FingerprintManager.class);

java.lang.NoSuchMethodError: No virtual method getSystemService(Ljava/lang/Class;)Ljava/lang/Object; in class Landroid/content/Context; or its super classes (declaration of 'android.content.Context' appears in /system/framework/framework.jar:classes2.dex)

2.这个方法也会抛出异常
context.getSystemServiceName(FingerprintManager.class)

java.lang.NoSuchMethodError: No virtual method getSystemServiceName(Ljava/lang/Class;)Ljava/lang/String; in class Landroid/content/Context; or its super classes (declaration of 'android.content.Context' appears in /system/framework/framework.jar:classes2.dex)

3.正常返回 FingerprintManager
context.getSystemService(FINGERPRINT_SERVICE);

4.FINGERPRINT_SERVICE 的值 “fingerprint”

@uccmawei
Copy link
Owner

@QuincySx 阿西吧,简直无语,API都被他们砍掉了,那只能我这边改一下了,谢谢大兄弟的提醒!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants