Merge "Fixing incorrect taskView size in multiwindow-landscape" into ub-launcher3-rvc-dev
diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto
index f1db144..5f5fab0 100644
--- a/protos/launcher_atom.proto
+++ b/protos/launcher_atom.proto
@@ -49,15 +49,26 @@
FolderContainer folder = 3;
AllAppsContainer all_apps_container = 4;
WidgetsContainer widgets_container = 5;
+ PredictionContainer prediction_container = 6;
+ SearchResultContainer search_result_container = 7;
}
}
+// Represents the apps list sorted alphabetically inside the all-apps view.
message AllAppsContainer {
}
message WidgetsContainer {
}
+// Represents the predicted apps row(top row) in the all-apps view.
+message PredictionContainer {
+}
+
+// Represents the apps container within search results.
+message SearchResultContainer {
+}
+
enum Origin {
UNKNOWN = 0;
DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
index e4d0adf..7c4f3ec 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatEduController.java
@@ -15,17 +15,9 @@
*/
package com.android.launcher3.hybridhotseat;
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
import android.content.Intent;
-import android.content.res.Configuration;
-import android.os.Build;
import android.view.View;
-import androidx.core.app.NotificationCompat;
-
import com.android.launcher3.CellLayout;
import com.android.launcher3.Hotseat;
import com.android.launcher3.InvariantDeviceProfile;
@@ -37,11 +29,8 @@
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.uioverrides.QuickstepLauncher;
-import com.android.launcher3.util.ActivityTracker;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
-import com.android.launcher3.util.Themes;
import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.Snackbar;
@@ -54,18 +43,15 @@
* Controller class for managing user onboaridng flow for hybrid hotseat
*/
public class HotseatEduController {
+
public static final String KEY_HOTSEAT_EDU_SEEN = "hotseat_edu_seen";
-
- private static final String NOTIFICATION_CHANNEL_ID = "launcher_onboarding";
- private static final int ONBOARDING_NOTIFICATION_ID = 7641;
-
+ public static final String HOTSEAT_EDU_ACTION =
+ "com.android.launcher3.action.SHOW_HYBRID_HOTSEAT_EDU";
private static final String SETTINGS_ACTION =
"android.settings.ACTION_CONTENT_SUGGESTIONS_SETTINGS";
private final Launcher mLauncher;
private final Hotseat mHotseat;
- private final NotificationManager mNotificationManager;
- private final Notification mNotification;
private List<WorkspaceItemInfo> mPredictedApps;
private HotseatEduDialog mActiveDialog;
@@ -77,9 +63,6 @@
mLauncher = launcher;
mHotseat = launcher.getHotseat();
mOnOnboardingComplete = runnable;
- mNotificationManager = mLauncher.getSystemService(NotificationManager.class);
- createNotificationChannel();
- mNotification = createNotification();
}
/**
@@ -216,11 +199,6 @@
return pageId;
}
-
- void removeNotification() {
- mNotificationManager.cancel(ONBOARDING_NOTIFICATION_ID);
- }
-
void moveHotseatItems() {
mHotseat.removeAllViewsInLayout();
if (!mNewItems.isEmpty()) {
@@ -258,45 +236,9 @@
void setPredictedApps(List<WorkspaceItemInfo> predictedApps) {
mPredictedApps = predictedApps;
- if (!mPredictedApps.isEmpty()
- && mLauncher.getOrientation() == Configuration.ORIENTATION_PORTRAIT) {
- mNotificationManager.notify(ONBOARDING_NOTIFICATION_ID, mNotification);
- }
- else {
- removeNotification();
- }
- }
-
- private void createNotificationChannel() {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
- CharSequence name = mLauncher.getString(R.string.hotseat_edu_prompt_title);
- int importance = NotificationManager.IMPORTANCE_LOW;
- NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name,
- importance);
- mNotificationManager.createNotificationChannel(channel);
- }
-
- private Notification createNotification() {
- Intent intent = new Intent(mLauncher.getApplicationContext(), mLauncher.getClass());
- intent = new NotificationHandler().addToIntent(intent);
-
- CharSequence name = mLauncher.getString(R.string.hotseat_edu_prompt_title);
- String description = mLauncher.getString(R.string.hotseat_edu_prompt_content);
- NotificationCompat.Builder builder = new NotificationCompat.Builder(mLauncher,
- NOTIFICATION_CHANNEL_ID)
- .setContentTitle(name)
- .setOngoing(true)
- .setColor(Themes.getColorAccent(mLauncher))
- .setContentIntent(PendingIntent.getActivity(mLauncher, 0, intent,
- PendingIntent.FLAG_CANCEL_CURRENT))
- .setSmallIcon(R.drawable.hotseat_edu_notification_icon)
- .setContentText(description);
- return builder.build();
-
}
void destroy() {
- removeNotification();
if (mActiveDialog != null) {
mActiveDialog.setHotseatEduController(null);
}
@@ -334,14 +276,5 @@
mActiveDialog.setHotseatEduController(this);
mActiveDialog.show(mPredictedApps);
}
-
- static class NotificationHandler implements
- ActivityTracker.SchedulerCallback<QuickstepLauncher> {
- @Override
- public boolean init(QuickstepLauncher activity, boolean alreadyOnHome) {
- activity.getHotseatPredictionController().showEdu();
- return true;
- }
- }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index e2acf93..05bcb57 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -41,7 +41,6 @@
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.allapps.AllAppsStore;
@@ -148,8 +147,7 @@
*/
public void showEdu() {
if (mHotseatEduController == null) return;
- mLauncher.getStateManager().goToState(LauncherState.NORMAL, true,
- () -> mHotseatEduController.showEdu());
+ mHotseatEduController.showEdu();
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
index 6761148..ce6bb7d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIcon.java
@@ -47,6 +47,7 @@
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.util.SafeCloseable;
+import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.DoubleShadowBubbleTextView;
/**
@@ -68,7 +69,6 @@
private int mPlateColor;
boolean mDrawForDrag = false;
-
public PredictedAppIcon(Context context) {
this(context, null, 0);
}
@@ -79,10 +79,8 @@
public PredictedAppIcon(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
- mDeviceProfile = Launcher.getLauncher(context).getDeviceProfile();
+ mDeviceProfile = ActivityContext.lookupContext(context).getDeviceProfile();
mNormalizedIconRadius = IconNormalizer.getNormalizedCircleSize(getIconSize()) / 2;
- setOnClickListener(ItemClickHandler.INSTANCE);
- setOnFocusChangeListener(Launcher.getLauncher(context).getFocusHandler());
int shadowSize = context.getResources().getDimensionPixelSize(
R.dimen.blur_size_thin_outline);
mShadowFilter = new BlurMaskFilter(shadowSize, BlurMaskFilter.Blur.OUTER);
@@ -241,6 +239,8 @@
PredictedAppIcon icon = (PredictedAppIcon) LayoutInflater.from(parent.getContext())
.inflate(R.layout.predicted_app_icon, parent, false);
icon.applyFromWorkspaceItem(info);
+ icon.setOnClickListener(ItemClickHandler.INSTANCE);
+ icon.setOnFocusChangeListener(Launcher.getLauncher(parent.getContext()).getFocusHandler());
return icon;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
new file mode 100644
index 0000000..8f1d319
--- /dev/null
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
@@ -0,0 +1,33 @@
+/*
+ * 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.R;
+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) {
+ PredictedAppIcon icon = (PredictedAppIcon) inflater.inflate(
+ R.layout.predicted_app_icon, parent, false);
+ icon.applyFromWorkspaceItem(info);
+ return icon;
+ }
+}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
index 9ae6080..494a98d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/QuickstepLauncher.java
@@ -44,6 +44,7 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.folder.Folder;
+import com.android.launcher3.hybridhotseat.HotseatEduController;
import com.android.launcher3.hybridhotseat.HotseatPredictionController;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
@@ -99,6 +100,20 @@
}
@Override
+ protected void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ if (HotseatEduController.HOTSEAT_EDU_ACTION.equals(intent.getAction())
+ && mHotseatPredictionController != null) {
+ boolean alreadyOnHome = hasWindowFocus() && ((intent.getFlags()
+ & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT)
+ != Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
+ getStateManager().goToState(NORMAL, alreadyOnHome, () -> {
+ mHotseatPredictionController.showEdu();
+ });
+ }
+ }
+
+ @Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
onStateOrResumeChanging(false /* inTransition */);
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
index c1b68ab..da304e5 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/NoButtonQuickSwitchTouchController.java
@@ -19,6 +19,7 @@
import static com.android.launcher3.LauncherState.HOTSEAT_ICONS;
import static com.android.launcher3.LauncherState.NORMAL;
import static com.android.launcher3.LauncherState.OVERVIEW;
+import static com.android.launcher3.LauncherState.OVERVIEW_BUTTONS;
import static com.android.launcher3.LauncherState.QUICK_SWITCH;
import static com.android.launcher3.anim.AlphaUpdateListener.ALPHA_CUTOFF_THRESHOLD;
import static com.android.launcher3.anim.Interpolators.ACCEL_0_75;
@@ -242,6 +243,8 @@
ADJACENT_PAGE_OFFSET.set(mRecentsView, 1f);
mRecentsView.setContentAlpha(1);
mRecentsView.setFullscreenProgress(fromState.getOverviewFullscreenProgress());
+ mLauncher.getActionsView().getVisibilityAlpha().setValue(
+ (fromState.getVisibleElements(mLauncher) & OVERVIEW_BUTTONS) != 0 ? 1f : 0f);
float[] scaleAndOffset = toState.getOverviewScaleAndOffset(mLauncher);
// As we drag right, animate the following properties:
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
index ef3d174..4954588 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TouchInteractionService.java
@@ -610,7 +610,7 @@
if (TestProtocol.sDebugTracing) {
Log.d(TestProtocol.PAUSE_NOT_DETECTED, "handleOrientationSetup.1");
}
- if (!isFixedRotationTransformEnabled(this)) {
+ if (!isFixedRotationTransformEnabled()) {
return;
}
mDeviceState.enableMultipleRegions(baseInputConsumer instanceof OtherActivityInputConsumer);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
index 3e0daaf..ebc9f96 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java
@@ -32,6 +32,7 @@
import android.view.View;
import android.view.ViewGroup;
+import com.android.launcher3.BaseQuickstepLauncher;
import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
@@ -42,6 +43,7 @@
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.anim.SpringAnimationBuilder;
import com.android.launcher3.graphics.OverviewScrim;
+import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.util.DynamicResource;
import com.android.quickstep.views.RecentsView;
@@ -128,6 +130,8 @@
addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS);
}
+ addDepthAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS);
+
mAnimators.play(launcher.getDragLayer().getScrim().createSysuiMultiplierAnim(0f, 1f)
.setDuration(ALPHA_DURATION_MS));
mAnimators.addListener(new AnimatorListenerAdapter() {
@@ -221,4 +225,14 @@
ACCEL_DEACCEL);
mAnimators.play(builder.buildAnim());
}
+
+ private void addDepthAnimationForState(Launcher launcher, LauncherState state, long duration) {
+ if (!(launcher instanceof BaseQuickstepLauncher)) {
+ return;
+ }
+ PendingAnimation builder = new PendingAnimation(duration);
+ DepthController depthController = ((BaseQuickstepLauncher) launcher).getDepthController();
+ depthController.setStateWithAnimation(state, new StateAnimationConfig(), builder);
+ mAnimators.play(builder.buildAnim());
+ }
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
index f06a6a4..ea33d00 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java
@@ -17,10 +17,12 @@
package com.android.quickstep.views;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
+import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SHARE;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import android.content.Context;
import android.util.AttributeSet;
+import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.FrameLayout;
@@ -51,8 +53,7 @@
HIDDEN_NON_ZERO_ROTATION,
HIDDEN_NO_TASKS,
HIDDEN_GESTURE_RUNNING,
- HIDDEN_NO_RECENTS,
- HIDDEN_FULLESCREEN_PROGRESS})
+ HIDDEN_NO_RECENTS})
@Retention(RetentionPolicy.SOURCE)
public @interface ActionsHiddenFlags { }
@@ -62,11 +63,11 @@
public static final int HIDDEN_NO_TASKS = 1 << 3;
public static final int HIDDEN_GESTURE_RUNNING = 1 << 4;
public static final int HIDDEN_NO_RECENTS = 1 << 5;
- public static final int HIDDEN_FULLESCREEN_PROGRESS = 1 << 6;
private static final int INDEX_CONTENT_ALPHA = 0;
private static final int INDEX_VISIBILITY_ALPHA = 1;
- private static final int INDEX_HIDDEN_FLAGS_ALPHA = 2;
+ private static final int INDEX_FULLSCREEN_ALPHA = 2;
+ private static final int INDEX_HIDDEN_FLAGS_ALPHA = 3;
private final MultiValueAlpha mMultiValueAlpha;
@@ -85,14 +86,19 @@
public OverviewActionsView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr, 0);
- mMultiValueAlpha = new MultiValueAlpha(this, 3);
+ mMultiValueAlpha = new MultiValueAlpha(this, 4);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
- findViewById(R.id.action_share).setOnClickListener(this);
+ View share = findViewById(R.id.action_share);
+ share.setOnClickListener(this);
findViewById(R.id.action_screenshot).setOnClickListener(this);
+ if (ENABLE_OVERVIEW_SHARE.get()) {
+ share.setVisibility(VISIBLE);
+ findViewById(R.id.share_space).setVisibility(VISIBLE);
+ }
}
/**
@@ -107,6 +113,7 @@
@Override
public void onClick(View view) {
if (mCallbacks == null) {
+ Log.d("OverviewActionsView", "Callbacks null onClick");
return;
}
int id = view.getId();
@@ -143,6 +150,10 @@
return mMultiValueAlpha.getProperty(INDEX_VISIBILITY_ALPHA);
}
+ public AlphaProperty getFullscreenAlpha() {
+ return mMultiValueAlpha.getProperty(INDEX_FULLSCREEN_ALPHA);
+ }
+
/** Updates vertical margins for different navigation mode. */
public void updateVerticalMarginForNavModeChange(Mode mode) {
int bottomMargin = 0;
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index 2097b1d..a506b7e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -43,7 +43,6 @@
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
-import static com.android.quickstep.views.OverviewActionsView.HIDDEN_FULLESCREEN_PROGRESS;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_GESTURE_RUNNING;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NON_ZERO_ROTATION;
import static com.android.quickstep.views.OverviewActionsView.HIDDEN_NO_RECENTS;
@@ -805,9 +804,8 @@
getTaskViewAt(i).setFullscreenProgress(mFullscreenProgress);
}
// Fade out the actions view quickly (0.1 range)
- mActionsView.getVisibilityAlpha().setValue(
+ mActionsView.getFullscreenAlpha().setValue(
mapToRange(fullscreenProgress, 0, 0.1f, 1f, 0f, LINEAR));
- mActionsView.updateHiddenFlags(HIDDEN_FULLESCREEN_PROGRESS, fullscreenProgress == 1.0f);
}
private void updateTaskStackListenerState() {
@@ -1206,8 +1204,8 @@
private void animateActionsViewIn() {
mActionsView.updateHiddenFlags(HIDDEN_GESTURE_RUNNING, false);
ObjectAnimator anim = ObjectAnimator.ofFloat(
- mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, 1);
- anim.setDuration(OverviewActionsView.VISIBILITY_TRANSITION_DURATION_MS);
+ mActionsView.getVisibilityAlpha(), MultiValueAlpha.VALUE, 0, 1);
+ anim.setDuration(TaskView.SCALE_ICON_DURATION);
anim.start();
}
diff --git a/quickstep/res/layout/overview_actions_container.xml b/quickstep/res/layout/overview_actions_container.xml
index 1ecec25..e05688e 100644
--- a/quickstep/res/layout/overview_actions_container.xml
+++ b/quickstep/res/layout/overview_actions_container.xml
@@ -14,13 +14,12 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<com.android.quickstep.views.OverviewActionsView
- xmlns:android="http://schemas.android.com/apk/res/android"
+<com.android.quickstep.views.OverviewActionsView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/overview_actions_height"
android:layout_gravity="center_horizontal|bottom"
android:layout_marginLeft="@dimen/overview_actions_horizontal_margin"
- android:layout_marginRight="@dimen/overview_actions_horizontal_margin" >
+ android:layout_marginRight="@dimen/overview_actions_horizontal_margin">
<LinearLayout
android:id="@+id/action_buttons"
@@ -28,38 +27,42 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal">
+
<Space
android:layout_width="0dp"
android:layout_height="1dp"
- android:layout_weight="1" >
- </Space>
+ android:layout_weight="1" />
+
<Button
android:id="@+id/action_screenshot"
- android:theme="@style/ThemeControlHighlightWorkspaceColor"
style="@style/OverviewActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:drawableTop="@drawable/ic_screenshot"
- android:text="@string/action_screenshot" />
+ android:drawableStart="@drawable/ic_screenshot"
+ android:text="@string/action_screenshot"
+ android:theme="@style/ThemeControlHighlightWorkspaceColor" />
+
<Space
android:layout_width="0dp"
android:layout_height="1dp"
- android:layout_weight="1" >
- </Space>
+ android:layout_weight="1" />
<Button
android:id="@+id/action_share"
- android:theme="@style/ThemeControlHighlightWorkspaceColor"
style="@style/OverviewActionButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:drawableTop="@drawable/ic_share"
- android:text="@string/action_share" />
+ android:drawableStart="@drawable/ic_share"
+ android:text="@string/action_share"
+ android:theme="@style/ThemeControlHighlightWorkspaceColor"
+ android:visibility="gone" />
+
<Space
+ android:id="@+id/share_space"
android:layout_width="0dp"
android:layout_height="1dp"
- android:layout_weight="1" >
- </Space>
+ android:layout_weight="1"
+ android:visibility="gone" />
</LinearLayout>
</com.android.quickstep.views.OverviewActionsView>
\ No newline at end of file
diff --git a/quickstep/res/values/strings.xml b/quickstep/res/values/strings.xml
index c841170..be1d47b 100644
--- a/quickstep/res/values/strings.xml
+++ b/quickstep/res/values/strings.xml
@@ -63,12 +63,6 @@
<!-- Content description for a close button. [CHAR LIMIT=NONE] -->
<string name="gesture_tutorial_close_button_content_description" translatable="false">Close</string>
-
- <!-- Hotseat migration notification title -->
- <string name="hotseat_edu_prompt_title">Easily access your most-used apps</string>
- <!-- Hotseat migration notification content -->
- <string name="hotseat_edu_prompt_content">Pixel predicts apps you\’ll need next, right on your Home screen. Tap to set up.</string>
-
<!-- Hotseat educational strings for users who don't qualify for migration -->
<string name="hotseat_edu_title_migrate">Get app suggestions on the bottom row of your Home screen</string>
diff --git a/quickstep/res/values/styles.xml b/quickstep/res/values/styles.xml
index d3c4f4d..90957e4 100644
--- a/quickstep/res/values/styles.xml
+++ b/quickstep/res/values/styles.xml
@@ -82,7 +82,7 @@
<item name="android:textColor">@color/overview_button</item>
<item name="android:drawableTint">@color/overview_button</item>
<item name="android:tint">?attr/workspaceTextColor</item>
- <item name="android:drawablePadding">4dp</item>
+ <item name="android:drawablePadding">8dp</item>
<item name="android:textAllCaps">false</item>
</style>
</resources>
\ No newline at end of file
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationController.java b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
index 76a81eb..b0a3cd2 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationController.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationController.java
@@ -29,6 +29,7 @@
import android.view.MotionEvent;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import androidx.annotation.UiThread;
import com.android.launcher3.util.Preconditions;
@@ -58,6 +59,7 @@
private boolean mSplitScreenMinimized = false;
private boolean mTouchInProgress;
private boolean mFinishPending;
+ private @Nullable Runnable mFinishPendingCallback;
public RecentsAnimationController(RecentsAnimationControllerCompat controller,
boolean allowMinimizeSplitScreen,
@@ -165,10 +167,7 @@
} else {
if (mTouchInProgress) {
mFinishPending = true;
- // Execute the callback
- if (onFinishComplete != null) {
- onFinishComplete.run();
- }
+ mFinishPendingCallback = onFinishComplete;
} else {
finishAndClear(true, onFinishComplete, sendUserLeaveHint);
}
@@ -265,7 +264,9 @@
mTouchInProgress = false;
if (mFinishPending) {
mFinishPending = false;
- finishAndClear(true /* toRecents */, null, false /* sendUserLeaveHint */);
+ finishAndClear(true /* toRecents */, mFinishPendingCallback,
+ false /* sendUserLeaveHint */);
+ mFinishPendingCallback = null;
}
}
if (mInputConsumer != null) {
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 1da7ccf..6e7c423 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -178,7 +178,7 @@
}
private void setupOrientationSwipeHandler() {
- if (!isFixedRotationTransformEnabled(mContext)) {
+ if (!isFixedRotationTransformEnabled()) {
return;
}
diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
index a950597..69812b6 100644
--- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
+++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java
@@ -17,7 +17,8 @@
package com.android.quickstep.logging;
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.FOLDER;
-import static com.android.launcher3.logger.LauncherAtom.ItemInfo.ItemCase.WIDGET;
+import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__BACKGROUND;
+import static com.android.systemui.shared.system.SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME;
import android.content.Context;
import android.util.Log;
@@ -84,17 +85,27 @@
*/
@Override
public void log(LauncherEvent event, @Nullable LauncherAtom.ItemInfo info) {
- logInternal(event, DEFAULT_INSTANCE_ID, info != null ? info
- : LauncherAtom.ItemInfo.getDefaultInstance(),
- SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__HOME,
- SysUiStatsLog.LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
+ log(event, DEFAULT_INSTANCE_ID, info);
+ }
+
+ /**
+ * Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
+ */
+ @Override
+ public void log(LauncherEvent event, InstanceId instanceId,
+ @Nullable LauncherAtom.ItemInfo info) {
+ logInternal(event, instanceId, info,
+ LAUNCHER_UICHANGED__DST_STATE__HOME,
+ LAUNCHER_UICHANGED__DST_STATE__BACKGROUND);
}
/**
* Logs an event and accompanying {@link InstanceId} and {@link LauncherAtom.ItemInfo}.
*/
private void logInternal(LauncherEvent event, InstanceId instanceId,
- LauncherAtom.ItemInfo info, int startState, int endState) {
+ @Nullable LauncherAtom.ItemInfo info, int startState, int endState) {
+ info = info == null ? LauncherAtom.ItemInfo.getDefaultInstance() : info;
+
if (IS_VERBOSE) {
Log.d(TAG, instanceId == DEFAULT_INSTANCE_ID
? String.format("\n%s\n%s", event.name(), info)
diff --git a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
index 4c47d7f..5745990 100644
--- a/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
+++ b/quickstep/src/com/android/quickstep/util/RecentsOrientedState.java
@@ -123,6 +123,9 @@
private SysUINavigationMode.NavigationModeChangeListener mNavModeChangeListener =
newMode -> setFlag(FLAG_ROTATION_WATCHER_SUPPORTED, newMode != TWO_BUTTONS);
+ /** TODO: Remove once R ships. This is unlikely to change across different swipe gestures. */
+ private static boolean sFixedRotationEnabled;
+
private final Context mContext;
private final ContentResolver mContentResolver;
private final SharedPreferences mSharedPrefs;
@@ -165,7 +168,9 @@
if (originalSmallestWidth < 600) {
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_DENSITY;
}
- if (isFixedRotationTransformEnabled(context)) {
+ sFixedRotationEnabled = Settings.Global.getInt(
+ context.getContentResolver(), FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1) == 1;
+ if (sFixedRotationEnabled) {
mFlags |= FLAG_MULTIPLE_ORIENTATION_SUPPORTED_BY_FLAG;
}
initFlags();
@@ -519,9 +524,8 @@
* Returns true if system can keep Launcher fixed to portrait layout even if the
* foreground app is rotated
*/
- public static boolean isFixedRotationTransformEnabled(Context context) {
- return Settings.Global.getInt(
- context.getContentResolver(), FIXED_ROTATION_TRANSFORM_SETTING_NAME, 1) == 1;
+ public static boolean isFixedRotationTransformEnabled() {
+ return sFixedRotationEnabled;
}
@NonNull
diff --git a/src/com/android/launcher3/BaseDraggingActivity.java b/src/com/android/launcher3/BaseDraggingActivity.java
index dcab127..d1d5e26 100644
--- a/src/com/android/launcher3/BaseDraggingActivity.java
+++ b/src/com/android/launcher3/BaseDraggingActivity.java
@@ -188,7 +188,7 @@
}
getUserEventDispatcher().logAppLaunch(v, intent, user);
getStatsLogManager().log(LAUNCHER_APP_LAUNCH_TAP, item == null ? null
- : item.buildProto(null));
+ : item.buildProto());
return true;
} catch (NullPointerException|ActivityNotFoundException|SecurityException e) {
Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT).show();
diff --git a/src/com/android/launcher3/LauncherSettings.java b/src/com/android/launcher3/LauncherSettings.java
index 535c9e6..6789072 100644
--- a/src/com/android/launcher3/LauncherSettings.java
+++ b/src/com/android/launcher3/LauncherSettings.java
@@ -155,6 +155,8 @@
public static final int CONTAINER_ALL_APPS = -104;
public static final int CONTAINER_WIDGETS_TRAY = -105;
+ // Represents search results view.
+ public static final int CONTAINER_SEARCH_RESULTS = -106;
public static final String containerToString(int container) {
switch (container) {
@@ -163,6 +165,7 @@
case CONTAINER_PREDICTION: return "prediction";
case CONTAINER_ALL_APPS: return "all_apps";
case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
+ case CONTAINER_SEARCH_RESULTS: return "search_result";
default: return String.valueOf(container);
}
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 6b660c1..32685b0 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -418,10 +418,10 @@
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
dragObject.logInstanceId,
- dragObject.originalDragInfo.buildProto(
- dragObject.dragSource instanceof Folder
- ? ((Folder) dragObject.dragSource).mInfo
- : null)
+ dragObject.dragSource instanceof Folder
+ ? dragObject.originalDragInfo
+ .buildProto(((Folder) dragObject.dragSource).mInfo)
+ : dragObject.originalDragInfo.buildProto()
);
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index f057036..aa9edda 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -1,6 +1,5 @@
package com.android.launcher3.allapps;
-import static com.android.launcher3.LauncherState.ALL_APPS;
import static com.android.launcher3.LauncherState.ALL_APPS_CONTENT;
import static com.android.launcher3.LauncherState.ALL_APPS_HEADER_EXTRA;
import static com.android.launcher3.LauncherState.APPS_VIEW_ITEM_MASK;
@@ -23,6 +22,7 @@
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
+import android.widget.EditText;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
@@ -87,6 +87,7 @@
private float mScrollRangeDelta = 0;
+ // plugin related variables
private AllAppsSearchPlugin mPlugin;
private View mPluginContent;
@@ -131,7 +132,6 @@
float shiftCurrent = progress * mShiftRange;
mAppsView.setTranslationY(shiftCurrent);
-
if (mPlugin != null) {
mPlugin.setProgress(progress);
}
@@ -160,7 +160,6 @@
setProgress(state.getVerticalProgress(mLauncher));
setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
onProgressAnimationEnd();
- updatePlugin(state);
}
/**
@@ -194,20 +193,6 @@
builder.add(anim);
setAlphas(toState, config, builder);
-
- updatePlugin(toState);
- }
-
- private void updatePlugin(LauncherState toState) {
- if (mPlugin == null) return;
- if (toState == ALL_APPS) {
- // TODO: change this from toggle event to continuous transition event.
- mPlugin.setEditText(mAppsView.getSearchUiManager().setTextSearchEnabled(true));
- } else {
- mPlugin.setEditText(null);
- mAppsView.getSearchUiManager().setTextSearchEnabled(false);
- }
-
}
public Animator createSpringAnimation(float... progressValues) {
@@ -276,6 +261,7 @@
if (Float.compare(mProgress, 1f) == 0) {
mAppsView.reset(false /* animate */);
}
+ updatePluginAnimationEnd();
}
@Override
@@ -285,7 +271,7 @@
R.layout.all_apps_content_layout, mAppsView, false);
mAppsView.addView(mPluginContent);
mPluginContent.setAlpha(0f);
- mPlugin.setup((ViewGroup) mPluginContent, mLauncher);
+ mPlugin.setup((ViewGroup) mPluginContent, mLauncher, mShiftRange);
}
@Override
@@ -297,4 +283,25 @@
public void onActivityDestroyed() {
PluginManagerWrapper.INSTANCE.get(mLauncher).removePluginListener(this);
}
+
+ /** Used for the plugin to signal when drag starts happens
+ * @param toAllApps*/
+ public void onDragStart(boolean toAllApps) {
+ if (mPlugin == null) return;
+
+ if (toAllApps) {
+ EditText editText = mAppsView.getSearchUiManager().setTextSearchEnabled(true);
+ mPlugin.setEditText(editText);
+ }
+ mPlugin.onDragStart(toAllApps ? 1f : 0f);
+ }
+
+ private void updatePluginAnimationEnd() {
+ if (mPlugin == null) return;
+ mPlugin.onAnimationEnd(mProgress);
+ if (Float.compare(mProgress, 1f) == 0) {
+ mAppsView.getSearchUiManager().setTextSearchEnabled(false);
+ mPlugin.setEditText(null);
+ }
+ }
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 376b531..978dd52 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -145,6 +145,9 @@
public static final BooleanFlag ENABLE_OVERVIEW_SELECTIONS = new DeviceFlag(
"ENABLE_OVERVIEW_SELECTIONS", true, "Show Select Mode button in Overview Actions");
+ public static final BooleanFlag ENABLE_OVERVIEW_SHARE = getDebugFlag(
+ "ENABLE_OVERVIEW_SHARE", false, "Show Share button in Overview Actions");
+
public static final BooleanFlag ENABLE_DATABASE_RESTORE = getDebugFlag(
"ENABLE_DATABASE_RESTORE", true,
"Enable database restore when new restore session is created");
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 6e91d70..15f4e3f 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -22,6 +22,7 @@
import static com.android.launcher3.config.FeatureFlags.ENABLE_LAUNCHER_PREVIEW_IN_GRID_PICKER;
import static com.android.launcher3.config.FeatureFlags.MULTI_DB_GRID_MIRATION_ALGO;
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
+import static com.android.launcher3.model.ModelUtils.getMissingHotseatRanks;
import static com.android.launcher3.model.ModelUtils.sortWorkspaceItemsSpatially;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
@@ -80,13 +81,16 @@
import com.android.launcher3.model.LoaderTask;
import com.android.launcher3.model.WidgetItem;
import com.android.launcher3.model.WidgetsModel;
+import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.InstallSessionHelper;
import com.android.launcher3.pm.UserCache;
+import com.android.launcher3.uioverrides.PredictedAppIconInflater;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
+import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
@@ -376,6 +380,13 @@
addInScreenFromBind(view, info);
}
+ private void inflateAndAddPredictedIcon(WorkspaceItemInfo info) {
+ View view = PredictedAppIconInflater.inflate(mHomeElementInflater, mWorkspace, info);
+ if (view != null) {
+ addInScreenFromBind(view, info);
+ }
+ }
+
private void dispatchVisibilityAggregated(View view, boolean isVisible) {
// Similar to View.dispatchVisibilityAggregated implementation.
final boolean thisVisible = view.getVisibility() == VISIBLE;
@@ -468,6 +479,21 @@
break;
}
}
+
+ IntArray ranks = getMissingHotseatRanks(currentWorkspaceItems,
+ mIdp.numHotseatIcons);
+ int count = Math.min(ranks.size(), workspaceResult.mCachedPredictedItems.size());
+ for (int i = 0; i < count; i++) {
+ AppInfo appInfo = workspaceResult.mCachedPredictedItems.get(i);
+ int rank = ranks.get(i);
+ WorkspaceItemInfo itemInfo = new WorkspaceItemInfo(appInfo);
+ itemInfo.container = LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
+ itemInfo.rank = rank;
+ itemInfo.cellX = mHotseat.getCellXFromOrder(rank);
+ itemInfo.cellY = mHotseat.getCellYFromOrder(rank);
+ itemInfo.screenId = rank;
+ inflateAndAddPredictedIcon(itemInfo);
+ }
} else {
// Add hotseat icons
for (int i = 0; i < mIdp.numHotseatIcons; i++) {
@@ -561,7 +587,7 @@
}
return new WorkspaceResult(mBgDataModel.workspaceItems, mBgDataModel.appWidgets,
- mBgDataModel.widgetsModel);
+ mBgDataModel.cachedPredictedItems, mBgDataModel.widgetsModel);
}
}
@@ -590,7 +616,7 @@
loadWorkspace(allShortcuts, LauncherSettings.Favorites.PREVIEW_CONTENT_URI);
mBgDataModel.widgetsModel.update(mApp, null);
return new WorkspaceResult(mBgDataModel.workspaceItems, mBgDataModel.appWidgets,
- mBgDataModel.widgetsModel);
+ mBgDataModel.cachedPredictedItems, mBgDataModel.widgetsModel);
}
}
@@ -610,12 +636,15 @@
private static class WorkspaceResult {
private final ArrayList<ItemInfo> mWorkspaceItems;
private final ArrayList<LauncherAppWidgetInfo> mAppWidgets;
+ private final ArrayList<AppInfo> mCachedPredictedItems;
private final WidgetsModel mWidgetsModel;
private WorkspaceResult(ArrayList<ItemInfo> workspaceItems,
- ArrayList<LauncherAppWidgetInfo> appWidgets, WidgetsModel widgetsModel) {
+ ArrayList<LauncherAppWidgetInfo> appWidgets,
+ ArrayList<AppInfo> cachedPredictedItems, WidgetsModel widgetsModel) {
mWorkspaceItems = workspaceItems;
mAppWidgets = appWidgets;
+ mCachedPredictedItems = cachedPredictedItems;
mWidgetsModel = widgetsModel;
}
}
diff --git a/src/com/android/launcher3/logging/FileLog.java b/src/com/android/launcher3/logging/FileLog.java
index bfeb1dc..6bc1ecb 100644
--- a/src/com/android/launcher3/logging/FileLog.java
+++ b/src/com/android/launcher3/logging/FileLog.java
@@ -235,6 +235,9 @@
* Gets files used for FileLog
*/
public static File[] getLogFiles() {
+ try {
+ flushAll(null);
+ } catch (InterruptedException e) { }
File[] files = new File[LOG_DAYS];
for (int i = 0; i < LOG_DAYS; i++) {
files[i] = new File(sLogsDirectory, FILE_NAME_PREFIX + i);
diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java
index a97d529..3a89236 100644
--- a/src/com/android/launcher3/model/data/ItemInfo.java
+++ b/src/com/android/launcher3/model/data/ItemInfo.java
@@ -20,11 +20,14 @@
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
+import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SEARCH_RESULTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
+import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.CONTAINER_NOT_SET;
import android.content.ComponentName;
import android.content.ContentValues;
@@ -40,6 +43,8 @@
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logger.LauncherAtom.AllAppsContainer;
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
+import com.android.launcher3.logger.LauncherAtom.PredictionContainer;
+import com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
import com.android.launcher3.util.ContentWriter;
import java.util.Optional;
@@ -240,8 +245,7 @@
* Returns if an Item is a predicted item
*/
public boolean isPredictedItem() {
- return container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION
- || container == LauncherSettings.Favorites.CONTAINER_PREDICTION;
+ return container == CONTAINER_HOTSEAT_PREDICTION || container == CONTAINER_PREDICTION;
}
/**
@@ -311,8 +315,11 @@
break;
}
itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder));
- } else if (getContainerInfo().getContainerCase().getNumber() > 0) {
- itemBuilder.setContainerInfo(getContainerInfo());
+ } else {
+ ContainerInfo containerInfo = getContainerInfo();
+ if (!containerInfo.getContainerCase().equals(CONTAINER_NOT_SET)) {
+ itemBuilder.setContainerInfo(containerInfo);
+ }
}
return itemBuilder.build();
}
@@ -328,16 +335,16 @@
case CONTAINER_HOTSEAT:
case CONTAINER_HOTSEAT_PREDICTION:
return ContainerInfo.newBuilder()
- .setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId))
- .build();
+ .setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId))
+ .build();
case CONTAINER_DESKTOP:
return ContainerInfo.newBuilder()
- .setWorkspace(
- LauncherAtom.WorkspaceContainer.newBuilder()
- .setGridX(cellX)
- .setGridY(cellY)
- .setPageIndex(screenId))
- .build();
+ .setWorkspace(
+ LauncherAtom.WorkspaceContainer.newBuilder()
+ .setGridX(cellX)
+ .setGridY(cellY)
+ .setPageIndex(screenId))
+ .build();
case CONTAINER_ALL_APPS:
return ContainerInfo.newBuilder()
.setAllAppsContainer(
@@ -348,11 +355,21 @@
.setWidgetsContainer(
LauncherAtom.WidgetsContainer.getDefaultInstance())
.build();
+ case CONTAINER_PREDICTION:
+ return ContainerInfo.newBuilder()
+ .setPredictionContainer(PredictionContainer.getDefaultInstance())
+ .build();
+ case CONTAINER_SEARCH_RESULTS:
+ return ContainerInfo.newBuilder()
+ .setSearchResultContainer(SearchResultContainer.getDefaultInstance())
+ .build();
}
return ContainerInfo.getDefaultInstance();
}
- /** Returns shallow copy of the object. */
+ /**
+ * Returns shallow copy of the object.
+ */
public ItemInfo makeShallowCopy() {
ItemInfo itemInfo = new ItemInfo();
itemInfo.copyFrom(this);
diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java
index 44f7db9..60b87d9 100644
--- a/src/com/android/launcher3/statemanager/StateManager.java
+++ b/src/com/android/launcher3/statemanager/StateManager.java
@@ -306,8 +306,10 @@
+ state);
}
PendingAnimation builder = new PendingAnimation(mConfig.duration);
- for (StateHandler handler : getStateHandlers()) {
- handler.setStateWithAnimation(state, mConfig, builder);
+ if (mConfig.getAnimComponents() != 0) {
+ for (StateHandler handler : getStateHandlers()) {
+ handler.setStateWithAnimation(state, mConfig, builder);
+ }
}
builder.addListener(new AnimationSuccessListener() {
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 2e63ccf..2c21609 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -242,6 +242,7 @@
public void onDragStart(boolean start, float startDisplacement) {
mStartState = mLauncher.getStateManager().getState();
mIsLogContainerSet = false;
+
if (mCurrentAnimation == null) {
mFromState = mStartState;
mToState = null;
@@ -259,6 +260,10 @@
}
mCanBlockFling = mFromState == NORMAL;
mFlingBlockCheck.unblockFling();
+ // Must be called after all the animation controllers have been paused
+ if (mToState == ALL_APPS || mToState == NORMAL) {
+ mLauncher.getAllAppsController().onDragStart(mToState == ALL_APPS);
+ }
}
@Override
diff --git a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
index d458fc4..c57f07d 100644
--- a/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
+++ b/src_plugins/com/android/systemui/plugins/AllAppsSearchPlugin.java
@@ -19,17 +19,32 @@
import android.app.Activity;
import android.view.ViewGroup;
import android.widget.EditText;
+
import com.android.systemui.plugins.annotations.ProvidesInterface;
/**
- * Implement this plugin interface to add a row of views to the top of the all apps drawer.
+ * Implement this plugin interface to replace the all apps recycler view of the all apps drawer.
*/
@ProvidesInterface(action = AllAppsSearchPlugin.ACTION, version = AllAppsSearchPlugin.VERSION)
public interface AllAppsSearchPlugin extends Plugin {
String ACTION = "com.android.systemui.action.PLUGIN_ALL_APPS_SEARCH_ACTIONS";
- int VERSION = 2;
+ int VERSION = 3;
- void setup(ViewGroup parent, Activity activity);
- void setEditText(EditText editText);
+ /** Following are the order that these methods should be called. */
+ void setup(ViewGroup parent, Activity activity, float allAppsContainerHeight);
+
+ /**
+ * When drag starts, pass window inset related fields and the progress to indicate
+ * whether user is swiping down or swiping up
+ */
+ void onDragStart(float progress);
+
+ /** progress is between [0, 1] 1: down, 0: up */
void setProgress(float progress);
+
+ /** Called when container animation stops, so that plugin can perform cleanups */
+ void onAnimationEnd(float progress);
+
+ /** pass over the search box object */
+ void setEditText(EditText editText);
}
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/PredictedAppIconInflater.java b/src_ui_overrides/com/android/launcher3/uioverrides/PredictedAppIconInflater.java
new file mode 100644
index 0000000..4893c17
--- /dev/null
+++ b/src_ui_overrides/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/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 1e0aa48..7ddb492 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -28,6 +28,7 @@
import android.app.Instrumentation;
import android.app.UiAutomation;
import android.content.ComponentName;
+import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageManager;
@@ -39,6 +40,7 @@
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcelable;
+import android.os.RemoteException;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Log;
@@ -260,7 +262,12 @@
}
Bundle getTestInfo(String request) {
- return getContext().getContentResolver().call(mTestProviderUri, request, null, null);
+ try (ContentProviderClient client = getContext().getContentResolver()
+ .acquireContentProviderClient(mTestProviderUri)) {
+ return client.call(request, null, null);
+ } catch (RemoteException e) {
+ throw new RuntimeException(e);
+ }
}
Insets getTargetInsets() {