vendredi 24 août 2018

How to find out why a reflection call freezes the app

I detected an issue that on the nexus 5x with android 8.1 and security patch from august calling a method by reflection freezes the app, this same call works on 10 other devices with android 8.0, android 7.1.1 etc. Is it possible to find out what is causing the problem when making a call by reflection, I am not even getting an exception or some helpfull log, nothing, it justs freezes.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
            try {
                final TelephonyManager telMan = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
                final Class<?> classTemp = Class.forName(telMan.getClass().getName());
                final Method methodTemp = classTemp.getDeclaredMethod("getITelephony");
                methodTemp.setAccessible(true);
                ITelephony telephonyService = (ITelephony) methodTemp.invoke(telMan);                
                telephonyService.endCall();
                return true;
            } catch (Exception ex) {
               return false;
            }
        } else {

The freeze happens at telephonyService.endCall(); and no exception is thrown.





Aucun commentaire:

Enregistrer un commentaire