【问题标题】:InstrumentClusterRenderingService cannot recognize my navigation AppInstrumentClusterRenderingService 无法识别我的导航应用
【发布时间】:2022-11-11 10:39:51
【问题描述】:

我正在开发一个 AAOS(Android 汽车操作系统)平台。操作系统版本为 10。

我在我的 car_product/build/car.mk 中包含“DirectRenderingCluster”作为 PRODUCT_PACKAGES += DirectRenderingCluster。 在这个App中,有一个ClusterRenderingService,它实现了InstrumentClusterRenderingService

在 InstrumentClusterRenderingService 中,它会尝试从 PackageManager 中收集合适的导航 App 的一些信息。最初,它会在 EmbeddedKitchenSinkApp 中选择FakeClusterNavigationActivity

我想用我自己的导航应用程序替换 FakeClusterNavigationActivity。 我模仿它并进行了类似的活动。 但是,我在InstrumentClusterRenderingService 的第 153 行和第 299 行收到错误消息。

我想念什么?我应该怎么做才能让 Car 服务识别我的 App 是符合条件的集群导航 App?谢谢你。

我的 AndroidManifest.xml 如下所示。 targetSdkVersion 为 29。

<manifest
    package="com.mytest.android"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:versionName="1.0"
    android:versionCode="1"
    android:installLocation="auto"
    android:sharedUserId="android.uid.system">
    <application
        android:hardwareAccelerated="true"
        android:directBootAware="true"
        android:persistent="false"
        android:name="com.mytest.android.NaviApp"
        android:label="@string/application_label"
        android:icon="@drawable/icon">
        <!-- Activity for cluster. Note that this is not the only activity in this App. -->
        <activity android:process=":map_surface"
            android:name=".MapSurfaceActivity"
            android:label="MapSurfaceActivity"
            android:screenOrientation="landscape"
            android:launchMode="singleInstance"
            android:allowEmbedded="true"
            android:exported="true"
            android:theme="@android:style/Theme.NoTitleBar.Fullscreen">

            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.car.cluster.NAVIGATION"/>
            </intent-filter>
        </activity>

        <!-- Content provider for images (fake, not functional) -->
        <provider android:name=".cluster.ClusterContentProvider"
            android:authorities="com.mytest.android.cluster.clustercontentprovider"
            android:grantUriPermissions="true"
            android:exported="true"/>

【问题讨论】:

    标签: android android-automotive


    【解决方案1】:

    原来是谷歌的bug,已经在后面的代码中修复了。

    如果导航应用程序以非系统用户身份启动并且没有为系统用户安装,则会出现此错误。 在原始代码中,它使用系统用户的 PackageManager 调用 getPackageInfo() 和 queryIntentActivities()。但是,导航应用没有为系统用户安装(可能被列入黑名单),所以不会被找到。

    要解决此问题,应在 getPackageInfo() 中使用 PackageManager.MATCH_ANY_USER 标志,并应使用 queryIntentActivitiesAsUser() 代替 queryIntentActivities()。

    我不知道是什么提交修复了它们,但它们显示在主分支中。 https://android.googlesource.com/platform/packages/services/Car/+/master/car-lib/src/android/car/cluster/renderer/InstrumentClusterRenderingService.java

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-07-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-23
      • 1970-01-01
      • 1970-01-01
      • 2015-02-10
      相关资源
      最近更新 更多