feat: Better At-a-Glance perceptive wallpaper colour luminance detection
This commit is contained in:
@@ -144,8 +144,8 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportedAccessibilityAction(ItemInfo info, View view) {
|
||||
return getButtonType(info, view);
|
||||
public boolean supportsAccessibilityDrop(ItemInfo info, View view) {
|
||||
return getButtonType(info, view) != INVALID;
|
||||
}
|
||||
|
||||
private int getButtonType(ItemInfo info, View view) {
|
||||
@@ -155,8 +155,10 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
}
|
||||
return INVALID;
|
||||
} else if (info.isPredictedItem()) {
|
||||
// For predicted apps we show only one drop target "cancel" and no secondary drop target
|
||||
return INVALID;
|
||||
if (Flags.enableShortcutDontSuggestApp()) {
|
||||
return INVALID;
|
||||
}
|
||||
return DISMISS_PREDICTION;
|
||||
}
|
||||
|
||||
Boolean uninstallDisabled = mUninstallDisabledCache.get(info.user);
|
||||
@@ -220,17 +222,17 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
d.dragSource = new DeferredOnComplete(d.dragSource, getContext());
|
||||
|
||||
super.onDrop(d, options);
|
||||
doLog(d.logInstanceId, d.originalDragInfo, mCurrentAccessibilityAction);
|
||||
doLog(d.logInstanceId, d.originalDragInfo);
|
||||
}
|
||||
|
||||
private void doLog(InstanceId logInstanceId, ItemInfo itemInfo, int action) {
|
||||
private void doLog(InstanceId logInstanceId, ItemInfo itemInfo) {
|
||||
StatsLogger logger = mStatsLogManager.logger().withInstanceId(logInstanceId);
|
||||
if (itemInfo != null) {
|
||||
logger.withItemInfo(itemInfo);
|
||||
}
|
||||
if (action == UNINSTALL) {
|
||||
if (mCurrentAccessibilityAction == UNINSTALL) {
|
||||
logger.log(LAUNCHER_ITEM_DROPPED_ON_UNINSTALL);
|
||||
} else if (action == DISMISS_PREDICTION) {
|
||||
} else if (mCurrentAccessibilityAction == DISMISS_PREDICTION) {
|
||||
logger.log(LAUNCHER_ITEM_DROPPED_ON_DONT_SUGGEST);
|
||||
}
|
||||
}
|
||||
@@ -270,11 +272,7 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
* the action was not performed.
|
||||
*/
|
||||
protected ComponentName performDropAction(View view, ItemInfo info) {
|
||||
return performDropAction(view, info, mCurrentAccessibilityAction);
|
||||
}
|
||||
|
||||
private ComponentName performDropAction(View view, ItemInfo info, int action) {
|
||||
if (action == RECONFIGURE) {
|
||||
if (mCurrentAccessibilityAction == RECONFIGURE) {
|
||||
int widgetId = getReconfigurableWidgetId(view);
|
||||
if (widgetId != INVALID_APPWIDGET_ID) {
|
||||
mDropTargetHandler.reconfigureWidget(widgetId, info);
|
||||
@@ -315,9 +313,9 @@ public class SecondaryDropTarget extends ButtonDropTarget implements OnAlarmList
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAccessibilityDrop(View view, ItemInfo item, int action) {
|
||||
doLog(new InstanceIdSequence().newInstanceId(), item, action);
|
||||
performDropAction(view, item, action);
|
||||
public void onAccessibilityDrop(View view, ItemInfo item) {
|
||||
doLog(new InstanceIdSequence().newInstanceId(), item);
|
||||
performDropAction(view, item);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user