Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 29a31398 authored by Anna Zhuravleva's avatar Anna Zhuravleva
Browse files

Add shortcut to install an app to Private space

Introduce long-press shortcut to install a copy
of the main user app to private space.

Test: manual, installed apps in different stores
and tried shortcut
https://screenshot.googleplex.com/6oAVamTytiYmvPC.png
Bug: 316118005
Flag: ACONFIG com.android.launcher3.Flags.enable_private_space_install_shortcut DEVELOPMENT

Change-Id: I702cd2a27388e3cc6e9e126308d5479836ba6655
parent 0f8d2802
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -104,3 +104,10 @@ flag {
    description: "Enables support for archived apps in Launcher3, such as empty progress bar etc."
    bug: "210590852"
}

flag {
    name: "enable_private_space_install_shortcut"
    namespace: "launcher"
    description: "Enables long-press shortcut to install a copy of an app to Private space"
    bug: "316118005"
}
+4 −2
Original line number Diff line number Diff line
@@ -129,8 +129,10 @@ public class ApiWrapper {
    public static Intent getAppMarketActivityIntent(Context context, String packageName,
            UserHandle user) {
        LauncherApps launcherApps = context.getSystemService(LauncherApps.class);
        if (android.os.Flags.allowPrivateProfile() && Flags.enablePrivateSpace()
                && Flags.privateSpaceAppInstallerButton()) {
        if (android.os.Flags.allowPrivateProfile()
                && Flags.enablePrivateSpace()
                && (Flags.privateSpaceAppInstallerButton()
                        || Flags.enablePrivateSpaceInstallShortcut())) {
            StartActivityParams params = new StartActivityParams((PendingIntent) null, 0);
            params.intentSender = launcherApps.getAppMarketActivityIntent(packageName, user);
            return ProxyActivityStarter.getLaunchIntent(context, params);
+6 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import static com.android.launcher3.model.data.ItemInfo.NO_MATCHING_ID;
import static com.android.launcher3.popup.QuickstepSystemShortcut.getSplitSelectShortcutByPosition;
import static com.android.launcher3.popup.SystemShortcut.APP_INFO;
import static com.android.launcher3.popup.SystemShortcut.INSTALL;
import static com.android.launcher3.popup.SystemShortcut.PRIVATE_PROFILE_INSTALL;
import static com.android.launcher3.popup.SystemShortcut.WIDGETS;
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.ALL_APPS_PAGE_PROGRESS_INDEX;
import static com.android.launcher3.taskbar.LauncherTaskbarUIController.MINUS_ONE_PAGE_PROGRESS_INDEX;
@@ -94,6 +95,7 @@ import androidx.annotation.RequiresApi;
import com.android.app.viewcapture.SettingsAwareViewCapture;
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Flags;
import com.android.launcher3.HomeTransitionController;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherSettings.Favorites;
@@ -414,6 +416,10 @@ public class QuickstepLauncher extends Launcher {
        shortcuts.addAll(getSplitShortcuts());
        shortcuts.add(WIDGETS);
        shortcuts.add(INSTALL);

        if (Flags.enablePrivateSpaceInstallShortcut()) {
            shortcuts.add(PRIVATE_PROFILE_INSTALL);
        }
        return shortcuts.stream();
    }

+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2024 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="960"
    android:viewportHeight="960"
    android:tint="?attr/colorControlNormal">

    <path
        android:fillColor="@android:color/white"
        android:pathData="M420,600L540,600L517,471Q537,461 548.5,442Q560,423 560,400Q560,367 536.5,343.5Q513,320 480,320Q447,320 423.5,343.5Q400,367 400,400Q400,423 411.5,442Q423,461 443,471L420,600ZM480,880Q341,845 250.5,720.5Q160,596 160,444L160,200L480,80L800,200L800,444Q800,596 709.5,720.5Q619,845 480,880ZM480,796Q584,763 652,664Q720,565 720,444L720,255L480,165L240,255L240,444Q240,565 308,664Q376,763 480,796ZM480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Z"/>
</vector>
+2 −0
Original line number Diff line number Diff line
@@ -171,6 +171,8 @@
    <string name="uninstall_drop_target_label">Uninstall</string>
    <!-- Label for app info drop target. [CHAR_LIMIT=20] -->
    <string name="app_info_drop_target_label">App info</string>
    <!-- Label for install to private profile shortcut label. [CHAR_LIMIT=20] -->
    <string name="install_private_system_shortcut_label">Install in private</string>
    <!-- Label for install drop target. [CHAR_LIMIT=20] -->
    <string name="install_drop_target_label">Install</string>
    <!-- Label for install dismiss prediction. -->
Loading