Exemplo n.º 1
0
    static void Init()
    {
        currentApkStatus = ApkStatus.UNKNOWN;

        EditorWindow.GetWindow(typeof(OVRBundleTool));

        invalidBuildableScene = false;
        InitializePanel();

        OVRPlugin.SetDeveloperMode(OVRPlugin.Bool.True);
        OVRPlugin.SendEvent("oculus_bundle_tool", "show_window");
    }
Exemplo n.º 2
0
    private static void CheckForTransitionAPK()
    {
        OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());

        if (adbTool.isReady)
        {
            string matchedPackageList, error;
            var    transitionPackageName = PlayerSettings.applicationIdentifier;
            if (useOptionalTransitionApkPackage)
            {
                transitionPackageName += ".transition";
            }
            string[] packageCheckCommand = new string[] { "-d shell pm list package", transitionPackageName };
            if (adbTool.RunCommand(packageCheckCommand, null, out matchedPackageList, out error) == 0)
            {
                if (string.IsNullOrEmpty(matchedPackageList))
                {
                    currentApkStatus = ApkStatus.NOT_INSTALLED;
                }
                else
                {
                    // adb "list package" command returns all package names that contains the given query package name
                    // Need to check if the transition package name is matched exactly
                    if (matchedPackageList.Contains("package:" + transitionPackageName + "\r\n"))
                    {
                        if (useOptionalTransitionApkPackage)
                        {
                            // If optional package name is used, it is deterministic that the transition apk is installed
                            currentApkStatus = ApkStatus.OK;
                        }
                        else
                        {
                            // get package info to check for TRANSITION_APK_VERSION_NAME
                            string[] dumpPackageInfoCommand = new string[] { "-d shell dumpsys package", transitionPackageName };
                            string   packageInfo;
                            if (adbTool.RunCommand(dumpPackageInfoCommand, null, out packageInfo, out error) == 0 &&
                                !string.IsNullOrEmpty(packageInfo) &&
                                packageInfo.Contains(OVRBundleManager.TRANSITION_APK_VERSION_NAME))
                            {
                                // Matched package name found, and the package info contains TRANSITION_APK_VERSION_NAME
                                currentApkStatus = ApkStatus.OK;
                            }
                            else
                            {
                                currentApkStatus = ApkStatus.NOT_INSTALLED;
                            }
                        }
                    }
                    else
                    {
                        // No matached package name returned
                        currentApkStatus = ApkStatus.NOT_INSTALLED;
                    }
                }
            }
            else if (error.Contains("no devices found"))
            {
                currentApkStatus = ApkStatus.DEVICE_NOT_CONNECTED;
            }
            else
            {
                currentApkStatus = ApkStatus.UNKNOWN;
            }
        }
    }