summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/AppWidgetsRestoredReceiver.java63
-rw-r--r--src/com/android/launcher3/LauncherModel.java3
-rw-r--r--src/com/android/launcher3/allapps/WorkModeSwitch.java1
-rw-r--r--src/com/android/launcher3/config/FeatureFlags.java2
-rw-r--r--src/com/android/launcher3/folder/FolderAnimationManager.java5
-rw-r--r--src/com/android/launcher3/logging/FileLog.java20
-rw-r--r--src/com/android/launcher3/logging/StatsLogManager.java3
-rw-r--r--src/com/android/launcher3/model/BaseLauncherBinder.java26
-rw-r--r--src/com/android/launcher3/model/BaseModelUpdateTask.java5
-rw-r--r--src/com/android/launcher3/provider/RestoreDbTask.java3
-rw-r--r--src/com/android/launcher3/util/ContentWriter.java2
-rw-r--r--src/com/android/launcher3/util/DisplayController.java14
-rw-r--r--src/com/android/launcher3/views/ActivityContext.java6
-rw-r--r--src/com/android/launcher3/views/Snackbar.java22
-rw-r--r--src/com/android/launcher3/widget/BaseLauncherAppWidgetHostView.java1
-rw-r--r--src/com/android/launcher3/widget/picker/WidgetsListAdapter.java28
16 files changed, 155 insertions, 49 deletions
diff --git a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
index 3dd8627177..ec874b9502 100644
--- a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
+++ b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
@@ -20,7 +20,6 @@ import com.android.launcher3.model.ModelDbController;
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
import com.android.launcher3.pm.UserCache;
-import com.android.launcher3.provider.LauncherDbUtils;
import com.android.launcher3.provider.RestoreDbTask;
import com.android.launcher3.util.ContentWriter;
import com.android.launcher3.util.IntArray;
@@ -77,16 +76,8 @@ public class AppWidgetsRestoredReceiver extends BroadcastReceiver {
+ "oldWidgetIds=" + IntArray.wrap(oldWidgetIds).toConcatString()
+ ", newWidgetIds=" + IntArray.wrap(newWidgetIds).toConcatString());
- try {
- IntArray result = LauncherDbUtils.queryIntArray(false, controller.getDb(),
- Favorites.TABLE_NAME, Favorites.APPWIDGET_ID,
- Favorites.APPWIDGET_ID + "!=" + LauncherAppWidgetInfo.NO_ID, null, null);
- // TODO(b/234700507): Remove the logs after the bug is fixed
- Log.d(TAG, "restoreAppWidgetIds: all widget ids in database: "
- + result.toConcatString());
- } catch (Exception ex) {
- Log.e(TAG, "Getting widget ids from the database failed", ex);
- }
+ // TODO(b/234700507): Remove the logs after the bug is fixed
+ logDatabaseWidgetInfo(controller);
for (int i = 0; i < oldWidgetIds.length; i++) {
Log.i(TAG, "Widget state restore id " + oldWidgetIds[i] + " => " + newWidgetIds[i]);
@@ -104,9 +95,13 @@ public class AppWidgetsRestoredReceiver extends BroadcastReceiver {
// recreate the widget during loading with the correct host provider.
long mainProfileId = UserCache.INSTANCE.get(context)
.getSerialNumberForUser(myUserHandle());
+ long controllerProfileId = controller.getSerialNumberForUser(myUserHandle());
String oldWidgetId = Integer.toString(oldWidgetIds[i]);
final String where = "appWidgetId=? and (restored & 1) = 1 and profileId=?";
- final String[] args = new String[] { oldWidgetId, Long.toString(mainProfileId) };
+ String profileId = Long.toString(mainProfileId);
+ final String[] args = new String[] { oldWidgetId, profileId };
+ Log.d(TAG, "restoreAppWidgetIds: querying profile id=" + profileId
+ + " with controller profile ID=" + controllerProfileId);
int result = new ContentWriter(context,
new ContentWriter.CommitParams(controller, where, args))
.put(LauncherSettings.Favorites.APPWIDGET_ID, newWidgetIds[i])
@@ -135,4 +130,48 @@ public class AppWidgetsRestoredReceiver extends BroadcastReceiver {
app.getModel().forceReload();
}
}
+
+ private static void logDatabaseWidgetInfo(ModelDbController controller) {
+ try (Cursor cursor = controller.getDb().query(Favorites.TABLE_NAME,
+ new String[]{Favorites.APPWIDGET_ID, Favorites.RESTORED, Favorites.PROFILE_ID},
+ Favorites.APPWIDGET_ID + "!=" + LauncherAppWidgetInfo.NO_ID, null,
+ null, null, null)) {
+ IntArray widgetIdList = new IntArray();
+ IntArray widgetRestoreList = new IntArray();
+ IntArray widgetProfileIdList = new IntArray();
+
+ if (cursor.moveToFirst()) {
+ final int widgetIdColumnIndex = cursor.getColumnIndex(Favorites.APPWIDGET_ID);
+ final int widgetRestoredColumnIndex = cursor.getColumnIndex(Favorites.RESTORED);
+ final int widgetProfileIdIndex = cursor.getColumnIndex(Favorites.PROFILE_ID);
+ while (!cursor.isAfterLast()) {
+ int widgetId = cursor.getInt(widgetIdColumnIndex);
+ int widgetRestoredFlag = cursor.getInt(widgetRestoredColumnIndex);
+ int widgetProfileId = cursor.getInt(widgetProfileIdIndex);
+
+ widgetIdList.add(widgetId);
+ widgetRestoreList.add(widgetRestoredFlag);
+ widgetProfileIdList.add(widgetProfileId);
+ cursor.moveToNext();
+ }
+ }
+
+ StringBuilder builder = new StringBuilder();
+ builder.append("[");
+ for (int i = 0; i < widgetIdList.size(); i++) {
+ builder.append("[")
+ .append(widgetIdList.get(i))
+ .append(", ")
+ .append(widgetRestoreList.get(i))
+ .append(", ")
+ .append(widgetProfileIdList.get(i))
+ .append("]");
+ }
+ builder.append("]");
+ Log.d(TAG, "restoreAppWidgetIds: all widget ids in database: "
+ + builder.toString());
+ } catch (Exception ex) {
+ Log.e(TAG, "Getting widget ids from the database failed", ex);
+ }
+ }
}
diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java
index 617afcb292..c20494d604 100644
--- a/src/com/android/launcher3/LauncherModel.java
+++ b/src/com/android/launcher3/LauncherModel.java
@@ -20,6 +20,8 @@ import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURC
import static com.android.launcher3.LauncherAppState.ACTION_FORCE_ROLOAD;
import static com.android.launcher3.config.FeatureFlags.IS_STUDIO_BUILD;
+import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
+import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
@@ -560,6 +562,7 @@ public class LauncherModel extends LauncherApps.Callback implements InstallSessi
synchronized (mLock) {
// Everything loaded bind the data.
mModelLoaded = true;
+ testLogD(WORK_TAB_MISSING, "launcher model loaded");
}
}
diff --git a/src/com/android/launcher3/allapps/WorkModeSwitch.java b/src/com/android/launcher3/allapps/WorkModeSwitch.java
index ca16b24fe9..663fdb9822 100644
--- a/src/com/android/launcher3/allapps/WorkModeSwitch.java
+++ b/src/com/android/launcher3/allapps/WorkModeSwitch.java
@@ -97,7 +97,6 @@ public class WorkModeSwitch extends LinearLayout implements Insettable,
mTextView.setText(cache.workProfilePauseButton);
}
- mIcon.setColorFilter(mTextView.getCurrentTextColor());
getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
}
diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java
index 621c2abb90..f88ff86612 100644
--- a/src/com/android/launcher3/config/FeatureFlags.java
+++ b/src/com/android/launcher3/config/FeatureFlags.java
@@ -302,7 +302,7 @@ public final class FeatureFlags {
"Enable widget transition animation when resizing the widgets");
public static final BooleanFlag PREEMPTIVE_UNFOLD_ANIMATION_START = getDebugFlag(270397209,
- "PREEMPTIVE_UNFOLD_ANIMATION_START", ENABLED,
+ "PREEMPTIVE_UNFOLD_ANIMATION_START", DISABLED,
"Enables starting the unfold animation preemptively when unfolding, without"
+ "waiting for SystemUI and then merging the SystemUI progress whenever we "
+ "start receiving the events");
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index 2ce6c785c2..dd82ecfb95 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -273,6 +273,8 @@ public class FolderAnimationManager {
// {@link #onAnimationEnd} before B reads new UI state from {@link #onAnimationStart}.
a.addListener(new AnimatorListenerAdapter() {
private CellLayout mCellLayout;
+
+ private boolean mFolderClipChildren;
private boolean mFolderClipToPadding;
private boolean mContentClipChildren;
private boolean mContentClipToPadding;
@@ -283,12 +285,14 @@ public class FolderAnimationManager {
public void onAnimationStart(Animator animator) {
super.onAnimationStart(animator);
mCellLayout = mContent.getCurrentCellLayout();
+ mFolderClipChildren = mFolder.getClipChildren();
mFolderClipToPadding = mFolder.getClipToPadding();
mContentClipChildren = mContent.getClipChildren();
mContentClipToPadding = mContent.getClipToPadding();
mCellLayoutClipChildren = mCellLayout.getClipChildren();
mCellLayoutClipPadding = mCellLayout.getClipToPadding();
+ mFolder.setClipChildren(false);
mFolder.setClipToPadding(false);
mContent.setClipChildren(false);
mContent.setClipToPadding(false);
@@ -309,6 +313,7 @@ public class FolderAnimationManager {
mFolder.mFooter.setTranslationX(0f);
mFolder.mFolderName.setAlpha(1f);
+ mFolder.setClipChildren(mFolderClipChildren);
mFolder.setClipToPadding(mFolderClipToPadding);
mContent.setClipChildren(mContentClipChildren);
mContent.setClipToPadding(mContentClipToPadding);
diff --git a/src/com/android/launcher3/logging/FileLog.java b/src/com/android/launcher3/logging/FileLog.java
index cdd0bda49e..924a44062c 100644
--- a/src/com/android/launcher3/logging/FileLog.java
+++ b/src/com/android/launcher3/logging/FileLog.java
@@ -67,6 +67,26 @@ public final class FileLog {
print(tag, msg);
}
+ public static void i(String tag, String msg, Exception e) {
+ Log.i(tag, msg, e);
+ print(tag, msg, e);
+ }
+
+ public static void i(String tag, String msg) {
+ Log.i(tag, msg);
+ print(tag, msg);
+ }
+
+ public static void w(String tag, String msg, Exception e) {
+ Log.w(tag, msg, e);
+ print(tag, msg, e);
+ }
+
+ public static void w(String tag, String msg) {
+ Log.w(tag, msg);
+ print(tag, msg);
+ }
+
public static void e(String tag, String msg, Exception e) {
Log.e(tag, msg, e);
print(tag, msg, e);
diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java
index 15f353827e..17d3302e69 100644
--- a/src/com/android/launcher3/logging/StatsLogManager.java
+++ b/src/com/android/launcher3/logging/StatsLogManager.java
@@ -642,6 +642,9 @@ public class StatsLogManager implements ResourceBasedOverride {
@UiEvent(doc = "User has swiped upwards from the gesture handle to show transient taskbar.")
LAUNCHER_TRANSIENT_TASKBAR_SHOW(1331),
+
+ @UiEvent(doc = "App launched through pending intent")
+ LAUNCHER_APP_LAUNCH_PENDING_INTENT(1394),
;
// ADD MORE
diff --git a/src/com/android/launcher3/model/BaseLauncherBinder.java b/src/com/android/launcher3/model/BaseLauncherBinder.java
index ba9eb20073..85def73885 100644
--- a/src/com/android/launcher3/model/BaseLauncherBinder.java
+++ b/src/com/android/launcher3/model/BaseLauncherBinder.java
@@ -34,6 +34,7 @@ import com.android.launcher3.model.BgDataModel.FixedContainerItems;
import com.android.launcher3.model.data.AppInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
+import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.util.IntArray;
import com.android.launcher3.util.IntSet;
import com.android.launcher3.util.LooperExecutor;
@@ -267,18 +268,33 @@ public abstract class BaseLauncherBinder {
sortWorkspaceItemsSpatially(idp, currentWorkspaceItems);
sortWorkspaceItemsSpatially(idp, otherWorkspaceItems);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "Before posting startBinding");
+ }
// Tell the workspace that we're about to start binding items
executeCallbacksTask(c -> {
c.clearPendingBinds();
c.startBinding();
}, mUiExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "1");
+ }
// Bind workspace screens
executeCallbacksTask(c -> c.bindScreens(mOrderedScreenIds), mUiExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "2");
+ }
// Load items on the current page.
bindWorkspaceItems(currentWorkspaceItems, mUiExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "3");
+ }
bindAppWidgets(currentAppWidgets, mUiExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "4");
+ }
if (!FeatureFlags.CHANGE_MODEL_DELEGATE_LOADING_ORDER.get()) {
mExtraItems.forEach(item ->
executeCallbacksTask(c -> c.bindExtraContainerItems(item), mUiExecutor));
@@ -287,8 +303,18 @@ public abstract class BaseLauncherBinder {
RunnableList pendingTasks = new RunnableList();
Executor pendingExecutor = pendingTasks::add;
bindWorkspaceItems(otherWorkspaceItems, pendingExecutor);
+
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "5");
+ }
bindAppWidgets(otherAppWidgets, pendingExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "6");
+ }
executeCallbacksTask(c -> c.finishBindingItems(currentScreenIds), pendingExecutor);
+ if (TestProtocol.sDebugTracing) {
+ Log.d(TestProtocol.WORKSPACE_LOADS_FOREVER, "After posting finishBindingItems");
+ }
pendingExecutor.execute(
() -> {
MODEL_EXECUTOR.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
diff --git a/src/com/android/launcher3/model/BaseModelUpdateTask.java b/src/com/android/launcher3/model/BaseModelUpdateTask.java
index 70c98022fe..44d32d902a 100644
--- a/src/com/android/launcher3/model/BaseModelUpdateTask.java
+++ b/src/com/android/launcher3/model/BaseModelUpdateTask.java
@@ -16,6 +16,7 @@
package com.android.launcher3.model;
import static com.android.launcher3.testing.shared.TestProtocol.WORK_TAB_MISSING;
+import static com.android.launcher3.testing.shared.TestProtocol.testLogD;
import android.util.Log;
@@ -72,7 +73,9 @@ public abstract class BaseModelUpdateTask implements ModelUpdateTask {
@Override
public final void run() {
- if (!Objects.requireNonNull(mModel).isModelLoaded()) {
+ boolean isModelLoaded = Objects.requireNonNull(mModel).isModelLoaded();
+ testLogD(WORK_TAB_MISSING, "modelLoaded: " + isModelLoaded + " forTask: " + this);
+ if (!isModelLoaded) {
if (DEBUG_TASKS) {
Log.d(TAG, "Ignoring model task since loader is pending=" + this);
}
diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java
index a6e064a4ed..c554def0de 100644
--- a/src/com/android/launcher3/provider/RestoreDbTask.java
+++ b/src/com/android/launcher3/provider/RestoreDbTask.java
@@ -136,6 +136,7 @@ public class RestoreDbTask {
// Primary user ids
long myProfileId = controller.getSerialNumberForUser(myUserHandle());
long oldProfileId = getDefaultProfileId(db);
+ Log.d(TAG, "sanitizeDB: myProfileId=" + myProfileId + " oldProfileId=" + oldProfileId);
LongSparseArray<Long> oldManagedProfileIds = getManagedProfileIds(db, oldProfileId);
LongSparseArray<Long> profileMapping = new LongSparseArray<>(oldManagedProfileIds.size()
+ 1);
@@ -148,6 +149,8 @@ public class RestoreDbTask {
if (user != null) {
long newManagedProfileId = controller.getSerialNumberForUser(user);
profileMapping.put(oldManagedProfileId, newManagedProfileId);
+ Log.d(TAG, "sanitizeDB: managed profile id=" + oldManagedProfileId
+ + " should be mapped to new id=" + newManagedProfileId);
}
}
diff --git a/src/com/android/launcher3/util/ContentWriter.java b/src/com/android/launcher3/util/ContentWriter.java
index 7c5ef4db0c..9910dc2e70 100644
--- a/src/com/android/launcher3/util/ContentWriter.java
+++ b/src/com/android/launcher3/util/ContentWriter.java
@@ -106,7 +106,7 @@ public class ContentWriter {
public int commit() {
if (mCommitParams != null) {
- mCommitParams.mDbController.update(
+ return mCommitParams.mDbController.update(
Favorites.TABLE_NAME, getValues(mContext),
mCommitParams.mWhere, mCommitParams.mSelectionArgs);
}
diff --git a/src/com/android/launcher3/util/DisplayController.java b/src/com/android/launcher3/util/DisplayController.java
index 776fe40f05..6647d0db7c 100644
--- a/src/com/android/launcher3/util/DisplayController.java
+++ b/src/com/android/launcher3/util/DisplayController.java
@@ -48,6 +48,7 @@ import androidx.annotation.VisibleForTesting;
import com.android.launcher3.LauncherPrefs;
import com.android.launcher3.Utilities;
+import com.android.launcher3.logging.FileLog;
import com.android.launcher3.util.window.CachedDisplayInfo;
import com.android.launcher3.util.window.WindowManagerProxy;
@@ -126,6 +127,8 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
Context displayInfoContext = getDisplayInfoContext(display);
mInfo = new Info(displayInfoContext, wmProxy,
wmProxy.estimateInternalDisplayBounds(displayInfoContext));
+ mInfo.mPerDisplayBounds.forEach((key, value) -> FileLog.i(TAG,
+ "(CTOR) perDisplayBounds - " + key + ": " + Arrays.deepToString(value)));
}
/**
@@ -283,6 +286,9 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
if (!newInfo.supportedBounds.equals(oldInfo.supportedBounds)
|| !newInfo.mPerDisplayBounds.equals(oldInfo.mPerDisplayBounds)) {
change |= CHANGE_SUPPORTED_BOUNDS;
+ newInfo.mPerDisplayBounds.forEach((key, value) -> FileLog.w(TAG,
+ "(CHANGE_SUPPORTED_BOUNDS) perDisplayBounds - " + key + ": "
+ + Arrays.deepToString(value)));
}
if (DEBUG) {
Log.d(TAG, "handleInfoChange - change: " + getChangeFlagsString(change));
@@ -353,12 +359,16 @@ public class DisplayController implements ComponentCallbacks, SafeCloseable {
realBounds = wmProxy.getRealBounds(displayInfoContext, displayInfo);
if (cachedValue == null) {
// Unexpected normalizedDisplayInfo is found, recreate the cache
- Log.e(TAG, "Unexpected normalizedDisplayInfo found, invalidating cache");
+ FileLog.e(TAG, "Unexpected normalizedDisplayInfo found, invalidating cache: "
+ + normalizedDisplayInfo);
+ mPerDisplayBounds.forEach((key, value) -> FileLog.e(TAG,
+ "(Invalid Cache) perDisplayBounds - " + key + ": " + Arrays.deepToString(
+ value)));
mPerDisplayBounds.clear();
mPerDisplayBounds.putAll(wmProxy.estimateInternalDisplayBounds(displayInfoContext));
cachedValue = mPerDisplayBounds.get(normalizedDisplayInfo);
if (cachedValue == null) {
- Log.e(TAG, "normalizedDisplayInfo not found in estimation: "
+ FileLog.e(TAG, "normalizedDisplayInfo not found in estimation: "
+ normalizedDisplayInfo);
supportedBounds.add(realBounds);
}
diff --git a/src/com/android/launcher3/views/ActivityContext.java b/src/com/android/launcher3/views/ActivityContext.java
index 515a2d81a5..4b319e5b61 100644
--- a/src/com/android/launcher3/views/ActivityContext.java
+++ b/src/com/android/launcher3/views/ActivityContext.java
@@ -20,6 +20,7 @@ import static android.window.SplashScreen.SPLASH_SCREEN_STYLE_SOLID_COLOR;
import static com.android.launcher3.LauncherSettings.Animation.DEFAULT_NO_ICON;
import static com.android.launcher3.logging.KeyboardStateManager.KeyboardState.HIDE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_PENDING_INTENT;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP;
import static com.android.launcher3.model.WidgetsModel.GO_DISABLE_WIDGETS;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
@@ -305,6 +306,11 @@ public interface ActivityContext {
ActivityOptionsWrapper options = getActivityLaunchOptions(v, item);
try {
intent.send(null, 0, null, null, null, null, options.toBundle());
+ if (item != null) {
+ InstanceId instanceId = new InstanceIdSequence().newInstanceId();
+ getStatsLogManager().logger().withItemInfo(item).withInstanceId(instanceId)
+ .log(LAUNCHER_APP_LAUNCH_PENDING_INTENT);
+ }
return options.onEndCallback;
} catch (PendingIntent.CanceledException e) {
Toast.makeText(v.getContext(),
diff --git a/src/com/android/launcher3/views/Snackbar.java b/src/com/android/launcher3/views/Snackbar.java
index 8d5838e592..2460be17c5 100644
--- a/src/com/android/launcher3/views/Snackbar.java
+++ b/src/com/android/launcher3/views/Snackbar.java
@@ -65,9 +65,26 @@ public class Snackbar extends AbstractFloatingView {
show(activity, labelStringRedId, NO_ID, onDismissed, null);
}
+ /** Show a snackbar with just a label. */
+ public static <T extends Context & ActivityContext> void show(T activity, String labelString,
+ Runnable onDismissed) {
+ show(activity, labelString, NO_ID, onDismissed, null);
+ }
+
/** Show a snackbar with a label and action. */
public static <T extends Context & ActivityContext> void show(T activity, int labelStringResId,
int actionStringResId, Runnable onDismissed, @Nullable Runnable onActionClicked) {
+ show(
+ activity,
+ activity.getResources().getString(labelStringResId),
+ actionStringResId,
+ onDismissed,
+ onActionClicked);
+ }
+
+ /** Show a snackbar with a label and action. */
+ public static <T extends Context & ActivityContext> void show(T activity, String labelString,
+ int actionStringResId, Runnable onDismissed, @Nullable Runnable onActionClicked) {
closeOpenViews(activity, true, TYPE_SNACKBAR);
Snackbar snackbar = new Snackbar(activity, null);
// Set some properties here since inflated xml only contains the children.
@@ -105,8 +122,7 @@ public class Snackbar extends AbstractFloatingView {
: insets.bottom));
TextView labelView = snackbar.findViewById(R.id.label);
- String labelText = res.getString(labelStringResId);
- labelView.setText(labelText);
+ labelView.setText(labelString);
TextView actionView = snackbar.findViewById(R.id.action);
float actionWidth;
@@ -127,7 +143,7 @@ public class Snackbar extends AbstractFloatingView {
actionView.setVisibility(GONE);
}
- int totalContentWidth = (int) (labelView.getPaint().measureText(labelText) + actionWidth)
+ int totalContentWidth = (int) (labelView.getPaint().measureText(labelString) + actionWidth)
+ labelView.getPaddingRight() + labelView.getPaddingLeft()
+ padding * 2;
if (totalContentWidth > params.width) {
diff --git a/src/com/android/launcher3/widget/BaseLauncherAppWidgetHostView.java b/src/com/android/launcher3/widget/BaseLauncherAppWidgetHostView.java
index 2742882b1f..580b4f11ea 100644
--- a/src/com/android/launcher3/widget/BaseLauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/widget/BaseLauncherAppWidgetHostView.java
@@ -105,6 +105,7 @@ public abstract class BaseLauncherAppWidgetHostView extends NavigableAppWidgetHo
mEnforcedRectangle);
setOutlineProvider(mCornerRadiusEnforcementOutline);
setClipToOutline(true);
+ invalidateOutline();
}
/** Returns the corner radius currently enforced, in pixels. */
diff --git a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
index 723ea17147..8dd1de4ac8 100644
--- a/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
+++ b/src/com/android/launcher3/widget/picker/WidgetsListAdapter.java
@@ -42,7 +42,6 @@ import androidx.recyclerview.widget.RecyclerView.Adapter;
import androidx.recyclerview.widget.RecyclerView.ViewHolder;
import com.android.launcher3.R;
-import com.android.launcher3.model.data.PackageItemInfo;
import com.android.launcher3.recyclerview.ViewHolderBinder;
import com.android.launcher3.util.LabelComparator;
import com.android.launcher3.util.PackageUserKey;
@@ -58,7 +57,6 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
-import java.util.Map;
import java.util.OptionalInt;
import java.util.function.IntSupplier;
import java.util.function.Predicate;
@@ -174,9 +172,6 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
mAllEntries.clear();
mAllEntries.add(new WidgetListSpaceEntry());
tempEntries.stream().sorted(mRowComparator).forEach(mAllEntries::add);
- if (shouldClearVisibleEntries()) {
- mVisibleEntries.clear();
- }
updateVisibleEntries();
}
@@ -426,29 +421,6 @@ public class WidgetsListAdapter extends Adapter<ViewHolder> implements OnHeaderC
updateVisibleEntries();
}
- /**
- * Returns {@code true} if there is a change in {@link #mAllEntries} that results in an
- * invalidation of {@link #mVisibleEntries}. e.g. there is change in the device language.
- */
- private boolean shouldClearVisibleEntries() {
- Map<PackageUserKey, PackageItemInfo> packagesInfo =
- mAllEntries.stream()
- .filter(entry -> entry instanceof WidgetsListHeaderEntry)
- .map(entry -> entry.mPkgItem)
- .collect(Collectors.toMap(
- entry -> PackageUserKey.fromPackageItemInfo(entry),
- entry -> entry));
- for (WidgetsListBaseEntry visibleEntry: mVisibleEntries) {
- PackageUserKey key = PackageUserKey.fromPackageItemInfo(visibleEntry.mPkgItem);
- PackageItemInfo packageItemInfo = packagesInfo.get(key);
- if (packageItemInfo != null
- && !visibleEntry.mPkgItem.title.equals(packageItemInfo.title)) {
- return true;
- }
- }
- return false;
- }
-
/** Comparator for sorting WidgetListRowEntry based on package title. */
public static class WidgetListBaseRowEntryComparator implements
Comparator<WidgetsListBaseEntry> {