活动选择器中列出的活动已导出= false [英] Activity exported=false listed in activity chooser

查看:79
本文介绍了活动选择器中列出的活动已导出= false的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个类似的申请(一个免费,一个付费).

I have two similar applications (one free, one paid).

使用exported="false"

    <activity
        android:name=".MyActivity"
        android:exported="false"
        android:noHistory="true" >
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="vnd.android.cursor.item/vnd.mine" />
        </intent-filter>
    </activity>

当我从免费应用程序以适当的隐式意图调用startActivity时,活动选择器就会出现.

When I call startActivity with the appropriate implicit intent from the free app, the activity picker appears.

我不明白为什么付费应用中的活动会出现,因为它是 exported="false"

I don't understand why the activity from the paid app appears, since it is exported="false"

我想我可以基于URL添加一个意图过滤器,但是我的问题是:当文档读取时,为什么另一个应用程序的活动会出现

I suppose I can add an intent filter based on the URL, but my question is: why does the activity from the other app appear when the doc reads

该活动是否可以由其他应用程序的组件启动

Whether or not the activity can be launched by components of other applications

推荐答案

我不明白为什么付费应用中的活动会出现,因为它会导出="false"

I don't understand why the activity from the paid app appears, since it is exported="false"

因为您有匹配的<intent-filter>.由于不需要<intent-filter>进行非导出的活动,因此只需将其删除并在开始此活动时使用显式的Intent.

Because you have a matching <intent-filter>. Since you do not need the <intent-filter> for a non-exported activity, simply delete it and use an explicit Intent when starting this activity.

当文档读取时,为什么会出现其他应用程序的活动...

why does the activity from the other app appear when the doc reads...

我有相同的问题,并被告知是预期的行为,并且该错误是因为我们的应用程序中没有有用的<intent-filter>而导致的.引用戴安娜·哈克伯恩(Dianne Hackborn):

I had the same question and was told that this was expected behavior and the bug is in our app for having a useless <intent-filter>. Quoting Dianne Hackborn:

我通常会认为这是应用程序中的错误-如果您有不允许启动其他应用程序的活动,那么为什么要发布它们将匹配尝试启动的意图过滤器呢?活动的安全性(无论是未导出还是需要许可)都不是意图匹配的一部分. ...这种情况(发布与其他应用程序将使用的意图相匹配的活动,然后将其限制为不能由其他应用程序启动的活动)如果没有被彻底破坏,将是无用的.

I would generally consider this a bug in the app -- if you have an activity that you aren't allowing other apps to launch, why the heck are you publishing an intent filter that they will match to try to launch? The security of the activity (whether it is not exported or requires a permission) is not part of intent matching. ...this scenario (publishing an activity that matches intents other applications will use but then restricting it to not be launchable by other applications) is not useful if not outright broken.

这篇关于活动选择器中列出的活动已导出= false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆