mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-06 02:46:57 +00:00
Revert "Unifying various model update callbacks into one"
Revert submission 31445615-model-callbacks Reason for revert: <Droidmonitor crested revert due to b/393222548. Will be verified through ABTD for stanadard investigation.> Reverted changes: /q/submissionid:31445615-model-callbacks Change-Id: If6893a125756e5abfbb215af377576429bb1c91b
This commit is contained in:
committed by
Android (Google) Code Review
parent
36c3112abf
commit
72f9943f64
@@ -27,9 +27,7 @@ import static com.android.launcher3.BubbleTextView.DISPLAY_SEARCH_RESULT_SMALL;
|
||||
import static com.android.launcher3.Flags.FLAG_ENABLE_SUPPORT_FOR_ARCHIVING;
|
||||
import static com.android.launcher3.Flags.FLAG_USE_NEW_ICON_FOR_ARCHIVED_APPS;
|
||||
import static com.android.launcher3.LauncherPrefs.ENABLE_TWOLINE_ALLAPPS_TOGGLE;
|
||||
import static com.android.launcher3.anim.AnimatorListeners.forEndCallback;
|
||||
import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_ARCHIVED;
|
||||
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@@ -41,8 +39,6 @@ import static org.mockito.Mockito.verify;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Bitmap.Config;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
@@ -61,17 +57,13 @@ import com.android.launcher3.BubbleTextView;
|
||||
import com.android.launcher3.Flags;
|
||||
import com.android.launcher3.LauncherPrefs;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.graphics.PreloadIconDrawable;
|
||||
import com.android.launcher3.icons.BitmapInfo;
|
||||
import com.android.launcher3.model.data.AppInfo;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.pm.PackageInstallInfo;
|
||||
import com.android.launcher3.search.StringMatcherUtility;
|
||||
import com.android.launcher3.util.ActivityContextWrapper;
|
||||
import com.android.launcher3.util.FlagOp;
|
||||
import com.android.launcher3.util.IntArray;
|
||||
import com.android.launcher3.util.LauncherModelHelper.SandboxModelContext;
|
||||
import com.android.launcher3.util.TestUtil;
|
||||
import com.android.launcher3.views.BaseDragLayer;
|
||||
|
||||
import org.junit.After;
|
||||
@@ -81,8 +73,6 @@ import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
/**
|
||||
* Unit tests for testing modifyTitleToSupportMultiLine() in BubbleTextView.java
|
||||
* This class tests a couple of strings and uses the getMaxLines() to determine if the test passes.
|
||||
@@ -495,40 +485,4 @@ public class BubbleTextViewTest {
|
||||
|
||||
assertThat(mBubbleTextView.getIcon().hasBadge()).isEqualTo(true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void applyingPendingIcon_preserves_last_icon() throws Exception {
|
||||
mItemInfoWithIcon.bitmap =
|
||||
BitmapInfo.fromBitmap(Bitmap.createBitmap(100, 100, Config.ARGB_8888));
|
||||
mItemInfoWithIcon.setProgressLevel(30, PackageInstallInfo.STATUS_INSTALLING);
|
||||
|
||||
TestUtil.runOnExecutorSync(MAIN_EXECUTOR,
|
||||
() -> mBubbleTextView.applyIconAndLabel(mItemInfoWithIcon));
|
||||
assertThat(mBubbleTextView.getIcon()).isInstanceOf(PreloadIconDrawable.class);
|
||||
assertThat(mBubbleTextView.getIcon().getLevel()).isEqualTo(30);
|
||||
PreloadIconDrawable oldIcon = (PreloadIconDrawable) mBubbleTextView.getIcon();
|
||||
|
||||
// Same icon is used when progress changes
|
||||
mItemInfoWithIcon.setProgressLevel(50, PackageInstallInfo.STATUS_INSTALLING);
|
||||
TestUtil.runOnExecutorSync(MAIN_EXECUTOR,
|
||||
() -> mBubbleTextView.applyIconAndLabel(mItemInfoWithIcon));
|
||||
assertThat(mBubbleTextView.getIcon()).isSameInstanceAs(oldIcon);
|
||||
assertThat(mBubbleTextView.getIcon().getLevel()).isEqualTo(50);
|
||||
|
||||
// Icon is replaced with a non pending icon when download finishes
|
||||
mItemInfoWithIcon.setProgressLevel(100, PackageInstallInfo.STATUS_INSTALLED);
|
||||
|
||||
CountDownLatch animWait = new CountDownLatch(1);
|
||||
TestUtil.runOnExecutorSync(MAIN_EXECUTOR, () -> {
|
||||
mBubbleTextView.applyIconAndLabel(mItemInfoWithIcon);
|
||||
assertThat(mBubbleTextView.getIcon()).isSameInstanceAs(oldIcon);
|
||||
assertThat(oldIcon.getActiveAnimation()).isNotNull();
|
||||
oldIcon.getActiveAnimation().addListener(forEndCallback(animWait::countDown));
|
||||
});
|
||||
animWait.await();
|
||||
|
||||
// Assert that the icon is replaced with a non-pending icon
|
||||
assertThat(mBubbleTextView.getIcon()).isNotInstanceOf(PreloadIconDrawable.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user