Do not show install shortcut for Settings

Private profile shares Settings with the main user,
this change disable showing "Install to private"
long-press shortcut for Settings.

Bug: 316118005
Test: long press on Settings app
Flag: ACONFIG com.android.launcher3.Flags.enable_private_space_install_shortcut DEVELOPMENT

Change-Id: Iecc0bdf60879ce5c74288942d39bbb3add68fd9c
diff --git a/res/values/config.xml b/res/values/config.xml
index 33eb4c7..47756ba 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -253,4 +253,10 @@
 
     <!--  Used for custom widgets  -->
     <array name="custom_widget_providers"/>
+
+
+    <!-- Skip "Install to private" long-press shortcut packages name -->
+    <string-array name="skip_private_profile_shortcut_packages" translatable="false">
+        <item>com.android.settings</item>
+    </string-array>
 </resources>
diff --git a/src/com/android/launcher3/popup/SystemShortcut.java b/src/com/android/launcher3/popup/SystemShortcut.java
index 8463361..d4ab4ab 100644
--- a/src/com/android/launcher3/popup/SystemShortcut.java
+++ b/src/com/android/launcher3/popup/SystemShortcut.java
@@ -5,6 +5,7 @@
 import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP;
 
 import android.app.ActivityOptions;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.graphics.Rect;
@@ -34,6 +35,7 @@
 import com.android.launcher3.views.ActivityContext;
 import com.android.launcher3.widget.WidgetsBottomSheet;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -236,13 +238,21 @@
                     return null;
                 }
                 // Do not show shortcut if an app is already installed to the space
-                ComponentKey targetKey =
-                        new ComponentKey(itemInfo.getTargetComponent(), privateProfileUser);
-                if (launcher.getAppsView().getAppsStore().getApp(targetKey) != null) {
+                ComponentName targetComponent = itemInfo.getTargetComponent();
+                if (launcher.getAppsView()
+                                .getAppsStore()
+                                .getApp(new ComponentKey(targetComponent, privateProfileUser))
+                        != null) {
                     return null;
                 }
 
-                // TODO(b/302666597): do not install app if it's in deny list (e.g. settings)
+                // Do not show shortcut for settings
+                String[] packagesToSkip =
+                        launcher.getResources()
+                                .getStringArray(R.array.skip_private_profile_shortcut_packages);
+                if (Arrays.asList(packagesToSkip).contains(targetComponent.getPackageName())) {
+                    return null;
+                }
 
                 return new InstallToPrivateProfile(
                         launcher, itemInfo, originalView, privateProfileUser);