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

三星手机上获取OAID会崩溃,而且是偶发的,发生在APP版本更新后,而且一旦出现一次就是必现。 #12

Open
lgengsy opened this issue May 22, 2020 · 6 comments

Comments

@lgengsy
Copy link

lgengsy commented May 22, 2020

有木有大佬反馈给三星处理下,被老板烦死了。
java.lang.UnsatisfiedLinkError: No implementation found for void com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(android.content.ComponentName, android.os.IBinder) (tried Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected and Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a_onServiceConnected__Landroid_content_ComponentName_2Landroid_os_IBinder_2) at com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(Native Method) at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:2067) at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:2099) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:237) at android.app.ActivityThread.main(ActivityThread.java:8016) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1076)

sos ~~~~

@shuzilm-open-source
Copy link
Owner

获取 OAID 之前先判断下 com.samsung.android.deviceidservice 包是否存在,然后再获取

@liyujiang-gzu
Copy link

看报错日志Java_com_bun_miitmdid_supplier_sumsung_SumsungCore_00024a,目测这个兄弟用的是移动安全联盟MSA的SDK,那个SDK通过NDK包装混淆加固一层,死坑,暗藏很多未知的闪退问题。逆向还原三星的.aidl接口文件:

// IDeviceIdService.aidl
package com.samsung.android.deviceidservice;

// Declare any non-default types here with import statements

interface IDeviceIdService {

     String getID();

}

通过AIDL的方式直接在Java层面调用三星远程服务获取OAID,不用C/C++那一层,能很大层度商提升稳健性:

        Intent intent = new Intent();
        intent.setClassName("com.samsung.android.deviceidservice", "com.samsung.android.deviceidservice.DeviceIdService");
        boolean isBinded = context.bindService(intent, new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {
                Logger.print("Samsung DeviceIdService connected");
                try {
                    //IDeviceIdService anInterface = new IDeviceIdService.Stub.asInterface(service);
                    Method asInterface = IDeviceIdService.Stub.class.getDeclaredMethod("asInterface", IBinder.class);
                    IDeviceIdService anInterface = (IDeviceIdService) asInterface.invoke(null, service);
                    String deviceId = anInterface.getID();
                    if (deviceId == null || deviceId.length() == 0) {
                        getter.onDeviceIdGetError(new RuntimeException("Samsung DeviceId get failed"));
                    } else {
                        getter.onDeviceIdGetComplete(deviceId);
                    }
                } catch (Exception e) {
                    Logger.print(e);
                    getter.onDeviceIdGetError(e);
                } finally {
                    context.unbindService(this);
                }
            }

            @Override
            public void onServiceDisconnected(ComponentName name) {
                Logger.print("Samsung DeviceIdService disconnected");
            }
        }, Context.BIND_AUTO_CREATE);
        if (!isBinded) {
            getter.onDeviceIdGetError(new RuntimeException("Samsung DeviceIdService bind failed"));
        }

详见:https://github.com/gzu-liyujiang/Android_CN_OAID/blob/master/library/src/main/java/com/github/gzuliyujiang/oaid/impl/SamsungDeviceIdImpl.java

@rainbow7
Copy link

java.lang.UnsatisfiedLinkError: No implementation found for void com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(android.content.ComponentName, android.os.IBinder)

老哥,解决了吗?

@liyujiang-gzu
Copy link

liyujiang-gzu commented Sep 28, 2020

java.lang.UnsatisfiedLinkError,这是C层的错误,在onServiceConnected里可以试试try……catch(UnsatisfiedLinkError)……但是用的是移动安全联盟MSA的SDK,可以反馈给移动安全联盟去改啊。

context.bindService(intent, new ServiceConnection() {
            @Override
            public void onServiceConnected(ComponentName name, IBinder service) {
……
            }
}

@liyujiang-gzu
Copy link

获取 OAID 之前先判断下 com.samsung.android.deviceidservice 包是否存在,然后再获取

com.samsung.android.deviceidservice 包是存在的,不然也不会走到com.bun.miitmdid.supplier.sumsung.SumsungCore$a.onServiceConnected(android.content.ComponentName, android.os.IBinder)

@liyujiang-gzu
Copy link

移动安全联盟SDK的开源替代方案:Android_CN_OAID

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

4 participants