summaryrefslogtreecommitdiff
path: root/src_no_quickstep
diff options
context:
space:
mode:
author Sunny Goyal <sunnygoyal@google.com> 2024-03-25 11:53:17 -0700
committer Sunny Goyal <sunnygoyal@google.com> 2024-03-26 17:16:52 +0000
commit77954bae4e77ba431a6ae8bb9997d6611c1de308 (patch)
tree0abfa2f8cfb5009280db190e8368203821dbdc64 /src_no_quickstep
parent4fd3e878425fbe6fadb8a49c95a20742a5244153 (diff)
Cleaning up some build configurations
> Removing Launcher3Go-without-quickstep > Removing src_ui_overrides to src_no_quickstep > Removing unnecessary code swpa for GO builds Bug: 330920490 Flag: None Test: Presubmit, everything builds Change-Id: I5746dbc7c5a37c1d99d78b55bf2a6adce1a711c9
Diffstat (limited to 'src_no_quickstep')
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/ApiWrapper.java137
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/PredictedAppIconInflater.java29
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java27
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/flags/FlagsFactory.java73
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java64
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java104
-rw-r--r--src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java67
7 files changed, 501 insertions, 0 deletions
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/ApiWrapper.java b/src_no_quickstep/com/android/launcher3/uioverrides/ApiWrapper.java
new file mode 100644
index 0000000000..90271c1cae
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/ApiWrapper.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+
+package com.android.launcher3.uioverrides;
+
+import android.app.ActivityOptions;
+import android.app.Person;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.LauncherActivityInfo;
+import android.content.pm.ShortcutInfo;
+import android.graphics.drawable.ColorDrawable;
+import android.net.Uri;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.util.ArrayMap;
+
+import com.android.launcher3.Utilities;
+import com.android.launcher3.util.UserIconInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A wrapper for the hidden API calls
+ */
+public class ApiWrapper {
+
+ public static final boolean TASKBAR_DRAWN_IN_PROCESS = false;
+
+ public static Person[] getPersons(ShortcutInfo si) {
+ return Utilities.EMPTY_PERSON_ARRAY;
+ }
+
+ public static Map<String, LauncherActivityInfo> getActivityOverrides(Context context) {
+ return Collections.emptyMap();
+ }
+
+ /**
+ * Creates an ActivityOptions to play fade-out animation on closing targets
+ */
+ public static ActivityOptions createFadeOutAnimOptions(Context context) {
+ return ActivityOptions.makeCustomAnimation(context, 0, android.R.anim.fade_out);
+ }
+
+ /**
+ * Returns a map of all users on the device to their corresponding UI properties
+ */
+ public static Map<UserHandle, UserIconInfo> queryAllUsers(Context context) {
+ UserManager um = context.getSystemService(UserManager.class);
+ Map<UserHandle, UserIconInfo> users = new ArrayMap<>();
+ List<UserHandle> usersActual = um.getUserProfiles();
+ if (usersActual != null) {
+ for (UserHandle user : usersActual) {
+ long serial = um.getSerialNumberForUser(user);
+
+ // Simple check to check if the provided user is work profile
+ // TODO: Migrate to a better platform API
+ NoopDrawable d = new NoopDrawable();
+ boolean isWork = (d != context.getPackageManager().getUserBadgedIcon(d, user));
+ UserIconInfo info = new UserIconInfo(
+ user,
+ isWork ? UserIconInfo.TYPE_WORK : UserIconInfo.TYPE_MAIN,
+ serial);
+ users.put(user, info);
+ }
+ }
+ return users;
+ }
+
+ /**
+ * Returns the list of the system packages that are installed at user creation.
+ * An empty list denotes that all system packages are installed for that user at creation.
+ */
+ public static List<String> getPreInstalledSystemPackages(Context context, UserHandle user) {
+ return new ArrayList<>();
+ }
+
+ /**
+ * Returns an intent which can be used to start the App Market activity (Installer
+ * Activity).
+ */
+ public static Intent getAppMarketActivityIntent(Context context, String packageName,
+ UserHandle user) {
+ return new Intent(Intent.ACTION_VIEW)
+ .setData(new Uri.Builder()
+ .scheme("market")
+ .authority("details")
+ .appendQueryParameter("id", packageName)
+ .build())
+ .putExtra(Intent.EXTRA_REFERRER, new Uri.Builder().scheme("android-app")
+ .authority(context.getPackageName()).build());
+ }
+
+ /**
+ * Returns an intent which can be used to open Private Space Settings.
+ */
+ public static Intent getPrivateSpaceSettingsIntent(Context context) {
+ return null;
+ }
+
+ /**
+ * Checks if an activity is flagged as non-resizeable.
+ */
+ public static boolean isNonResizeableActivity(LauncherActivityInfo lai) {
+ // Overridden in quickstep
+ return false;
+ }
+
+
+ private static class NoopDrawable extends ColorDrawable {
+ @Override
+ public int getIntrinsicHeight() {
+ return 1;
+ }
+
+ @Override
+ public int getIntrinsicWidth() {
+ return 1;
+ }
+ }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/PredictedAppIconInflater.java b/src_no_quickstep/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
new file mode 100644
index 0000000000..4893c1740e
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+package com.android.launcher3.uioverrides;
+
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import com.android.launcher3.model.data.WorkspaceItemInfo;
+
+/** A util class that inflates a predicted app icon */
+public class PredictedAppIconInflater {
+ public static View inflate(LayoutInflater inflater, ViewGroup parent, WorkspaceItemInfo info) {
+ return null;
+ }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java b/src_no_quickstep/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java
new file mode 100644
index 0000000000..6afa446f9b
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/flags/DeveloperOptionsUI.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+package com.android.launcher3.uioverrides.flags;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceFragmentCompat;
+
+/**
+ * Place holder class for developer options.
+ */
+public class DeveloperOptionsUI {
+
+ public DeveloperOptionsUI(PreferenceFragmentCompat fragment, PreferenceCategory flags) { }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/flags/FlagsFactory.java b/src_no_quickstep/com/android/launcher3/uioverrides/flags/FlagsFactory.java
new file mode 100644
index 0000000000..b193d37895
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/flags/FlagsFactory.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+package com.android.launcher3.uioverrides.flags;
+
+import static com.android.launcher3.config.FeatureFlags.FlagState.ENABLED;
+
+import androidx.annotation.Nullable;
+
+import com.android.launcher3.ConstantItem;
+import com.android.launcher3.config.FeatureFlags.BooleanFlag;
+import com.android.launcher3.config.FeatureFlags.FlagState;
+import com.android.launcher3.config.FeatureFlags.IntFlag;
+
+import java.io.PrintWriter;
+
+/**
+ * Helper class to create various flags for launcher build. The base implementation does
+ * not provide any flagging system, and simply replies with the default value.
+ */
+public class FlagsFactory {
+
+ /**
+ * Creates a new debug flag
+ */
+ public static BooleanFlag getDebugFlag(
+ int bugId, String key, FlagState flagState, String description) {
+ return new BooleanFlag(flagState == ENABLED);
+ }
+
+ /**
+ * Creates a new debug flag
+ */
+ public static BooleanFlag getReleaseFlag(
+ int bugId, String key, FlagState flagState, String description) {
+ return new BooleanFlag(flagState == ENABLED);
+ }
+
+ /**
+ * Creates a new integer flag. Integer flags are always release flags
+ */
+ public static IntFlag getIntFlag(
+ int bugId, String key, int defaultValueInCode, String description) {
+ return new IntFlag(defaultValueInCode);
+ }
+
+ /**
+ * Creates a new debug integer flag and it is saved in LauncherPrefs.
+ */
+ public static IntFlag getIntFlag(
+ int bugId, String key, int defaultValueInCode, String description,
+ @Nullable ConstantItem<Integer> launcherPrefFlag) {
+ return new IntFlag(defaultValueInCode);
+ }
+
+ /**
+ * Dumps the current flags state to the print writer
+ */
+ public static void dump(PrintWriter pw) { }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java b/src_no_quickstep/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java
new file mode 100644
index 0000000000..e1a35c963d
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/plugins/PluginManagerWrapper.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+package com.android.launcher3.uioverrides.plugins;
+
+import android.content.ComponentName;
+import android.content.Context;
+
+import com.android.launcher3.util.MainThreadInitializedObject;
+import com.android.systemui.plugins.Plugin;
+import com.android.systemui.plugins.PluginListener;
+
+import java.util.Collections;
+import java.util.Set;
+
+import androidx.preference.PreferenceDataStore;
+
+public class PluginManagerWrapper {
+
+ public static final MainThreadInitializedObject<PluginManagerWrapper> INSTANCE =
+ new MainThreadInitializedObject<>(PluginManagerWrapper::new);
+
+ private static final String PREFIX_PLUGIN_ENABLED = "PLUGIN_ENABLED_";
+ public static final String PLUGIN_CHANGED = "com.android.systemui.action.PLUGIN_CHANGED";
+
+ private PluginManagerWrapper(Context c) {
+ }
+
+ public void addPluginListener(PluginListener<? extends Plugin> listener, Class<?> pluginClass) {
+ }
+
+ public void addPluginListener(PluginListener<? extends Plugin> listener, Class<?> pluginClass,
+ boolean allowMultiple) {
+ }
+
+ public void removePluginListener(PluginListener<? extends Plugin> listener) { }
+
+ public Set<String> getPluginActions() {
+ return Collections.emptySet();
+ }
+
+ public PreferenceDataStore getPluginEnabler() {
+ return new PreferenceDataStore() { };
+ }
+
+ public static String pluginEnabledKey(ComponentName cn) {
+ return PREFIX_PLUGIN_ENABLED + cn.flattenToString();
+ }
+
+ public static boolean hasPlugins(Context context) {
+ return false;
+ }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java b/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java
new file mode 100644
index 0000000000..b62dbd1d95
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+package com.android.launcher3.uioverrides.states;
+
+import static com.android.app.animation.Interpolators.DECELERATE;
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
+
+import android.content.Context;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.R;
+import com.android.launcher3.util.Themes;
+import com.android.launcher3.views.ActivityContext;
+
+/**
+ * Definition for AllApps state
+ */
+public class AllAppsState extends LauncherState {
+
+ private static final float PARALLAX_COEFFICIENT = .125f;
+
+ private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE;
+
+ public AllAppsState(int id) {
+ super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS);
+ }
+
+ @Override
+ public <DEVICE_PROFILE_CONTEXT extends Context & ActivityContext>
+ int getTransitionDuration(DEVICE_PROFILE_CONTEXT context, boolean isToState) {
+ return isToState
+ ? context.getDeviceProfile().allAppsOpenDuration
+ : context.getDeviceProfile().allAppsCloseDuration;
+ }
+
+ @Override
+ public String getDescription(Launcher launcher) {
+ return launcher.getString(R.string.all_apps_button_label);
+ }
+
+ @Override
+ public int getVisibleElements(Launcher launcher) {
+ return ALL_APPS_CONTENT;
+ }
+
+ @Override
+ public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) {
+ return new ScaleAndTranslation(launcher.getDeviceProfile().workspaceContentScale, NO_OFFSET,
+ NO_OFFSET);
+ }
+
+ @Override
+ public ScaleAndTranslation getHotseatScaleAndTranslation(Launcher launcher) {
+ if (launcher.getDeviceProfile().isTablet) {
+ return getWorkspaceScaleAndTranslation(launcher);
+ } else {
+ ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW
+ .getWorkspaceScaleAndTranslation(launcher);
+ return new ScaleAndTranslation(
+ launcher.getDeviceProfile().workspaceContentScale,
+ overviewScaleAndTranslation.translationX,
+ overviewScaleAndTranslation.translationY);
+ }
+ }
+
+ @Override
+ public PageAlphaProvider getWorkspacePageAlphaProvider(Launcher launcher) {
+ PageAlphaProvider superPageAlphaProvider = super.getWorkspacePageAlphaProvider(launcher);
+ return new PageAlphaProvider(DECELERATE) {
+ @Override
+ public float getPageAlpha(int pageIndex) {
+ return launcher.getDeviceProfile().isTablet
+ ? superPageAlphaProvider.getPageAlpha(pageIndex)
+ : 0;
+ }
+ };
+ }
+
+ @Override
+ public float getVerticalProgress(Launcher launcher) {
+ return 0f;
+ }
+
+ @Override
+ public int getWorkspaceScrimColor(Launcher launcher) {
+ return launcher.getDeviceProfile().isTablet
+ ? launcher.getResources().getColor(R.color.widgets_picker_scrim)
+ : Themes.getAttrColor(launcher, R.attr.allAppsScrimColor);
+ }
+}
diff --git a/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java b/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java
new file mode 100644
index 0000000000..7a228c42b8
--- /dev/null
+++ b/src_no_quickstep/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2017 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.
+ */
+package com.android.launcher3.uioverrides.states;
+
+import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
+
+import android.content.Context;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.R;
+import com.android.launcher3.util.Themes;
+
+/**
+ * Definition for overview state
+ */
+public class OverviewState extends LauncherState {
+
+ public OverviewState(int id) {
+ super(id, LAUNCHER_STATE_OVERVIEW, FLAG_DISABLE_RESTORE);
+ }
+
+ @Override
+ public int getTransitionDuration(Context context, boolean isToState) {
+ return 250;
+ }
+
+ public static OverviewState newBackgroundState(int id) {
+ return new OverviewState(id);
+ }
+
+ public static OverviewState newSwitchState(int id) {
+ return new OverviewState(id);
+ }
+
+ /**
+ * New Overview substate that represents the overview in modal mode (one task shown on its own)
+ */
+ public static OverviewState newModalTaskState(int id) {
+ return new OverviewState(id);
+ }
+
+ /**
+ * New Overview substate that represents the overview in modal mode (one task shown on its own)
+ */
+ public static OverviewState newSplitSelectState(int id) {
+ return new OverviewState(id);
+ }
+
+ @Override
+ public int getWorkspaceScrimColor(Launcher launcher) {
+ return Themes.getAttrColor(launcher, R.attr.overviewScrimColor);
+ }
+}