mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
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
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -5,6 +5,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
|
||||
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.util.PackageUserKey;
|
||||
import com.android.launcher3.views.ActivityContext;
|
||||
import com.android.launcher3.widget.WidgetsBottomSheet;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -236,13 +238,21 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user