Merge "Add BROADCAST_CLOSE_SYSTEM_DIALOGS to recents package"
diff --git a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
index f313d75..f53a5ef 100644
--- a/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
+++ b/quickstep/src/com/android/launcher3/appprediction/PredictionRowView.java
@@ -206,7 +206,10 @@
* we can optimize by swapping them in place.
*/
public void setPredictedApps(List<ItemInfo> items) {
- if (!mLauncher.isWorkspaceLoading() && isShown() && getWindowVisibility() == View.VISIBLE) {
+ if (!FeatureFlags.ENABLE_APP_PREDICTIONS_WHILE_VISIBLE.get()
+ && !mLauncher.isWorkspaceLoading()
+ && isShown()
+ && getWindowVisibility() == View.VISIBLE) {
mPendingPredictedItems = items;
return;
}
diff --git a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
index 4953138..b2de4c9 100644
--- a/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
+++ b/quickstep/src/com/android/launcher3/hybridhotseat/HotseatPredictionController.java
@@ -42,6 +42,7 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
+import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragOptions;
import com.android.launcher3.graphics.DragPreviewProvider;
@@ -251,7 +252,8 @@
* Sets or updates the predicted items
*/
public void setPredictedItems(FixedContainerItems items) {
- boolean shouldIgnoreVisibility = mLauncher.isWorkspaceLoading()
+ boolean shouldIgnoreVisibility = FeatureFlags.ENABLE_APP_PREDICTIONS_WHILE_VISIBLE.get()
+ || mLauncher.isWorkspaceLoading()
|| mPredictedItems.equals(items.items)
|| mHotseat.getShortcutsAndWidgets().getChildCount() < mHotSeatItemsCount;
if (!shouldIgnoreVisibility
diff --git a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
index eb33f98..b258a10 100644
--- a/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
+++ b/quickstep/src/com/android/quickstep/OrientationTouchTransformer.java
@@ -66,6 +66,7 @@
private final RectF mOneHandedModeRegion = new RectF();
private int mCurrentDisplayRotation;
private int mNavBarGesturalHeight;
+ private int mNavBarLargerGesturalHeight;
private boolean mEnableMultipleRegions;
private Resources mResources;
private OrientationRectF mLastRectTouched;
@@ -106,6 +107,9 @@
mMode = mode;
mContractInfo = contractInfo;
mNavBarGesturalHeight = getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE);
+ mNavBarLargerGesturalHeight = ResourceUtils.getDimenByName(
+ ResourceUtils.NAVBAR_BOTTOM_GESTURE_LARGER_SIZE, resources,
+ mNavBarGesturalHeight);
}
private void refreshTouchRegion(Info info, Resources newRes) {
@@ -234,6 +238,7 @@
Point size = display.realSize;
int rotation = display.rotation;
int touchHeight = mNavBarGesturalHeight;
+ int largerGesturalHeight = mNavBarLargerGesturalHeight;
OrientationRectF orientationRectF =
new OrientationRectF(0, 0, size.x, size.y, rotation);
if (mMode == SysUINavigationMode.Mode.NO_BUTTON) {
@@ -256,7 +261,8 @@
}
}
// One handed gestural only active on portrait mode
- mOneHandedModeRegion.set(0, orientationRectF.bottom - touchHeight, size.x, size.y);
+ mOneHandedModeRegion.set(0, orientationRectF.bottom - mNavBarLargerGesturalHeight,
+ size.x, size.y);
return orientationRectF;
}
@@ -378,6 +384,7 @@
}
pw.println(regions.toString());
pw.println(" mNavBarGesturalHeight=" + mNavBarGesturalHeight);
+ pw.println(" mNavBarLargerGesturalHeight=" + mNavBarLargerGesturalHeight);
pw.println(" mOneHandedModeRegion=" + mOneHandedModeRegion);
}
diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
index 49feef0..7bf7712 100644
--- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
+++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java
@@ -23,7 +23,6 @@
import static com.android.launcher3.config.FeatureFlags.SEPARATE_RECENTS_ACTIVITY;
import static com.android.launcher3.util.PackageManagerHelper.getPackageFilter;
import static com.android.systemui.shared.system.PackageManagerWrapper.ACTION_PREFERRED_ACTIVITY_CHANGED;
-import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
@@ -119,10 +118,6 @@
updateOverviewTargets();
}
- public boolean assistantGestureIsConstrained() {
- return (mDeviceState.getSystemUiStateFlags() & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0;
- }
-
/**
* Update overview intent and {@link BaseActivityInterface} based off the current launcher home
* component.
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
index 960abeb..74b56e9 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationDeviceState.java
@@ -23,6 +23,7 @@
import static com.android.quickstep.SysUINavigationMode.Mode.THREE_BUTTONS;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_CLICKABLE;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_A11Y_BUTTON_LONG_CLICKABLE;
+import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_HOME_DISABLED;
@@ -373,7 +374,7 @@
* @return the system ui state flags.
*/
// TODO(141886704): See if we can remove this
- public @SystemUiStateFlags int getSystemUiStateFlags() {
+ public int getSystemUiStateFlags() {
return mSystemUiStateFlags;
}
@@ -406,6 +407,13 @@
}
/**
+ * @return whether assistant gesture is constraint
+ */
+ public boolean isAssistantGestureIsConstrained() {
+ return (mSystemUiStateFlags & SYSUI_STATE_ASSIST_GESTURE_CONSTRAINED) != 0;
+ }
+
+ /**
* @return whether the bubble stack is expanded
*/
public boolean isBubblesExpanded() {
diff --git a/quickstep/src/com/android/quickstep/SysUINavigationMode.java b/quickstep/src/com/android/quickstep/SysUINavigationMode.java
index 71bf1bb..efec037 100644
--- a/quickstep/src/com/android/quickstep/SysUINavigationMode.java
+++ b/quickstep/src/com/android/quickstep/SysUINavigationMode.java
@@ -73,6 +73,7 @@
private Mode mMode;
private int mNavBarGesturalHeight;
+ private int mNavBarLargerGesturalHeight;
private final List<NavigationModeChangeListener> mChangeListeners = new ArrayList<>();
private final List<OneHandedModeChangeListener> mOneHandedOverlayChangeListeners =
@@ -112,6 +113,17 @@
if (mNavBarGesturalHeight != newGesturalHeight) {
mNavBarGesturalHeight = newGesturalHeight;
+ }
+
+ int newLargerGesturalHeight = ResourceUtils.getDimenByName(
+ ResourceUtils.NAVBAR_BOTTOM_GESTURE_LARGER_SIZE, mContext.getResources(),
+ INVALID_RESOURCE_HANDLE);
+ if (newLargerGesturalHeight == INVALID_RESOURCE_HANDLE) {
+ Log.e(TAG, "Failed to get system resource ID. Incompatible framework version?");
+ return;
+ }
+ if (mNavBarLargerGesturalHeight != newLargerGesturalHeight) {
+ mNavBarLargerGesturalHeight = newLargerGesturalHeight;
dispatchOneHandedOverlayChange();
}
}
@@ -122,6 +134,9 @@
mNavBarGesturalHeight = ResourceUtils.getDimenByName(
ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, mContext.getResources(),
INVALID_RESOURCE_HANDLE);
+ mNavBarLargerGesturalHeight = ResourceUtils.getDimenByName(
+ ResourceUtils.NAVBAR_BOTTOM_GESTURE_LARGER_SIZE, mContext.getResources(),
+ mNavBarGesturalHeight);
if (modeInt == INVALID_RESOURCE_HANDLE) {
Log.e(TAG, "Failed to get system resource ID. Incompatible framework version?");
@@ -143,7 +158,7 @@
private void dispatchOneHandedOverlayChange() {
for (OneHandedModeChangeListener listener : mOneHandedOverlayChangeListeners) {
- listener.onOneHandedModeChanged(mNavBarGesturalHeight);
+ listener.onOneHandedModeChanged(mNavBarLargerGesturalHeight);
}
}
@@ -158,7 +173,7 @@
public int addOneHandedOverlayChangeListener(OneHandedModeChangeListener listener) {
mOneHandedOverlayChangeListeners.add(listener);
- return mNavBarGesturalHeight;
+ return mNavBarLargerGesturalHeight;
}
public void removeOneHandedOverlayChangeListener(OneHandedModeChangeListener listener) {
@@ -182,4 +197,4 @@
public interface OneHandedModeChangeListener {
void onOneHandedModeChanged(int newGesturalHeight);
}
-}
\ No newline at end of file
+}
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 1e0a00a..e59035c 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -466,7 +466,8 @@
this,
mGestureState,
InputConsumer.NO_OP, mInputMonitorCompat,
- mOverviewComponentObserver.assistantGestureIsConstrained());
+ mDeviceState,
+ event);
} else if (mDeviceState.canTriggerOneHandedAction(event)
&& !mDeviceState.isOneHandedModeActive()) {
// Consume gesture event for triggering one handed feature.
@@ -563,12 +564,8 @@
}
if (mDeviceState.isFullyGesturalNavMode()) {
if (mDeviceState.canTriggerAssistantAction(event, newGestureState.getRunningTask())) {
- base = new AssistantInputConsumer(
- this,
- newGestureState,
- base,
- mInputMonitorCompat,
- mOverviewComponentObserver.assistantGestureIsConstrained());
+ base = new AssistantInputConsumer(this, newGestureState, base, mInputMonitorCompat,
+ mDeviceState, event);
}
if (FeatureFlags.ENABLE_QUICK_CAPTURE_GESTURE.get()) {
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
index 580e4ec..a3cd7df 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/AssistantInputConsumer.java
@@ -44,9 +44,12 @@
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
+import com.android.quickstep.RecentsAnimationDeviceState;
import com.android.quickstep.SystemUiProxy;
import com.android.systemui.shared.system.InputMonitorCompat;
+import java.util.function.Consumer;
+
/**
* Touch consumer for handling events to launch assistant from launcher
*/
@@ -81,19 +84,18 @@
private final int mAngleThreshold;
private final float mSquaredSlop;
private final Context mContext;
- private final GestureDetector mGestureDetector;
- private final boolean mIsAssistGestureConstrained;
+ private final Consumer<MotionEvent> mGestureDetector;
public AssistantInputConsumer(
Context context,
GestureState gestureState,
InputConsumer delegate,
InputMonitorCompat inputMonitor,
- boolean isAssistGestureConstrained) {
+ RecentsAnimationDeviceState deviceState,
+ MotionEvent startEvent) {
super(delegate, inputMonitor);
final Resources res = context.getResources();
mContext = context;
- mIsAssistGestureConstrained = isAssistGestureConstrained;
mDragDistThreshold = res.getDimension(R.dimen.gestures_assistant_drag_threshold);
mFlingDistThreshold = res.getDimension(R.dimen.gestures_assistant_fling_threshold);
mTimeThreshold = res.getInteger(R.integer.assistant_gesture_min_time_threshold);
@@ -104,7 +106,11 @@
mSquaredSlop = slop * slop;
mActivityInterface = gestureState.getActivityInterface();
- mGestureDetector = new GestureDetector(context, new AssistantGestureListener());
+ boolean flingDisabled = deviceState.isAssistantGestureIsConstrained()
+ || deviceState.isInDeferredGestureRegion(startEvent);
+ mGestureDetector = flingDisabled
+ ? ev -> { }
+ : new GestureDetector(context, new AssistantGestureListener())::onTouchEvent;
}
@Override
@@ -201,7 +207,7 @@
break;
}
- mGestureDetector.onTouchEvent(ev);
+ mGestureDetector.accept(ev);
if (mState != STATE_ACTIVE) {
mDelegate.onMotionEvent(ev);
@@ -214,12 +220,6 @@
if (mDistance >= mDragDistThreshold && mTimeFraction >= 1) {
SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion(0);
startAssistantInternal();
-
- Bundle args = new Bundle();
- args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE);
- args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
- SystemUiProxy.INSTANCE.get(mContext).startAssistant(args);
- mLaunchedAssistant = true;
} else {
SystemUiProxy.INSTANCE.get(mContext).onAssistantProgress(mLastProgress);
}
@@ -233,6 +233,12 @@
13, // HapticFeedbackConstants.GESTURE_END
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
}
+
+ Bundle args = new Bundle();
+ args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE);
+ args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
+ SystemUiProxy.INSTANCE.get(mContext).startAssistant(args);
+ mLaunchedAssistant = true;
}
/**
@@ -250,8 +256,7 @@
private class AssistantGestureListener extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
- if (!mIsAssistGestureConstrained
- && isValidAssistantGestureAngle(velocityX, -velocityY)
+ if (isValidAssistantGestureAngle(velocityX, -velocityY)
&& mDistance >= mFlingDistThreshold
&& !mLaunchedAssistant
&& mState != STATE_DELEGATE_ACTIVE) {
@@ -259,11 +264,6 @@
SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion(
(float) Math.sqrt(velocityX * velocityX + velocityY * velocityY));
startAssistantInternal();
-
- Bundle args = new Bundle();
- args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
- SystemUiProxy.INSTANCE.get(mContext).startAssistant(args);
- mLaunchedAssistant = true;
}
return true;
}
diff --git a/res/layout/system_shortcut.xml b/res/layout/system_shortcut.xml
index 881df1b..c620e2a 100644
--- a/res/layout/system_shortcut.xml
+++ b/res/layout/system_shortcut.xml
@@ -30,7 +30,7 @@
android:paddingStart="@dimen/deep_shortcuts_text_padding_start"
android:paddingEnd="@dimen/popup_padding_end"
android:textSize="14sp"
- android:maxLines="2"
+ android:maxLines="1"
android:textColor="?android:attr/textColorPrimary"
launcher:iconDisplay="shortcut_popup"
launcher:layoutHorizontal="true"
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 7df3f77..cf51f77 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -167,7 +167,7 @@
<!-- Deep shortcuts -->
<dimen name="deep_shortcuts_elevation">9dp</dimen>
- <dimen name="bg_popup_item_width">220dp</dimen>
+ <dimen name="bg_popup_item_width">260dp</dimen>
<dimen name="bg_popup_item_height">56dp</dimen>
<dimen name="bg_popup_item_condensed_height">48dp</dimen>
<dimen name="pre_drag_view_scale">6dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6c58c0e..3425f91 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -182,13 +182,13 @@
<string name="folder_name_format_overflow">Folder: <xliff:g id="name" example="Games">%1$s</xliff:g>, <xliff:g id="size" example="2">%2$d</xliff:g> or more items</string>
<!-- Strings for the customization mode -->
- <!-- Text for widget add button -->
+ <!-- Text for widget add button [CHAR LIMIT=30]-->
<string name="widget_button_text">Widgets</string>
- <!-- Text for wallpaper change button -->
+ <!-- Text for wallpaper change button [CHAR LIMIT=30]-->
<string name="wallpaper_button_text">Wallpapers</string>
- <!-- Text for wallpaper change button -->
+ <!-- Text for wallpaper change button [CHAR LIMIT=30]-->
<string name="styles_wallpaper_button_text">Styles & wallpapers</string>
- <!-- Text for settings button [CHAR LIMIT=20]-->
+ <!-- Text for settings button [CHAR LIMIT=30]-->
<string name="settings_button_text">Home settings</string>
<!-- Message shown when a feature is disabled by the administrator -->
<string name="msg_disabled_by_admin">Disabled by your admin</string>
diff --git a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
index 412ace0..e43df21 100644
--- a/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
+++ b/robolectric_tests/src/com/android/launcher3/model/PackageInstallStateChangedTaskTest.java
@@ -67,7 +67,7 @@
for (ItemInfo info : mModelHelper.getBgDataModel().itemsIdMap) {
if (info instanceof WorkspaceItemInfo) {
assertEquals(updates.contains(info.id) ? progress: 0,
- ((WorkspaceItemInfo) info).getProgressLevel());
+ ((WorkspaceItemInfo) info).getInstallProgress());
} else {
assertEquals(updates.contains(info.id) ? progress: -1,
((LauncherAppWidgetInfo) info).installProgress);
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index f44f88b..3eb52ad 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -50,7 +50,6 @@
import android.view.ViewDebug;
import android.widget.TextView;
-import androidx.annotation.Nullable;
import androidx.core.graphics.ColorUtils;
import com.android.launcher3.Launcher.OnResumeCallback;
@@ -72,6 +71,7 @@
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.PackageItemInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.RemoteActionItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.util.SafeCloseable;
@@ -287,7 +287,10 @@
public void applyFromWorkspaceItem(WorkspaceItemInfo info, boolean promiseStateChanged) {
applyIconAndLabel(info);
setTag(info);
- applyLoadingState(promiseStateChanged);
+ if (promiseStateChanged || (info.hasPromiseIconUi())) {
+ applyPromiseState(promiseStateChanged);
+ }
+
applyDotState(info, false /* animate */);
}
@@ -300,8 +303,9 @@
// Verify high res immediately
verifyHighRes();
- if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
- applyProgressLevel(info.getProgressLevel());
+ if (info instanceof PromiseAppInfo) {
+ PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
+ applyProgressLevel(promiseAppInfo.level);
}
applyDotState(info, false /* animate */);
}
@@ -331,10 +335,6 @@
mDotParams.color = IconPalette.getMutedColor(info.bitmap.color, 0.54f);
setIcon(iconDrawable);
- applyLabel(info);
- }
-
- private void applyLabel(ItemInfoWithIcon info) {
setText(info.title);
if (info.contentDescription != null) {
setContentDescription(info.isDisabled()
@@ -595,35 +595,21 @@
mLongPressHelper.cancelLongPress();
}
- /** Applies the loading progress value to the progress bar.
- *
- * If this app is installing, the progress bar will be updated with the installation progress.
- * If this app is installed and downloading incrementally, the progress bar will be updated
- * with the total download progress.
- */
- public void applyLoadingState(boolean promiseStateChanged) {
+ public void applyPromiseState(boolean promiseStateChanged) {
if (getTag() instanceof WorkspaceItemInfo) {
WorkspaceItemInfo info = (WorkspaceItemInfo) getTag();
- int progressLevel = info.getProgressLevel();
- if ((info.runtimeStatusFlags & ItemInfoWithIcon.FLAG_INCREMENTAL_DOWNLOAD_ACTIVE)
- != 0) {
- updateProgressBarUi(progressLevel, progressLevel == 100);
- } else if (info.hasPromiseIconUi() || (info.runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
- updateProgressBarUi(progressLevel, promiseStateChanged);
+ final boolean isPromise = info.hasPromiseIconUi();
+ final int progressLevel = isPromise ?
+ ((info.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE) ?
+ info.getInstallProgress() : 0)) : 100;
+
+ PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel);
+ if (preloadDrawable != null && promiseStateChanged) {
+ preloadDrawable.maybePerformFinishedAnimation();
}
}
}
- private void updateProgressBarUi(int progressLevel, boolean maybePerformFinishedAnimation) {
- PreloadIconDrawable preloadDrawable = applyProgressLevel(progressLevel);
- if (preloadDrawable != null && maybePerformFinishedAnimation) {
- preloadDrawable.maybePerformFinishedAnimation();
- }
- }
-
- /** Applies the given progress level to the this icon's progress bar. */
- @Nullable
public PreloadIconDrawable applyProgressLevel(int progressLevel) {
if (getTag() instanceof ItemInfoWithIcon) {
ItemInfoWithIcon info = (ItemInfoWithIcon) getTag();
@@ -643,11 +629,9 @@
if (mIcon instanceof PreloadIconDrawable) {
preloadDrawable = (PreloadIconDrawable) mIcon;
preloadDrawable.setLevel(progressLevel);
- preloadDrawable.setIsDisabled(!info.isAppStartable());
} else {
preloadDrawable = newPendingIcon(getContext(), info);
preloadDrawable.setLevel(progressLevel);
- preloadDrawable.setIsDisabled(!info.isAppStartable());
setIcon(preloadDrawable);
}
return preloadDrawable;
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 4d1b7661..a96fabd 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -137,6 +137,7 @@
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.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.notification.NotificationListener;
import com.android.launcher3.pm.PinRequestHelper;
@@ -221,8 +222,6 @@
static final boolean DEBUG_STRICT_MODE = false;
- private static final boolean ENABLE_ACTIVITY_CROSSFADE = false;
-
private static final int REQUEST_CREATE_SHORTCUT = 1;
private static final int REQUEST_CREATE_APPWIDGET = 5;
@@ -1383,8 +1382,9 @@
int width = mDragLayer.getWidth();
int height = mDragLayer.getHeight();
- // TODO: b/172467144 Remove hardcoded ENABLE_ACTIVITY_CROSSFADE.
- if (ENABLE_ACTIVITY_CROSSFADE && width > 0 && height > 0) {
+ if (FeatureFlags.ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE.get()
+ && width > 0
+ && height > 0) {
instance.snapshot =
BitmapRenderer.createHardwareBitmap(width, height, mDragLayer::draw);
}
@@ -2516,8 +2516,8 @@
}
@Override
- public void bindIncrementalDownloadProgressUpdated(AppInfo app) {
- mAppsView.getAppsStore().updateProgressBar(app);
+ public void bindPromiseAppProgressUpdated(PromiseAppInfo app) {
+ mAppsView.getAppsStore().updatePromiseAppProgress(app);
}
@Override
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index e89b9b0..8458152 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -48,7 +48,6 @@
import com.android.launcher3.model.LoaderTask;
import com.android.launcher3.model.ModelDelegate;
import com.android.launcher3.model.ModelWriter;
-import com.android.launcher3.model.PackageIncrementalDownloadUpdatedTask;
import com.android.launcher3.model.PackageInstallStateChangedTask;
import com.android.launcher3.model.PackageUpdatedTask;
import com.android.launcher3.model.ShortcutsChangedTask;
@@ -197,15 +196,6 @@
}
@Override
- public void onPackageLoadingProgressChanged(
- String packageName, UserHandle user, float progress) {
- if (Utilities.ATLEAST_S) {
- enqueueModelUpdateTask(new PackageIncrementalDownloadUpdatedTask(
- packageName, user, progress));
- }
- }
-
- @Override
public void onShortcutsChanged(String packageName, List<ShortcutInfo> shortcuts,
UserHandle user) {
enqueueModelUpdateTask(new ShortcutsChangedTask(packageName, shortcuts, user, true));
diff --git a/src/com/android/launcher3/ResourceUtils.java b/src/com/android/launcher3/ResourceUtils.java
index c9fb75a..f60e1f8 100644
--- a/src/com/android/launcher3/ResourceUtils.java
+++ b/src/com/android/launcher3/ResourceUtils.java
@@ -25,6 +25,8 @@
public static final int INVALID_RESOURCE_HANDLE = -1;
public static final String NAVBAR_LANDSCAPE_LEFT_RIGHT_SIZE = "navigation_bar_width";
public static final String NAVBAR_BOTTOM_GESTURE_SIZE = "navigation_bar_gesture_height";
+ public static final String NAVBAR_BOTTOM_GESTURE_LARGER_SIZE =
+ "navigation_bar_gesture_larger_height";
public static int getNavbarSize(String resName, Resources res) {
return getDimenByName(resName, res, DEFAULT_NAVBAR_VALUE);
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index df5d234..5c2f35b 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -107,13 +107,12 @@
public static final String[] EMPTY_STRING_ARRAY = new String[0];
public static final Person[] EMPTY_PERSON_ARRAY = new Person[0];
- public static final boolean ATLEAST_P = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
+ public static final boolean ATLEAST_R = BuildCompat.isAtLeastR();
public static final boolean ATLEAST_Q = Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
- public static final boolean ATLEAST_R = Build.VERSION.SDK_INT >= Build.VERSION_CODES.R;
-
- public static final boolean ATLEAST_S = BuildCompat.isAtLeastS();
+ public static final boolean ATLEAST_P =
+ Build.VERSION.SDK_INT >= Build.VERSION_CODES.P;
/**
* Set on a motion event dispatched from the nav bar. See {@link MotionEvent#setEdgeFlags(int)}.
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 65eba20..777ea3c 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -3154,7 +3154,7 @@
ItemOperator op = (info, v) -> {
if (info instanceof WorkspaceItemInfo && v instanceof BubbleTextView
&& updates.contains(info)) {
- ((BubbleTextView) v).applyLoadingState(false /* promiseStateChanged */);
+ ((BubbleTextView) v).applyPromiseState(false /* promiseStateChanged */);
} else if (v instanceof PendingAppWidgetHostView
&& info instanceof LauncherAppWidgetInfo
&& updates.contains(info)) {
diff --git a/src/com/android/launcher3/allapps/AllAppsStore.java b/src/com/android/launcher3/allapps/AllAppsStore.java
index 00bdb70..3ae0a18 100644
--- a/src/com/android/launcher3/allapps/AllAppsStore.java
+++ b/src/com/android/launcher3/allapps/AllAppsStore.java
@@ -24,6 +24,7 @@
import com.android.launcher3.BubbleTextView;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageUserKey;
@@ -144,17 +145,10 @@
});
}
- /**
- * Sets the AppInfo's associated icon's progress bar.
- *
- * If this app is installed and supports incremental downloads, the progress bar will be updated
- * the app's total download progress. Otherwise, the progress bar will be updated to the app's
- * installation progress.
- */
- public void updateProgressBar(AppInfo app) {
+ public void updatePromiseAppProgress(PromiseAppInfo app) {
updateAllIcons((child) -> {
if (child.getTag() == app) {
- child.applyProgressLevel(app.getProgressLevel());
+ child.applyProgressLevel(app.level);
}
});
}
diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
index f9ab196..c03619e 100644
--- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java
+++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java
@@ -142,7 +142,8 @@
float shiftCurrent = progress * mShiftRange;
mAppsView.setTranslationY(shiftCurrent);
- if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()
+ && !FeatureFlags.DISABLE_INITIAL_IME_IN_ALLAPPS.get()) {
mInsetController.setProgress(progress);
}
}
@@ -233,7 +234,9 @@
public void setupViews(AllAppsContainerView appsView, ScrimView scrimView) {
mAppsView = appsView;
mScrimView = scrimView;
- if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()
+ && !FeatureFlags.DISABLE_INITIAL_IME_IN_ALLAPPS.get()
+ && BuildCompat.isAtLeastR()) {
mInsetController = new AllAppsInsetTransitionController(mShiftRange, mAppsView);
mLauncher.getSystemUiController().updateUiState(UI_STATE_ALLAPPS,
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
@@ -261,7 +264,8 @@
if (Float.compare(mProgress, 1f) == 0) {
mAppsView.reset(false /* animate */);
}
- if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()) {
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()
+ && !FeatureFlags.DISABLE_INITIAL_IME_IN_ALLAPPS.get() && BuildCompat.isAtLeastR()) {
mInsetController.onAnimationEnd(mProgress);
if (Float.compare(mProgress, 0f) == 0) {
mLauncher.getLiveSearchManager().start();
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 1585697..24df653 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -98,6 +98,9 @@
public static final BooleanFlag ENABLE_DEVICE_SEARCH = getDebugFlag(
"ENABLE_DEVICE_SEARCH", false, "Allows on device search in all apps");
+ public static final BooleanFlag DISABLE_INITIAL_IME_IN_ALLAPPS = getDebugFlag(
+ "DISABLE_INITIAL_IME_IN_ALLAPPS", false, "Disable default IME state in all apps");
+
public static final BooleanFlag FOLDER_NAME_SUGGEST = new DeviceFlag(
"FOLDER_NAME_SUGGEST", true,
"Suggests folder names instead of blank text.");
@@ -198,6 +201,16 @@
"ENABLE_FOUR_COLUMNS", false, "Uses 4 columns in launcher grid."
+ "Warning: This will permanently alter your home screen items and is not reversible.");
+ // TODO: b/172467144 Remove ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE feature flag.
+ public static final BooleanFlag ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE = new DeviceFlag(
+ "ENABLE_LAUNCHER_ACTIVITY_THEME_CROSSFADE", false, "Enables a "
+ + "crossfade animation when the system these changes.");
+
+ // TODO: b/174174514 Remove ENABLE_APP_PREDICTIONS_WHILE_VISIBLE feature flag.
+ public static final BooleanFlag ENABLE_APP_PREDICTIONS_WHILE_VISIBLE = new DeviceFlag(
+ "ENABLE_APP_PREDICTIONS_WHILE_VISIBLE", true, "Allows app "
+ + "predictions to be updated while they are visible to the user.");
+
public static void initialize(Context context) {
synchronized (sDebugFlags) {
for (DebugFlag flag : sDebugFlags) {
diff --git a/src/com/android/launcher3/folder/PreviewItemManager.java b/src/com/android/launcher3/folder/PreviewItemManager.java
index 9ae7faf..7f8a15c 100644
--- a/src/com/android/launcher3/folder/PreviewItemManager.java
+++ b/src/com/android/launcher3/folder/PreviewItemManager.java
@@ -39,7 +39,6 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.graphics.PreloadIconDrawable;
-import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.views.ActivityContext;
@@ -395,10 +394,9 @@
}
private void setDrawable(PreviewItemDrawingParams p, WorkspaceItemInfo item) {
- if (item.hasPromiseIconUi() || (item.runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
+ if (item.hasPromiseIconUi()) {
PreloadIconDrawable drawable = newPendingIcon(mContext, item);
- drawable.setLevel(item.getProgressLevel());
+ drawable.setLevel(item.getInstallProgress());
p.drawable = drawable;
} else {
p.drawable = newIcon(mContext, item);
diff --git a/src/com/android/launcher3/graphics/PreloadIconDrawable.java b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
index 9971990..e85b056 100644
--- a/src/com/android/launcher3/graphics/PreloadIconDrawable.java
+++ b/src/com/android/launcher3/graphics/PreloadIconDrawable.java
@@ -117,8 +117,6 @@
mIndicatorColor = IconPalette.getPreloadProgressColor(context, mIconColor);
setInternalProgress(0);
-
- setIsDisabled(!info.isAppStartable());
}
@Override
@@ -268,12 +266,14 @@
mIconScale = SMALL_SCALE;
mScaledTrackPath.reset();
mTrackAlpha = MAX_PAINT_ALPHA;
+ setIsDisabled(true);
}
if (progress < 1 && progress > 0) {
mPathMeasure.getSegment(0, progress * mTrackLength, mScaledProgressPath, true);
mIconScale = SMALL_SCALE;
mTrackAlpha = MAX_PAINT_ALPHA;
+ setIsDisabled(true);
} else if (progress >= 1) {
setIsDisabled(mItem.isDisabled());
mScaledTrackPath.set(mScaledProgressPath);
diff --git a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
index 56dbbd3..c236fa6 100644
--- a/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
+++ b/src/com/android/launcher3/model/AddWorkspaceItemsTask.java
@@ -34,7 +34,6 @@
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.PackageInstallInfo;
import com.android.launcher3.util.GridOccupancy;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.PackageManagerHelper;
@@ -133,9 +132,7 @@
continue;
}
} else {
- workspaceInfo.setProgressLevel(
- (int) (sessionInfo.getProgress() * 100),
- PackageInstallInfo.STATUS_INSTALLING);
+ workspaceInfo.setInstallProgress((int) sessionInfo.getProgress());
}
if (hasActivity) {
diff --git a/src/com/android/launcher3/model/AllAppsList.java b/src/com/android/launcher3/model/AllAppsList.java
index 8d5cf74..2695e66 100644
--- a/src/com/android/launcher3/model/AllAppsList.java
+++ b/src/com/android/launcher3/model/AllAppsList.java
@@ -21,11 +21,11 @@
import android.content.ComponentName;
import android.content.Context;
-import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.content.pm.LauncherApps;
import android.os.LocaleList;
+import android.os.Process;
import android.os.UserHandle;
import android.util.Log;
@@ -37,6 +37,7 @@
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.model.BgDataModel.Callbacks;
import com.android.launcher3.model.data.AppInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.ItemInfoMatcher;
@@ -149,7 +150,7 @@
.getApplicationInfo(installInfo.packageName, installInfo.user, 0);
// only if not yet installed
if (applicationInfo == null) {
- AppInfo info = new AppInfo(installInfo);
+ PromiseAppInfo info = new PromiseAppInfo(installInfo);
mIconCache.getTitleAndIcon(info, info.usingLowResIcon());
info.sectionName = mIndex.computeSectionName(info.title);
@@ -158,26 +159,24 @@
}
}
- /** Updates the given PackageInstallInfo's associated AppInfo's installation info. */
- public List<AppInfo> updatePromiseInstallInfo(PackageInstallInfo installInfo) {
- List<AppInfo> updatedAppInfos = new ArrayList<>();
- UserHandle user = installInfo.user;
- for (int i = data.size() - 1; i >= 0; i--) {
+ public PromiseAppInfo updatePromiseInstallInfo(PackageInstallInfo installInfo) {
+ UserHandle user = Process.myUserHandle();
+ for (int i=0; i < data.size(); i++) {
final AppInfo appInfo = data.get(i);
final ComponentName tgtComp = appInfo.getTargetComponent();
if (tgtComp != null && tgtComp.getPackageName().equals(installInfo.packageName)
- && appInfo.user.equals(user)) {
- if (installInfo.state == PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING
- || installInfo.state == PackageInstallInfo.STATUS_INSTALLING) {
- appInfo.setProgressLevel(installInfo);
-
- updatedAppInfos.add(appInfo);
+ && appInfo.user.equals(user)
+ && appInfo instanceof PromiseAppInfo) {
+ final PromiseAppInfo promiseAppInfo = (PromiseAppInfo) appInfo;
+ if (installInfo.state == PackageInstallInfo.STATUS_INSTALLING) {
+ promiseAppInfo.level = installInfo.progress;
+ return promiseAppInfo;
} else if (installInfo.state == PackageInstallInfo.STATUS_FAILED) {
removeApp(i);
}
}
}
- return updatedAppInfos;
+ return null;
}
private void removeApp(int index) {
@@ -269,14 +268,8 @@
if (applicationInfo == null) {
add(new AppInfo(context, info, user), info);
} else {
- Intent launchIntent = AppInfo.makeLaunchIntent(info);
-
mIconCache.getTitleAndIcon(applicationInfo, info, true /* useLowResIcon */);
applicationInfo.sectionName = mIndex.computeSectionName(applicationInfo.title);
- applicationInfo.setProgressLevel(
- PackageManagerHelper.getLoadingProgress(info),
- PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING);
- applicationInfo.intent = launchIntent;
mDataChanged = true;
}
diff --git a/src/com/android/launcher3/model/BgDataModel.java b/src/com/android/launcher3/model/BgDataModel.java
index 2d860a4..c217a47 100644
--- a/src/com/android/launcher3/model/BgDataModel.java
+++ b/src/com/android/launcher3/model/BgDataModel.java
@@ -39,6 +39,7 @@
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.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.UserCache;
import com.android.launcher3.shortcuts.ShortcutKey;
@@ -458,11 +459,7 @@
void preAddApps();
void bindAppsAdded(IntArray newScreens,
ArrayList<ItemInfo> addNotAnimated, ArrayList<ItemInfo> addAnimated);
-
- /**
- * Binds updated incremental download progress
- */
- void bindIncrementalDownloadProgressUpdated(AppInfo app);
+ void bindPromiseAppProgressUpdated(PromiseAppInfo app);
void bindWorkspaceItemsChanged(List<WorkspaceItemInfo> updated);
void bindWidgetsRestored(ArrayList<LauncherAppWidgetInfo> widgets);
void bindRestoreItemsChange(HashSet<ItemInfo> updates);
diff --git a/src/com/android/launcher3/model/LoaderCursor.java b/src/com/android/launcher3/model/LoaderCursor.java
index 19d9af9..532834e 100644
--- a/src/com/android/launcher3/model/LoaderCursor.java
+++ b/src/com/android/launcher3/model/LoaderCursor.java
@@ -35,13 +35,11 @@
import android.util.Log;
import android.util.LongSparseArray;
-import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherSettings;
-import com.android.launcher3.LauncherSettings.Favorites;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.config.FeatureFlags;
@@ -94,9 +92,6 @@
private final int restoredIndex;
private final int intentIndex;
- @Nullable
- private LauncherActivityInfo mActivityInfo;
-
// Properties loaded per iteration
public long serialNumber;
public UserHandle user;
@@ -137,8 +132,6 @@
public boolean moveToNext() {
boolean result = super.moveToNext();
if (result) {
- mActivityInfo = null;
-
// Load common properties.
itemType = getInt(itemTypeIndex);
container = getInt(containerIndex);
@@ -252,10 +245,6 @@
return info;
}
- public LauncherActivityInfo getLauncherActivityInfo() {
- return mActivityInfo;
- }
-
/**
* Make an WorkspaceItemInfo object for a shortcut that is an application.
*/
@@ -275,25 +264,25 @@
Intent newIntent = new Intent(Intent.ACTION_MAIN, null);
newIntent.addCategory(Intent.CATEGORY_LAUNCHER);
newIntent.setComponent(componentName);
- mActivityInfo = mContext.getSystemService(LauncherApps.class)
+ LauncherActivityInfo lai = mContext.getSystemService(LauncherApps.class)
.resolveActivity(newIntent, user);
- if ((mActivityInfo == null) && !allowMissingTarget) {
+ if ((lai == null) && !allowMissingTarget) {
Log.d(TAG, "Missing activity found in getShortcutInfo: " + componentName);
return null;
}
final WorkspaceItemInfo info = new WorkspaceItemInfo();
- info.itemType = Favorites.ITEM_TYPE_APPLICATION;
+ info.itemType = LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
info.user = user;
info.intent = newIntent;
- mIconCache.getTitleAndIcon(info, mActivityInfo, useLowResIcon);
+ mIconCache.getTitleAndIcon(info, lai, useLowResIcon);
if (mIconCache.isDefaultIcon(info.bitmap, user)) {
loadIcon(info);
}
- if (mActivityInfo != null) {
- AppInfo.updateRuntimeFlagsForActivityTarget(info, mActivityInfo);
+ if (lai != null) {
+ AppInfo.updateRuntimeFlagsForActivityTarget(info, lai);
}
// from the db
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index f74c8b5..8e085ce 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -69,7 +69,6 @@
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.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
@@ -592,24 +591,11 @@
if (c.restoreFlag != 0 && !TextUtils.isEmpty(targetPkg)) {
tempPackageKey.update(targetPkg, c.user);
SessionInfo si = installingPkgs.get(tempPackageKey);
- LauncherActivityInfo activityInfo =
- c.getLauncherActivityInfo();
- if (si == null) {
- info.runtimeStatusFlags &=
- ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
- } else if (activityInfo == null) {
- int installProgress = (int) (si.getProgress() * 100);
-
- info.setProgressLevel(
- installProgress,
- PackageInstallInfo.STATUS_INSTALLING);
- } else {
- info.setProgressLevel(
- PackageManagerHelper
- .getLoadingProgress(activityInfo),
- PackageInstallInfo
- .STATUS_INSTALLED_DOWNLOADING);
- }
+ if (si == null) {
+ info.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
+ } else {
+ info.setInstallProgress((int) (si.getProgress() * 100));
+ }
}
c.checkAndAddItem(info, mBgDataModel);
diff --git a/src/com/android/launcher3/model/PackageIncrementalDownloadUpdatedTask.java b/src/com/android/launcher3/model/PackageIncrementalDownloadUpdatedTask.java
deleted file mode 100644
index e3e8769..0000000
--- a/src/com/android/launcher3/model/PackageIncrementalDownloadUpdatedTask.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.model;
-
-import android.content.ComponentName;
-import android.os.UserHandle;
-
-import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.model.data.AppInfo;
-import com.android.launcher3.model.data.ItemInfoWithIcon;
-import com.android.launcher3.model.data.WorkspaceItemInfo;
-import com.android.launcher3.pm.PackageInstallInfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Handles updates due to incremental download progress updates.
- */
-public class PackageIncrementalDownloadUpdatedTask extends BaseModelUpdateTask {
-
- private final UserHandle mUser;
- private final int mProgress;
- private final String mPackageName;
-
- public PackageIncrementalDownloadUpdatedTask(
- String packageName, UserHandle user, float progress) {
- mUser = user;
- mProgress = 1 - progress > 0.001 ? (int) (100 * progress) : 100;
- mPackageName = packageName;
- }
-
- @Override
- public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList appsList) {
- PackageInstallInfo downloadInfo = new PackageInstallInfo(
- mPackageName,
- PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING,
- mProgress,
- mUser);
-
- synchronized (appsList) {
- List<AppInfo> updatedAppInfos = appsList.updatePromiseInstallInfo(downloadInfo);
- if (!updatedAppInfos.isEmpty()) {
- for (AppInfo appInfo : updatedAppInfos) {
- appInfo.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
- scheduleCallbackTask(
- c -> c.bindIncrementalDownloadProgressUpdated(appInfo));
- }
- }
- bindApplicationsIfNeeded();
- }
-
- final ArrayList<WorkspaceItemInfo> updatedWorkspaceItems = new ArrayList<>();
- synchronized (dataModel) {
- dataModel.forAllWorkspaceItemInfos(mUser, si -> {
- ComponentName cn = si.getTargetComponent();
- if ((cn != null) && cn.getPackageName().equals(mPackageName)) {
- si.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
- si.setProgressLevel(downloadInfo);
- updatedWorkspaceItems.add(si);
- }
- });
- }
- bindUpdatedWorkspaceItems(updatedWorkspaceItems);
- }
-}
diff --git a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
index 8215edd..8369c48 100644
--- a/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
+++ b/src/com/android/launcher3/model/PackageInstallStateChangedTask.java
@@ -20,15 +20,14 @@
import android.content.pm.PackageManager;
import com.android.launcher3.LauncherAppState;
-import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
+import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.util.InstantAppResolver;
import java.util.HashSet;
-import java.util.List;
/**
* Handles changes due to a sessions updates for a currently installing app.
@@ -60,11 +59,9 @@
}
synchronized (apps) {
- List<AppInfo> updatedAppInfos = apps.updatePromiseInstallInfo(mInstallInfo);
- if (!updatedAppInfos.isEmpty()) {
- for (AppInfo appInfo : updatedAppInfos) {
- scheduleCallbackTask(c -> c.bindIncrementalDownloadProgressUpdated(appInfo));
- }
+ PromiseAppInfo updated = apps.updatePromiseInstallInfo(mInstallInfo);
+ if (updated != null) {
+ scheduleCallbackTask(c -> c.bindPromiseAppProgressUpdated(updated));
}
bindApplicationsIfNeeded();
}
@@ -74,13 +71,11 @@
dataModel.forAllWorkspaceItemInfos(mInstallInfo.user, si -> {
ComponentName cn = si.getTargetComponent();
if (si.hasPromiseIconUi() && (cn != null)
- && cn.getPackageName().equals(mInstallInfo.packageName)) {
- int installProgress = mInstallInfo.progress;
-
- si.setProgressLevel(installProgress, PackageInstallInfo.STATUS_INSTALLING);
+ && mInstallInfo.packageName.equals(cn.getPackageName())) {
+ si.setInstallProgress(mInstallInfo.progress);
if (mInstallInfo.state == PackageInstallInfo.STATUS_FAILED) {
// Mark this info as broken.
- si.runtimeStatusFlags &= ~ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE;
+ si.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
}
updates.add(si);
}
diff --git a/src/com/android/launcher3/model/data/AppInfo.java b/src/com/android/launcher3/model/data/AppInfo.java
index 39247c2..aee1f2a 100644
--- a/src/com/android/launcher3/model/data/AppInfo.java
+++ b/src/com/android/launcher3/model/data/AppInfo.java
@@ -28,13 +28,10 @@
import android.os.UserHandle;
import android.os.UserManager;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.Utilities;
-import com.android.launcher3.pm.PackageInstallInfo;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.PackageManagerHelper;
@@ -107,37 +104,13 @@
this.intent = intent;
}
- public AppInfo(@NonNull PackageInstallInfo installInfo) {
- componentName = installInfo.componentName;
- intent = new Intent(Intent.ACTION_MAIN)
- .addCategory(Intent.CATEGORY_LAUNCHER)
- .setComponent(componentName)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
- user = installInfo.user;
- }
-
@Override
protected String dumpProperties() {
return super.dumpProperties() + " componentName=" + componentName;
}
public WorkspaceItemInfo makeWorkspaceItem() {
- WorkspaceItemInfo workspaceItemInfo = new WorkspaceItemInfo(this);
-
- if ((runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) != 0) {
- // We need to update the component name when the apk is installed
- workspaceItemInfo.status |= WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
- // Since the user is manually placing it on homescreen, it should not be auto-removed
- // later
- workspaceItemInfo.status |= WorkspaceItemInfo.FLAG_RESTORE_STARTED;
- workspaceItemInfo.status |= FLAG_INSTALL_SESSION_ACTIVE;
- }
- if ((runtimeStatusFlags & FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0) {
- workspaceItemInfo.runtimeStatusFlags |= FLAG_INCREMENTAL_DOWNLOAD_ACTIVE;
- }
-
- return workspaceItemInfo;
+ return new WorkspaceItemInfo(this);
}
public ComponentKey toComponentKey() {
@@ -156,12 +129,6 @@
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
}
- @Nullable
- @Override
- public ComponentName getTargetComponent() {
- return componentName;
- }
-
public static void updateRuntimeFlagsForActivityTarget(
ItemInfoWithIcon info, LauncherActivityInfo lai) {
ApplicationInfo appInfo = lai.getApplicationInfo();
@@ -176,11 +143,6 @@
// The icon for a non-primary user is badged, hence it's not exactly an adaptive icon.
info.runtimeStatusFlags |= FLAG_ADAPTIVE_ICON;
}
-
- // Sets the progress level, installation and incremental download flags.
- info.setProgressLevel(
- PackageManagerHelper.getLoadingProgress(lai),
- PackageInstallInfo.STATUS_INSTALLED);
}
@Override
diff --git a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
index b8a71d3..d95f94f 100644
--- a/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
+++ b/src/com/android/launcher3/model/data/ItemInfoWithIcon.java
@@ -16,15 +16,7 @@
package com.android.launcher3.model.data;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-
-import androidx.annotation.Nullable;
-
import com.android.launcher3.icons.BitmapInfo;
-import com.android.launcher3.pm.PackageInstallInfo;
-import com.android.launcher3.util.PackageManagerHelper;
/**
* Represents an ItemInfo which also holds an icon.
@@ -96,34 +88,11 @@
public static final int FLAG_ICON_BADGED = 1 << 9;
/**
- * The icon is being installed. If {@link WorkspaceItemInfo#FLAG_RESTORED_ICON} or
- * {@link WorkspaceItemInfo#FLAG_AUTOINSTALL_ICON} is set, then the icon is either being
- * installed or is in a broken state.
- */
- public static final int FLAG_INSTALL_SESSION_ACTIVE = 1 << 10;
-
- /**
- * This icon is still being downloaded.
- */
- public static final int FLAG_INCREMENTAL_DOWNLOAD_ACTIVE = 1 << 11;
-
- public static final int FLAG_SHOW_DOWNLOAD_PROGRESS_MASK = FLAG_INSTALL_SESSION_ACTIVE
- | FLAG_INCREMENTAL_DOWNLOAD_ACTIVE;
-
- /**
* Status associated with the system state of the underlying item. This is calculated every
* time a new info is created and not persisted on the disk.
*/
public int runtimeStatusFlags = 0;
- /**
- * The download progress of the package that this shortcut represents. For legacy apps, this
- * will always be the installation progress. For apps that support incremental downloads, this
- * will only match be the installation progress until the app is installed, then this will the
- * total download progress.
- */
- private int mProgressLevel = 100;
-
protected ItemInfoWithIcon() { }
protected ItemInfoWithIcon(ItemInfoWithIcon info) {
@@ -145,72 +114,6 @@
}
/**
- * Returns whether the app this shortcut represents is able to be started. For legacy apps,
- * this returns whether it is fully installed. For apps that support incremental downloads,
- * this returns whether the app is either fully downloaded or has installed and is downloading
- * incrementally.
- */
- public boolean isAppStartable() {
- return ((runtimeStatusFlags & FLAG_INSTALL_SESSION_ACTIVE) == 0)
- && (((runtimeStatusFlags & FLAG_INCREMENTAL_DOWNLOAD_ACTIVE) != 0)
- || mProgressLevel == 100);
- }
-
- /**
- * Returns the download progress for the app this shortcut represents. If this app is not yet
- * installed or does not support incremental downloads, this will return the installation
- * progress.
- */
- public int getProgressLevel() {
- if ((runtimeStatusFlags & FLAG_SHOW_DOWNLOAD_PROGRESS_MASK) != 0) {
- return mProgressLevel;
- }
- return 100;
- }
-
- /**
- * Sets the download progress for the app this shortcut represents. If this app is not yet
- * installed or does not support incremental downloads, this will set
- * {@code FLAG_INSTALL_SESSION_ACTIVE}. If this app is downloading incrementally, this will
- * set {@code FLAG_INCREMENTAL_DOWNLOAD_ACTIVE}. Otherwise, this will remove both flags.
- */
- public void setProgressLevel(PackageInstallInfo installInfo) {
- setProgressLevel(installInfo.progress, installInfo.state);
- }
-
- /**
- * Sets the download progress for the app this shortcut represents.
- */
- public void setProgressLevel(int progress, int status) {
- if (status == PackageInstallInfo.STATUS_INSTALLING) {
- mProgressLevel = progress;
- runtimeStatusFlags = progress < 100
- ? runtimeStatusFlags | FLAG_INSTALL_SESSION_ACTIVE
- : runtimeStatusFlags & ~FLAG_INSTALL_SESSION_ACTIVE;
- } else if (status == PackageInstallInfo.STATUS_INSTALLED_DOWNLOADING) {
- mProgressLevel = progress;
- runtimeStatusFlags = runtimeStatusFlags & ~FLAG_INSTALL_SESSION_ACTIVE;
- runtimeStatusFlags = progress < 100
- ? runtimeStatusFlags | FLAG_INCREMENTAL_DOWNLOAD_ACTIVE
- : runtimeStatusFlags & ~FLAG_INCREMENTAL_DOWNLOAD_ACTIVE;
- } else {
- mProgressLevel = status == PackageInstallInfo.STATUS_INSTALLED ? 100 : 0;
- runtimeStatusFlags = runtimeStatusFlags & ~FLAG_INSTALL_SESSION_ACTIVE;
- runtimeStatusFlags = runtimeStatusFlags & ~FLAG_INCREMENTAL_DOWNLOAD_ACTIVE;
- }
- }
-
- /** Creates an intent to that launches the app store at this app's page. */
- @Nullable
- public Intent getMarketIntent(Context context) {
- ComponentName componentName = getTargetComponent();
-
- return componentName != null
- ? new PackageManagerHelper(context).getMarketIntent(componentName.getPackageName())
- : null;
- }
-
- /**
* @return a copy of this
*/
public abstract ItemInfoWithIcon clone();
diff --git a/src/com/android/launcher3/model/data/PromiseAppInfo.java b/src/com/android/launcher3/model/data/PromiseAppInfo.java
new file mode 100644
index 0000000..b6231ed
--- /dev/null
+++ b/src/com/android/launcher3/model/data/PromiseAppInfo.java
@@ -0,0 +1,54 @@
+/*
+ * 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.model.data;
+
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.NonNull;
+
+import com.android.launcher3.pm.PackageInstallInfo;
+import com.android.launcher3.util.PackageManagerHelper;
+
+public class PromiseAppInfo extends AppInfo {
+
+ public int level = 0;
+
+ public PromiseAppInfo(@NonNull PackageInstallInfo installInfo) {
+ componentName = installInfo.componentName;
+ intent = new Intent(Intent.ACTION_MAIN)
+ .addCategory(Intent.CATEGORY_LAUNCHER)
+ .setComponent(componentName)
+ .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+ | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
+ }
+
+ @Override
+ public WorkspaceItemInfo makeWorkspaceItem() {
+ WorkspaceItemInfo shortcut = new WorkspaceItemInfo(this);
+ shortcut.setInstallProgress(level);
+ // We need to update the component name when the apk is installed
+ shortcut.status |= WorkspaceItemInfo.FLAG_AUTOINSTALL_ICON;
+ // Since the user is manually placing it on homescreen, it should not be auto-removed later
+ shortcut.status |= WorkspaceItemInfo.FLAG_RESTORE_STARTED;
+ return shortcut;
+ }
+
+ public Intent getMarketIntent(Context context) {
+ return new PackageManagerHelper(context).getMarketIntent(componentName.getPackageName());
+ }
+}
diff --git a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
index 690e904..1e1d093 100644
--- a/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
+++ b/src/com/android/launcher3/model/data/WorkspaceItemInfo.java
@@ -58,14 +58,20 @@
public static final int FLAG_AUTOINSTALL_ICON = 1 << 1;
/**
+ * The icon is being installed. If {@link #FLAG_RESTORED_ICON} or {@link #FLAG_AUTOINSTALL_ICON}
+ * is set, then the icon is either being installed or is in a broken state.
+ */
+ public static final int FLAG_INSTALL_SESSION_ACTIVE = 1 << 2;
+
+ /**
* Indicates that the widget restore has started.
*/
- public static final int FLAG_RESTORE_STARTED = 1 << 2;
+ public static final int FLAG_RESTORE_STARTED = 1 << 3;
/**
* Web UI supported.
*/
- public static final int FLAG_SUPPORTS_WEB_UI = 1 << 3;
+ public static final int FLAG_SUPPORTS_WEB_UI = 1 << 4;
/**
* The intent used to start the application.
@@ -92,6 +98,11 @@
*/
@NonNull private String[] personKeys = Utilities.EMPTY_STRING_ARRAY;
+ /**
+ * The installation progress [0-100] of the package that this shortcut represents.
+ */
+ private int mInstallProgress;
+
public WorkspaceItemInfo() {
itemType = LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
@@ -103,6 +114,7 @@
intent = new Intent(info.intent);
iconResource = info.iconResource;
status = info.status;
+ mInstallProgress = info.mInstallProgress;
personKeys = info.personKeys.clone();
}
@@ -156,6 +168,15 @@
return isPromise() && !hasStatusFlag(FLAG_SUPPORTS_WEB_UI);
}
+ public int getInstallProgress() {
+ return mInstallProgress;
+ }
+
+ public void setInstallProgress(int progress) {
+ mInstallProgress = progress;
+ status |= FLAG_INSTALL_SESSION_ACTIVE;
+ }
+
public void updateFromDeepShortcutInfo(ShortcutInfo shortcutInfo, Context context) {
// {@link ShortcutInfo#getActivity} can change during an update. Recreate the intent
intent = ShortcutKey.makeIntent(shortcutInfo);
diff --git a/src/com/android/launcher3/pm/PackageInstallInfo.java b/src/com/android/launcher3/pm/PackageInstallInfo.java
index fad904f..7997d16 100644
--- a/src/com/android/launcher3/pm/PackageInstallInfo.java
+++ b/src/com/android/launcher3/pm/PackageInstallInfo.java
@@ -25,8 +25,7 @@
public static final int STATUS_INSTALLED = 0;
public static final int STATUS_INSTALLING = 1;
- public static final int STATUS_INSTALLED_DOWNLOADING = 2;
- public static final int STATUS_FAILED = 3;
+ public static final int STATUS_FAILED = 2;
public final ComponentName componentName;
public final String packageName;
@@ -57,4 +56,5 @@
public static PackageInstallInfo fromState(int state, String packageName, UserHandle user) {
return new PackageInstallInfo(packageName, state, 0 /* progress */, user);
}
+
}
diff --git a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
index 0266345..b496608 100644
--- a/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
+++ b/src/com/android/launcher3/secondarydisplay/SecondaryDisplayLauncher.java
@@ -35,8 +35,8 @@
import com.android.launcher3.model.BgDataModel;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupContainerWithArrow;
import com.android.launcher3.popup.PopupDataProvider;
@@ -215,8 +215,8 @@
ArrayList<ItemInfo> addAnimated) { }
@Override
- public void bindIncrementalDownloadProgressUpdated(AppInfo app) {
- mAppsView.getAppsStore().updateProgressBar(app);
+ public void bindPromiseAppProgressUpdated(PromiseAppInfo app) {
+ mAppsView.getAppsStore().updatePromiseAppProgress(app);
}
@Override
@@ -315,11 +315,9 @@
if (tag instanceof ItemInfo) {
ItemInfo item = (ItemInfo) tag;
Intent intent;
- if (item instanceof ItemInfoWithIcon
- && (((ItemInfoWithIcon) item).runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
- ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item;
- intent = appInfo.getMarketIntent(this);
+ if (item instanceof PromiseAppInfo) {
+ PromiseAppInfo promiseAppInfo = (PromiseAppInfo) item;
+ intent = promiseAppInfo.getMarketIntent(this);
} else {
intent = item.getIntent();
}
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 23baaf0..10cd04c 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -261,7 +261,9 @@
mCanBlockFling = mFromState == NORMAL;
mFlingBlockCheck.unblockFling();
// Must be called after all the animation controllers have been paused
- if (FeatureFlags.ENABLE_DEVICE_SEARCH.get() && BuildCompat.isAtLeastR()
+ if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()
+ && !FeatureFlags.DISABLE_INITIAL_IME_IN_ALLAPPS.get()
+ && BuildCompat.isAtLeastR()
&& (mToState == ALL_APPS || mToState == NORMAL)) {
mLauncher.getAllAppsController().getInsetController().onDragStart(
mFromState == NORMAL ? 1f : 0f);
diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java
index 4158735..9b9cb0a 100644
--- a/src/com/android/launcher3/touch/ItemClickHandler.java
+++ b/src/com/android/launcher3/touch/ItemClickHandler.java
@@ -49,8 +49,8 @@
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.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.RemoteActionItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.pm.InstallSessionHelper;
@@ -231,12 +231,8 @@
? shortcut.getIntent().getComponent().getPackageName()
: shortcut.getIntent().getPackage();
if (!TextUtils.isEmpty(packageName)) {
- onClickPendingAppItem(
- v,
- launcher,
- packageName,
- (shortcut.runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0);
+ onClickPendingAppItem(v, launcher, packageName,
+ shortcut.hasStatusFlag(WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE));
return;
}
}
@@ -270,12 +266,9 @@
TestLogging.recordEvent(
TestProtocol.SEQUENCE_MAIN, "start: startAppShortcutOrInfoActivity");
Intent intent;
- if (item instanceof ItemInfoWithIcon
- && (((ItemInfoWithIcon) item).runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
- ItemInfoWithIcon appInfo = (ItemInfoWithIcon) item;
- intent = new PackageManagerHelper(launcher)
- .getMarketIntent(appInfo.getTargetComponent().getPackageName());
+ if (item instanceof PromiseAppInfo) {
+ PromiseAppInfo promiseAppInfo = (PromiseAppInfo) item;
+ intent = promiseAppInfo.getMarketIntent(launcher);
} else {
intent = item.getIntent();
}
diff --git a/src/com/android/launcher3/util/PackageManagerHelper.java b/src/com/android/launcher3/util/PackageManagerHelper.java
index 7b26427..523545a 100644
--- a/src/com/android/launcher3/util/PackageManagerHelper.java
+++ b/src/com/android/launcher3/util/PackageManagerHelper.java
@@ -45,11 +45,10 @@
import com.android.launcher3.PendingAddItemInfo;
import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
-import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.model.data.PromiseAppInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import java.net.URISyntaxException;
@@ -201,12 +200,9 @@
* Starts the details activity for {@code info}
*/
public void startDetailsActivityForInfo(ItemInfo info, Rect sourceBounds, Bundle opts) {
- if (info instanceof ItemInfoWithIcon
- && (((ItemInfoWithIcon) info).runtimeStatusFlags
- & ItemInfoWithIcon.FLAG_INSTALL_SESSION_ACTIVE) != 0) {
- ItemInfoWithIcon appInfo = (ItemInfoWithIcon) info;
- mContext.startActivity(new PackageManagerHelper(mContext)
- .getMarketIntent(appInfo.getTargetComponent().getPackageName()));
+ if (info instanceof PromiseAppInfo) {
+ PromiseAppInfo promiseAppInfo = (PromiseAppInfo) info;
+ mContext.startActivity(promiseAppInfo.getMarketIntent(mContext));
return;
}
ComponentName componentName = null;
@@ -323,12 +319,4 @@
}
return false;
}
-
- /** Returns the incremental download progress for the given shortcut's app. */
- public static int getLoadingProgress(LauncherActivityInfo info) {
- if (Utilities.ATLEAST_S) {
- return (int) (100 * info.getLoadingProgress());
- }
- return 100;
- }
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index e118481..d3fc89e 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -234,25 +234,11 @@
return mDevice;
}
- private boolean hasSystemUiObject(String resId) {
- return mDevice.hasObject(By.res(SYSTEMUI_PACKAGE, resId));
- }
-
@Before
public void setUp() throws Exception {
- Log.d(TAG, "Before disabling battery defender");
- mDevice.executeShellCommand("setprop vendor.battery.defender.disable 1");
- Log.d(TAG, "Before enabling stay awake");
- mDevice.executeShellCommand("settings put global stay_on_while_plugged_in 3");
- for (int i = 0; i < 10 && hasSystemUiObject("keyguard_status_view"); ++i) {
- Log.d(TAG, "Before unlocking the phone");
- mDevice.executeShellCommand("input keyevent 82");
- mDevice.waitForIdle();
- }
- Assert.assertTrue("Keyguard still visible",
+ Assert.assertTrue("Keyguard is visible",
mDevice.wait(
Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000));
- Log.d(TAG, "Keyguard is not visible");
final String launcherPackageName = mDevice.getLauncherPackageName();
try {