Merge "Prevent prediction updates while app is launching" into ub-launcher3-master
This commit is contained in:
+12
-1
@@ -109,6 +109,7 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
private AppPredictor mAppPredictor;
|
||||
private AllAppsStore mAllAppsStore;
|
||||
private AnimatorSet mIconRemoveAnimators;
|
||||
private boolean mUIUpdatePaused = false;
|
||||
|
||||
private HotseatEduController mHotseatEduController;
|
||||
|
||||
@@ -168,7 +169,7 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
}
|
||||
|
||||
private void fillGapsWithPrediction(boolean animate, Runnable callback) {
|
||||
if (!isReady() || mDragObject != null) {
|
||||
if (!isReady() || mUIUpdatePaused || mDragObject != null) {
|
||||
return;
|
||||
}
|
||||
List<WorkspaceItemInfo> predictedApps = mapToWorkspaceItemInfo(mComponentKeyMappers);
|
||||
@@ -249,6 +250,16 @@ public class HotseatPredictionController implements DragController.DragListener,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* start and pauses predicted apps update on the hotseat
|
||||
*/
|
||||
public void setPauseUIUpdate(boolean paused) {
|
||||
mUIUpdatePaused = paused;
|
||||
if (!paused) {
|
||||
fillGapsWithPrediction();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates App Predictor with all the current apps pinned on the hotseat
|
||||
*/
|
||||
|
||||
+19
@@ -20,14 +20,19 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.ItemInfo;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.WorkspaceItemInfo;
|
||||
@@ -160,6 +165,15 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
|
||||
onStateOrResumeChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startActivitySafely(View v, Intent intent, ItemInfo item,
|
||||
@Nullable String sourceContainer) {
|
||||
if (mHotseatPredictionController != null) {
|
||||
mHotseatPredictionController.setPauseUIUpdate(true);
|
||||
}
|
||||
return super.startActivitySafely(v, intent, item, sourceContainer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityFlagsChanged(int changeBits) {
|
||||
super.onActivityFlagsChanged(changeBits);
|
||||
@@ -169,6 +183,11 @@ public class QuickstepLauncher extends BaseQuickstepLauncher {
|
||||
&& (getActivityFlags() & ACTIVITY_STATE_TRANSITION_ACTIVE) == 0) {
|
||||
onStateOrResumeChanged();
|
||||
}
|
||||
|
||||
if ((changeBits & ACTIVITY_STATE_STARTED) != 0 && mHotseatPredictionController != null
|
||||
&& (getActivityFlags() & ACTIVITY_STATE_USER_ACTIVE) == 0) {
|
||||
mHotseatPredictionController.setPauseUIUpdate(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user