android 一个javacpp 技术问题求问

发布于 2022-09-12 02:45:24 字数 15290 浏览 23 评论 0

package com.apple.android.storeservices.javanative.account;

import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.b.o;
import android.support.v4.b.w;
import com.apple.android.mediaservices.javanative.common.CFTypes.CFDictionary;
import com.apple.android.mediaservices.javanative.http.HTTPMessage.HTTPMessagePtr;
import com.apple.android.storeservices.b.a;
import com.apple.android.storeservices.b.b;
import com.apple.android.storeservices.javanative.account.CredentialsRequest.CredentialsRequestPtr;
import com.apple.android.storeservices.javanative.account.CredentialsResponse.CredentialsResponsePtr;
import com.apple.android.storeservices.javanative.account.ProtocolAction.ProtocolActionNative;
import com.apple.android.storeservices.javanative.account.ProtocolAction.ProtocolActionPtr;
import com.apple.android.storeservices.javanative.account.ProtocolButton.ProtocolButtonPtr;
import com.apple.android.storeservices.javanative.account.ProtocolButtonVector.ProtocolButtonVectorNative;
import com.apple.android.storeservices.javanative.account.ProtocolDialog.ProtocolDialogPtr;
import com.apple.android.storeservices.javanative.account.ProtocolDialogResponse.ProtocolDialogResponsePtr;
import com.apple.android.storeservices.javanative.account.RequestContext.RequestContextPtr;
import java.lang.ref.WeakReference;
import java.util.Deque;
import java.util.LinkedList;
import org.bytedeco.javacpp.BytePointer;
import org.bytedeco.javacpp.FunctionPointer;
import org.bytedeco.javacpp.Pointer;
import org.bytedeco.javacpp.annotation.ByPtr;
import org.bytedeco.javacpp.annotation.ByRef;
import org.bytedeco.javacpp.annotation.ByVal;
import org.bytedeco.javacpp.annotation.Cast;
import org.bytedeco.javacpp.annotation.Const;
import org.bytedeco.javacpp.annotation.Name;
import org.bytedeco.javacpp.annotation.Namespace;
import org.bytedeco.javacpp.annotation.Platform;
import org.bytedeco.javacpp.annotation.StdString;

@Namespace("androidstoreservices")
@Platform(include = {"AndroidStoreServices.h", "URLRequest.h"}, link = {"androidstoreservices"})
/* compiled from: MusicApp */
public class AndroidStoreServices {

    /* compiled from: MusicApp */
    public class AndroidCredentialsHandler extends FunctionPointer implements b {
        static final String TAG = AndroidCredentialsHandler.class.getSimpleName();
        private CredentialsResponseCallback callback;
        private a fragment;
        private final Class<? extends a> fragmentClass;
        private Bundle fragmentInitBundle;
        private final WeakReference<w> fragmentManager;

        private native void allocate();

        public AndroidCredentialsHandler(w wVar, Class<? extends a> cls, Bundle bundle) {
            this.fragmentManager = new WeakReference<>(wVar);
            this.fragmentClass = cls;
            this.fragmentInitBundle = bundle;
            allocate();
        }

        /* access modifiers changed from: 0000 */
        public void call(@ByVal CredentialsRequestPtr credentialsRequestPtr, @ByVal CredentialsResponseCallback credentialsResponseCallback) {
            if (this.fragmentManager.get() != null) {
                this.callback = credentialsResponseCallback;
                this.fragment = (a) this.fragmentClass.newInstance();
                if (this.fragmentInitBundle != null) {
                    this.fragment.g(this.fragmentInitBundle);
                }
                this.fragment.a(credentialsRequestPtr);
                this.fragment.a((b) this);
                this.fragment.a((w) this.fragmentManager.get(), this.fragmentClass.getCanonicalName());
            }
        }

        public void dialogDismissed(int i) {
            credentialsDialogDismissed(-2, null, null);
        }

        public void credentialsDialogDismissed(int i, String str, String str2) {
            CredentialsResponsePtr create = CredentialsResponsePtr.create();
            if (i != -1 || str == null) {
                create.get().setResponseType(0);
            } else {
                create.get().setUserName(str);
                create.get().setPassword(str2);
                create.get().setResponseType(2);
            }
            this.callback.call(create);
        }

        public void dismissDialog() {
            if (this.fragment != null && this.fragment.s()) {
                dialogDismissed(-2);
            }
        }
    }

    /* compiled from: MusicApp */
    public class AndroidDialogHandler extends FunctionPointer implements b {
        static final String TAG = AndroidDialogHandler.class.getSimpleName();
        private a contentDialog;
        private Class<? extends a> dialogClass;
        private Deque<ProtocolDialogPtr> dialogPtrs = new LinkedList();
        private c dialogUICallback;
        private final WeakReference<w> fragmentManager;
        private Handler handler;
        private Deque<Integer> lastTypes = new LinkedList();
        private RequestContextPtr requestContextPtr;
        private DialogResponseCallback responseCallback;

        private native void allocate();

        public AndroidDialogHandler(w wVar, Class<? extends a> cls) {
            this.fragmentManager = new WeakReference<>(wVar);
            this.dialogClass = cls;
            allocate();
            this.handler = new Handler(Looper.getMainLooper());
        }

        public void setDialogUICallback(c cVar) {
            this.dialogUICallback = cVar;
        }

        public void setDialogClass(Class<? extends a> cls) {
            this.dialogClass = cls;
        }

        public void setRequestContext(RequestContextPtr requestContextPtr2) {
            this.requestContextPtr = requestContextPtr2;
        }

        /* access modifiers changed from: 0000 */
        public void call(@ByVal ProtocolDialogPtr protocolDialogPtr, @ByVal DialogResponseCallback dialogResponseCallback) {
            synchronized (this.dialogPtrs) {
                this.dialogPtrs.addLast(protocolDialogPtr);
            }
            this.responseCallback = dialogResponseCallback;
            "Dialog message: " + protocolDialogPtr.get().getMessage();
            "Dialog title: " + protocolDialogPtr.get().getTitle();
            "Dialog kind [0=default, 1=authentication, 2=fullscreen]: " + protocolDialogPtr.get().getDialogKind();
            "Dialog buttons size: " + protocolDialogPtr.get().getButtons().size();
            if (this.dialogUICallback != null) {
                protocolDialogPtr.get().getDialogKind();
            }
            ProtocolButtonVectorNative buttons = protocolDialogPtr.get().getButtons();
            for (int i = 0; ((long) i) < buttons.size(); i++) {
                ProtocolButtonPtr protocolButtonPtr = buttons.get((long) i);
                "Button " + i + " title: " + protocolButtonPtr.get().getTitle();
                ProtocolActionPtr action = protocolButtonPtr.get().getAction();
                if (action == null || action.address() == 0) {
                    "Button " + i + " has no action";
                } else {
                    ProtocolActionNative protocolActionNative = action.get();
                    if (protocolActionNative == null || protocolActionNative.address() == 0) {
                        "Button " + i + " has no action type";
                    } else {
                        "Button " + i + " action: " + protocolActionNative.getActionType();
                    }
                }
            }
            if (3059 == protocolDialogPtr.get().getFailureType()) {
                ProtocolDialogResponsePtr create = ProtocolDialogResponsePtr.create();
                create.get().setPerformsDefaultButtonActions(true);
                dialogResponseCallback.call(create);
            }
            "Text fields size: " + protocolDialogPtr.get().getTextFields().size();
            this.handler.post(new b(this, protocolDialogPtr, protocolDialogPtr.get().getDialogKind()));
        }

        /* access modifiers changed from: private */
        public void showDialog(ProtocolDialogPtr protocolDialogPtr, int i) {
            if (this.fragmentManager.get() != null) {
                synchronized (this.lastTypes) {
                    this.lastTypes.addLast(Integer.valueOf(i));
                }
                this.contentDialog = (a) ((w) this.fragmentManager.get()).a(TAG + i);
                "Showing Dialog - contentDialog: " + this.contentDialog + " / dialogClass: " + this.dialogClass + " / " + this.fragmentManager;
                if (this.contentDialog == null && this.dialogClass != null) {
                    try {
                        this.contentDialog = (a) this.dialogClass.newInstance();
                        this.contentDialog.a(protocolDialogPtr, this.requestContextPtr);
                        Bundle bundle = new Bundle();
                        bundle.putBoolean("has_callback", true);
                        this.contentDialog.g(bundle);
                        this.contentDialog.a((b) this);
                        "Showing dialog fragment of type " + i;
                        try {
                            this.contentDialog.a((w) this.fragmentManager.get(), TAG + i);
                        } catch (Exception e) {
                            dialogDismissed(-1);
                        }
                    } catch (IllegalAccessException | InstantiationException e2) {
                    }
                }
            }
        }

        public Object getDialog() {
            o oVar;
            synchronized (this.lastTypes) {
                if (this.lastTypes.isEmpty() || this.fragmentManager.get() == null) {
                    oVar = null;
                } else {
                    oVar = ((w) this.fragmentManager.get()).a(TAG + this.lastTypes.pollLast());
                }
            }
            return oVar;
        }

        public void dismissDialog() {
            if (this.contentDialog != null && this.contentDialog.s()) {
                dialogDismissed(-1);
            }
        }

        public void dialogDismissed(int i) {
            ProtocolDialogPtr protocolDialogPtr;
            "Dialog was dismissed; button " + i + " clicked";
            synchronized (this.dialogPtrs) {
                if (this.dialogPtrs.size() == 1) {
                    protocolDialogPtr = (ProtocolDialogPtr) this.dialogPtrs.getLast();
                } else {
                    protocolDialogPtr = (ProtocolDialogPtr) this.dialogPtrs.pollLast();
                }
            }
            if (protocolDialogPtr == null) {
                return;
            }
            if (i == -1 || protocolDialogPtr.get().getButtons().get((long) i).address() != 0) {
                ProtocolDialogResponsePtr create = ProtocolDialogResponsePtr.create();
                if (i != -1) {
                    ProtocolButtonPtr protocolButtonPtr = protocolDialogPtr.get().getButtons().get((long) i);
                    "Setting selected button: " + protocolButtonPtr.address();
                    create.get().setSelectedButton(protocolButtonPtr);
                    ProtocolActionPtr action = protocolButtonPtr.get().getAction();
                    if (action == null || action.get() == null || !action.get().getActionType().equals("purchase")) {
                        create.get().setPerformsDefaultButtonActions(true);
                    } else {
                        create.get().setPerformsDefaultButtonActions(false);
                    }
                }
                "Response callback address: " + this.responseCallback.address();
                this.responseCallback.call(create);
            }
        }

        public void credentialsDialogDismissed(int i, String str, String str2) {
        }
    }

    @Name({"AndroidPresentationInterface"})
    /* compiled from: MusicApp */
    public class AndroidPresentationInterfaceNative extends Pointer {
        private AndroidCredentialsHandler credentialsHandler;
        private AndroidDialogHandler dialogHandler;

        private native void allocate();

        @Name({"setCredentialsHandler"})
        private native void setCredentialsHandlerNative(AndroidCredentialsHandler androidCredentialsHandler);

        @Name({"setDialogHandler"})
        private native void setDialogHandlerNative(AndroidDialogHandler androidDialogHandler);

        public AndroidPresentationInterfaceNative() {
            allocate();
        }

        public void setCredentialsHandler(AndroidCredentialsHandler androidCredentialsHandler) {
            if (this.credentialsHandler != null) {
                this.credentialsHandler.deallocate();
            }
            this.credentialsHandler = androidCredentialsHandler;
            setCredentialsHandlerNative(androidCredentialsHandler);
        }

        public void setDialogHandler(AndroidDialogHandler androidDialogHandler) {
            if (this.dialogHandler != null) {
                this.dialogHandler.deallocate();
            }
            this.dialogHandler = androidDialogHandler;
            setDialogHandlerNative(androidDialogHandler);
        }
    }

    @Namespace("")
    @Name({"std::shared_ptr<storeservicescore::PresentationInterface>"})
    /* compiled from: MusicApp */
    public class AndroidPresentationInterfacePtr extends Pointer {
        public native void allocate(@ByPtr AndroidPresentationInterfaceNative androidPresentationInterfaceNative);

        @Cast({"androidstoreservices::AndroidPresentationInterface*"})
        public native AndroidPresentationInterfaceNative get();

        public AndroidPresentationInterfacePtr(AndroidPresentationInterfaceNative androidPresentationInterfaceNative) {
            allocate(androidPresentationInterfaceNative);
        }
    }

    /* compiled from: MusicApp */
    public class CredentialsResponseCallback extends FunctionPointer {
        public native void call(@ByRef @Const CredentialsResponsePtr credentialsResponsePtr);
    }

    /* compiled from: MusicApp */
    public class DialogResponseCallback extends FunctionPointer {
        public native void call(@ByRef @Const ProtocolDialogResponsePtr protocolDialogResponsePtr);
    }

    @Namespace("StoreClient")
    @ByVal
    public static native HTTPMessagePtr createBinaryPlistRequest(@ByVal CFDictionary cFDictionary, @Const @ByVal RequestContextPtr requestContextPtr, @ByRef @StdString @Const String str);

    @Namespace("TiltClient")
    @ByVal
    public static native HTTPMessagePtr createFetchMetaDataRequest(BytePointer bytePointer, int i, @Const @ByVal RequestContextPtr requestContextPtr, @ByRef @StdString @Const String str);

    @Namespace("TiltClient")
    @ByVal
    public static native HTTPMessagePtr createGetTracksRequest(@ByRef @StdString @Const String str, boolean z, boolean z2, @Cast({"int32_t"}) int i, @Const @ByVal RequestContextPtr requestContextPtr, @ByRef @StdString @Const String str2, @ByPtr @Const CFDictionary cFDictionary, boolean z3);
}  
            
        `

这个是我反编译出来的代码,按照javacpp 原理应该在lib里面有个androidstoreservices.so文件生成,但是在lib文件里面没找到androidstoreservices.so文件,同时这里还没有Loader.load();这个 函数 搞不懂 求指教,谢谢

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文