Kanzi 3.9.8 迁移指南

使用此迁移指南将 Kanzi 应用程序从 Kanzi 3.9.7 更新到 Kanzi 3.9.8。

InputManipulator::Collection API 的更改

在 input_manipulator.hpp 中,修正了成员函数中的一个拼写错误。

如果您的 Kanzi 应用程序使用 InputManipulator::Collection::cancelAllKeyInputManipators 函数,请将其重命名为 InputManipulator::Collection::cancelAllKeyInputManipulators。

对 InputMethodListener API 的更改

在 input_manipulator.hpp 中,修正了成员函数中的一个拼写错误。

如果您的 Kanzi 应用程序使用 InputMethodListener::onCompositionTextCommitedOverride 函数,请将其重命名为 InputMethodListener::onCompositionTextCommittedOverride。

TextBoxConceptImpl API 的更改

在 text_box_concept_impl.hpp 中,修正了成员函数中的一个拼写错误。

如果您的 Kanzi 应用程序使用 TextBoxConceptImpl::deteleCharactersAtCursor 函数,请将其重命名为 TextBoxConceptImpl::deleteCharactersAtCursor。

PropertyDrivenAnimationPlayer API 的更改

在 property_driven_animation_player.hpp 中,修正了成员函数中的一个拼写错误。

如果您的 Kanzi 应用程序使用 PropertyDrivenAnimationPlayer::timeControllerPropertyNoticationHandler 函数,请将其重命名为 PropertyDrivenAnimationPlayer::timeControllerPropertyNotificationHandler。

ActivityHostConcept API 的更改

在 activity_host_concept.hpp 中,更改了虚拟成员函数 ActivityHostConcept::onActivateActivityOverride 的签名。如果您的 Kanzi 应用程序重新定义了此函数,请在其中添加类型为 bool 的参数,该参数设置是否重置要激活的 Activity 的 Activity 属性值。

对默认表面属性的更改

在应用程序配置中,更改了这些表面属性的默认值:

  • 颜色通道大小

  • 深度缓冲区大小

  • 抗锯齿样本数量

本表显示了更改后的默认值:

配置

Kanzi 3.9.7 默认值

Kanzi 3.9.8 默认值

SurfaceBitsDepthBuffer

16 位

24 位

SurfaceBitsRed

平台决定

8 bits

SurfaceBitsGreen

平台决定

8 bits

SurfaceBitsBlue

平台决定

8 bits

SurfaceBitsAlpha

平台决定

8 bits

SurfaceSamplesAntialiasing

  • Windows:4 samples

  • 其他平台:0 samples

  • Windows:4 samples

  • 其他平台:平台决定

这些更改可能会对依赖默认值的 Kanzi 应用程序产生轻微的视觉质量影响。当您将 Kanzi 应用程序迁移到 3.9.8 时,要匹配早期版本 Kanzi 中的默认颜色通道大小,请使用 "unspecified"。

请参阅 表面属性。

对 Android 应用程序模板的更改

Kanzi 3.9.8 开始支持 JDK 17,并且不再支持 JDK 8。要使用 JDK 17,请将您的 Kanzi 应用程序迁移到使用 Gradle 7.6.2 和 Android Gradle Plugin 7.4.2。

如果您使用 JDK 11,则无需迁移您的应用程序。

要迁移您的 Kanzi 应用程序:

  1. 在 <ProjectName>/Application/configs/platforms/android_gradle/build.gradle 中,替换:

    dependencies {
        classpath 'com.android.tools.build:gradle:<android-gradle-plugin-version>'
        classpath 'com.rightware.gradle:kanzi:<kanzi-gradle-plugin-version>'
    }
    

    通过

    dependencies {
        classpath 'com.android.tools.build:gradle:7.4.2'
        classpath 'com.rightware.gradle:kanzi:0.8.1'
    }
    
  2. 在 <ProjectName>/Application/configs/platforms/android_gradle/gradle/wrapper/gradle-wrapper.properties 中,替换:

    distributionUrl=https\://services.gradle.org/distributions/gradle-<version>-bin.zip
    

    通过

    distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.2-bin.zip
    
  3. 在 <ProjectName>/Application/configs/platforms/android_gradle/app/build.gradle:

    • 替换:

      android {
          compileSdkVersion 28
      
          defaultConfig {
              minSdkVersion 26
              targetSdkVersion  28
      
              // ...
          }
      }
      

      通过

      android {
          // Add a namespace for your Kanzi application.
          // In most cases, the namespace is the same as "applicationId".
          namespace '<project-namespace>'
          compileSdk 32
      
          defaultConfig {
              minSdk 26
              targetSdk 28
      
              // ...
          }
      }
      
    • 移除:

      kanzi {
          appFramework "kanziruntime-droidfw"
      }
      
    • 在 dependencies 部分添加一个新项目:

      dependencies {
          implementation 'com.rightware.kanzi:kanziruntime-droidfw@aar'
          // ...
      }
      
    • 设置 Android SDK 版本:

      • 如果您不打算在 Google Play 上发布您的 Kanzi 应用程序,请在 android 部分中禁用目标 SDK 版本的检查:

        android {
            lintOptions {
                disable 'ExpiredTargetSdkVersion'
            }
        }
        
      • 如果您计划在 Google Play 上发布您的 Kanzi 应用程序,请将 targetSdk 选项设置为 Google Play 要求的值。请参阅 https://developer.android.com/google/play/requirements/target-sdk。

        例如:

        android {
            defaultConfig {
                targetSdk 33
            }
        }
        
  4. 在 <ProjectName>/Application/configs/platforms/android_gradle/app/src/main/AndroidManifest.xml 中,更改:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="<PackageName>">
    

    至 (To)

    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
    
  5. 如果您的应用程序使用 Code Behind,请在 <ProjectName>/Application/CMakeLists.txt 中,在 add_subdirectory 对 Code Behind 的调用中,将空格替换为下划线。

    例如,替换:

    set(XML_data_source_codebehind_lib_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../../Tool_project/CodeBehind/XML data source")
    if(EXISTS "${XML_data_source_codebehind_lib_dir}")
        add_subdirectory("${XML_data_source_codebehind_lib_dir}" "${CMAKE_CURRENT_BINARY_DIR}/CodeBehind/XML data source")
        include_directories(${XML_data_source_codebehind_lib_dir}/include)
        target_link_libraries(XML_data_source_executable XML_data_source_CodeBehind)
    endif()
    

    通过

    set(XML_data_source_codebehind_lib_dir "${CMAKE_CURRENT_SOURCE_DIR}/../../../Tool_project/CodeBehind/XML data source")
    if(EXISTS "${XML_data_source_codebehind_lib_dir}")
        add_subdirectory("${XML_data_source_codebehind_lib_dir}" "${CMAKE_CURRENT_BINARY_DIR}/CodeBehind/XML_data_source")
        include_directories(${XML_data_source_codebehind_lib_dir}/include)
        target_link_libraries(XML_data_source_executable XML_data_source_CodeBehind)
    endif()
    
  6. 在 Kanzi Studio 中,打开应用程序的 Kanzi Studio 项目。选择 File > Open Kanzi Command Prompt,并在命令行中运行:

    cd ..\Application\configs\platforms\android_gradle\
    gradlew wrapper
    

    您可以这样升级应用程序中的 Gradle。

  7. (可选) 如果您想在 Android Studio 中打开 Kanzi 应用程序,请将 Android Studio 更新到 Electric Eel 或更新版本。

    如果您从 Kanzi Studio 构建 Kanzi Android 应用程序,则不需要此步骤。

对 EGL API 的更改

将函数 getEGLConfig 从 qnx_egl_common.hpp 移动到 egl_common.hpp。如果您的 Kanzi 应用程序使用该函数,请包含 egl_common.hpp 头文件。

Material API 的更改

删除了 Material::ChangeCounterProperty 属性类型。RenderEntry3D 监听材质属性的变化。

对主循环调度器的更改

在主循环调度器中,删除了所有外部触发的过载函数,即以经过时间作为参数的函数。

要将主循环调度器附加到您的自定义时间源,您现在可以使用 MainLoopScheduler::setClockCallback,并使用不带参数的相应重载:

Kanzi 3.9.7

Kanzi 3.9.8

MainLoopScheduler::advanceFrame
(chrono::nanoseconds lastFrameDuration)

MainLoopScheduler::advanceFrame,MainLoopScheduler::setClockCallback

MainLoopScheduler::getDurationUntilNextTimer
(chrono::nanoseconds elapsedDuration)

MainLoopScheduler::getDurationUntilNextTimer, MainLoopScheduler::setClockCallback

MainLoopScheduler::run
(chrono::nanoseconds lastFrameDuration)

MainLoopScheduler::run,MainLoopScheduler::setClockCallback

对 Wayland 图形输出 API 的更改

将默认的Wayland shell从IVI更改为XDG,并移除了回退选项。

您现在可以设置 Kanzi 使用的 Wayland shell。请参阅 Wayland shell。

另请参阅

Kanzi 3.9.8 发行说明

已知问题