lundi 28 juin 2021

How can I solve hidden method using java reflection.?

This is the code to invoke hidden method "getUserInfo" using java reflection, but it's not working. Can I use double reflection to call this method.? and if so. How can I apply it to the code?

Object getUserInfoMethods=null;
    Method method = null;
    try {
        method = getUserInfoMethods.getClass().getMethod("getUserInfo", null);
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
            try {
                Object users = method.invoke(getUserInfoMethods, null);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
        this.mHelper = new AppRestrictionsHelper(getContext(), this.mUser);
        this.mPackageManager = getActivity().getPackageManager();
        this.mIPm = Stub.asInterface(ServiceManager.getService("package"));
        this.mUserManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
        this.mRestrictedProfile =
        this.mUserManager.getUserInfo(this.mUser.getIdentifier()).isRestricted();
        try {
    this.mSysPackageInfo = this.mPackageManager.getPackageInfo("android",
            PackageManager.GET_SIGNATURES);
        } catch (NameNotFoundException e) {
    }
}




Aucun commentaire:

Enregistrer un commentaire