Java 锁定快捷方式中奇怪的应用程序图标重复(Android O)

Java 锁定快捷方式中奇怪的应用程序图标重复(Android O),java,android,icons,shortcut,android-8.0-oreo,Java,Android,Icons,Shortcut,Android 8.0 Oreo,我正在为Android O设备(模拟器或物理设备)创建我的应用程序启动器图标的固定快捷方式,发现了奇怪的行为。我的代码如下所示: @TargetApi(Build.VERSION_CODES.O) private void createPinnedShortcut(Context context) { ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);

我正在为Android O设备(模拟器或物理设备)创建我的应用程序启动器图标的固定快捷方式,发现了奇怪的行为。我的代码如下所示:

@TargetApi(Build.VERSION_CODES.O)
    private void createPinnedShortcut(Context context) {
        ShortcutManager shortcutManager = context.getSystemService(ShortcutManager.class);
        if (shortcutManager != null) {
            if (shortcutManager.isRequestPinShortcutSupported()) {
                Intent intent= MainActivity.getLaunchIntent(this);
                intent.setAction(Intent.ACTION_VIEW);

                ShortcutInfo shortcut = new ShortcutInfo.Builder(context, "my_shortcut_id")
                        .setShortLabel(context.getString(R.string.my_app_description))
                        .setLongLabel(context.getString(R.string.my_app_long_description))
                        .setIcon(Icon.createWithResource(context, R.mipmap.my_app_icon))
                        .setIntent(intent)
                        .build();
                shortcutManager.requestPinShortcut(shortcut, null);
            } else
                Toast.makeText(context, "Pinned shortcuts are not supported!", Toast.LENGTH_SHORT).show();
        }
    }
一切正常,但主屏幕上的启动器图标重复:

有一个普通的图标,但在右下角它放置了另一个图标副本(大约小30-40%)

我的图标资源位于
res/mipmap-*dpi*
文件夹中

有什么线索吗

更新

答复评论:

1)
/build/manifests/debug
下的AndroidManifest如下所示:

    <activity
        android:name="ru.ivanovpv.cellboxkeeper.android.MainActivity"
        android:exported="true"
        android:label="@string/cellboxkeeper"
        android:theme="@style/DefaultActivityTheme.Light"
        android:windowSoftInputMode="adjustResize" >
        <layout
            android:defaultHeight="800dp"
            android:defaultWidth="480dp"
            android:gravity="top|end"
            android:minHeight="320dp"
            android:minWidth="240dp" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter> <!-- handle cbx files -->
        <intent-filter
            android:icon="@mipmap/cellboxkeeper"
            android:label="@string/cellboxkeeper"
            android:logo="@mipmap/cellboxkeeper" >
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:host="*"
                android:mimeType="*/*"
                android:pathPattern=".*\\.cbx"
                android:scheme="content" />
        </intent-filter> 
        <!-- receive files from android share intent -->
        <intent-filter
            android:icon="@mipmap/cellboxkeeper"
            android:label="@string/addToCellboxKeeper" >
            <action android:name="android.intent.action.SEND" />
            <action android:name="android.intent.action.SEND_MULTIPLE" />
            <data android:mimeType="*/*" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


还有其他版本吗?

我找到了解决方案,关键是属性
android:logo

<intent-filter
        android:icon="@mipmap/cellboxkeeper"
        android:label="@string/cellboxkeeper"
        android:logo="@mipmap/cellboxkeeper" >
        <action android:name="android.intent.action.VIEW" />

删除带有android:logo的行可以修复重复问题


希望有人,有时会使用并理解发生了什么

请检查文件“/build/manifests/debug/AndroidManifest.xml”并查看定义了多少次意图过滤器标记,这些标记应该只在您的主要活动中定义。应该是这样的:…“android.intent.action.MAIN”/>请共享
mipmap-anydpi-v26
目录的内容。请阅读问题更新我根本没有
android:logo
,但我的图标还是被复制了,有什么想法吗?锁定的快捷方式创建会生成ShortcutInfo,供launcher应用程序使用。默认情况下,launcher应用程序使用LauncherApps.getShortcutBadgedIconDrawable的特殊版本生成快捷方式图标。此函数用于创建带有创建锁定快捷方式的应用程序徽章的图标。所以你可以看到这个徽章。目前,您无法对此执行任何操作。