use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class LauncherAccessibilityDelegate method getSupportedResizeActions.
private List<OptionItem> getSupportedResizeActions(View host, LauncherAppWidgetInfo info) {
List<OptionItem> actions = new ArrayList<>();
AppWidgetProviderInfo providerInfo = ((LauncherAppWidgetHostView) host).getAppWidgetInfo();
if (providerInfo == null) {
return actions;
}
CellLayout layout;
if (host.getParent() instanceof DragView) {
layout = (CellLayout) ((DragView) host.getParent()).getContentViewParent().getParent();
} else {
layout = (CellLayout) host.getParent().getParent();
}
if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_HORIZONTAL) != 0) {
if (layout.isRegionVacant(info.cellX + info.spanX, info.cellY, 1, info.spanY) || layout.isRegionVacant(info.cellX - 1, info.cellY, 1, info.spanY)) {
actions.add(new OptionItem(mLauncher, R.string.action_increase_width, R.drawable.ic_widget_width_increase, IGNORE, v -> performResizeAction(R.string.action_increase_width, host, info)));
}
if (info.spanX > info.minSpanX && info.spanX > 1) {
actions.add(new OptionItem(mLauncher, R.string.action_decrease_width, R.drawable.ic_widget_width_decrease, IGNORE, v -> performResizeAction(R.string.action_decrease_width, host, info)));
}
}
if ((providerInfo.resizeMode & AppWidgetProviderInfo.RESIZE_VERTICAL) != 0) {
if (layout.isRegionVacant(info.cellX, info.cellY + info.spanY, info.spanX, 1) || layout.isRegionVacant(info.cellX, info.cellY - 1, info.spanX, 1)) {
actions.add(new OptionItem(mLauncher, R.string.action_increase_height, R.drawable.ic_widget_height_increase, IGNORE, v -> performResizeAction(R.string.action_increase_height, host, info)));
}
if (info.spanY > info.minSpanY && info.spanY > 1) {
actions.add(new OptionItem(mLauncher, R.string.action_decrease_height, R.drawable.ic_widget_height_decrease, IGNORE, v -> performResizeAction(R.string.action_decrease_height, host, info)));
}
}
return actions;
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class Launcher method dump.
/**
* $ adb shell dumpsys activity com.android.launcher3.Launcher [--all]
*/
@Override
public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
super.dump(prefix, fd, writer, args);
if (args.length > 0 && TextUtils.equals(args[0], "--all")) {
writer.println(prefix + "Workspace Items");
for (int i = 0; i < mWorkspace.getPageCount(); i++) {
writer.println(prefix + " Homescreen " + i);
ViewGroup layout = ((CellLayout) mWorkspace.getPageAt(i)).getShortcutsAndWidgets();
for (int j = 0; j < layout.getChildCount(); j++) {
Object tag = layout.getChildAt(j).getTag();
if (tag != null) {
writer.println(prefix + " " + tag.toString());
}
}
}
writer.println(prefix + " Hotseat");
ViewGroup layout = mHotseat.getShortcutsAndWidgets();
for (int j = 0; j < layout.getChildCount(); j++) {
Object tag = layout.getChildAt(j).getTag();
if (tag != null) {
writer.println(prefix + " " + tag.toString());
}
}
}
writer.println(prefix + "Misc:");
dumpMisc(prefix + "\t", writer);
writer.println(prefix + "\tmWorkspaceLoading=" + mWorkspaceLoading);
writer.println(prefix + "\tmPendingRequestArgs=" + mPendingRequestArgs + " mPendingActivityResult=" + mPendingActivityResult);
writer.println(prefix + "\tmRotationHelper: " + mRotationHelper);
writer.println(prefix + "\tmAppWidgetHost.isListening: " + mAppWidgetHost.isListening());
// Extra logging for general debugging
mDragLayer.dump(prefix, writer);
mStateManager.dump(prefix, writer);
mPopupDataProvider.dump(prefix, writer);
mDeviceProfile.dump(prefix, writer);
try {
FileLog.flushAll(writer);
} catch (Exception e) {
// Ignore
}
mModel.dumpState(prefix, fd, writer, args);
if (mLauncherCallbacks != null) {
mLauncherCallbacks.dump(prefix, fd, writer, args);
}
mOverlayManager.dump(prefix, writer);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class LauncherAppWidgetProviderInfo method initSpans.
public void initSpans(Context context, InvariantDeviceProfile idp) {
int minSpanX = 0;
int minSpanY = 0;
int maxSpanX = idp.numColumns;
int maxSpanY = idp.numRows;
int spanX = 0;
int spanY = 0;
Rect widgetPadding = new Rect();
Rect localPadding = new Rect();
AppWidgetHostView.getDefaultPaddingForWidget(context, provider, widgetPadding);
Point cellSize = new Point();
for (DeviceProfile dp : idp.supportedProfiles) {
dp.getCellSize(cellSize);
// If grids supports insetting widgets, we do not account for widget padding.
if (dp.shouldInsetWidgets()) {
localPadding.setEmpty();
} else {
localPadding.set(widgetPadding);
}
minSpanX = Math.max(minSpanX, getSpanX(localPadding, minResizeWidth, dp.cellLayoutBorderSpacePx.x, cellSize.x));
minSpanY = Math.max(minSpanY, getSpanY(localPadding, minResizeHeight, dp.cellLayoutBorderSpacePx.y, cellSize.y));
if (ATLEAST_S) {
if (maxResizeWidth > 0) {
maxSpanX = Math.min(maxSpanX, getSpanX(localPadding, maxResizeWidth, dp.cellLayoutBorderSpacePx.x, cellSize.x));
}
if (maxResizeHeight > 0) {
maxSpanY = Math.min(maxSpanY, getSpanY(localPadding, maxResizeHeight, dp.cellLayoutBorderSpacePx.y, cellSize.y));
}
}
spanX = Math.max(spanX, getSpanX(localPadding, minWidth, dp.cellLayoutBorderSpacePx.x, cellSize.x));
spanY = Math.max(spanY, getSpanY(localPadding, minHeight, dp.cellLayoutBorderSpacePx.y, cellSize.y));
}
if (ATLEAST_S) {
// Ensures maxSpan >= minSpan
maxSpanX = Math.max(maxSpanX, minSpanX);
maxSpanY = Math.max(maxSpanY, minSpanY);
// Otherwise, use the span of minWidth/Height.
if (targetCellWidth >= minSpanX && targetCellWidth <= maxSpanX && targetCellHeight >= minSpanY && targetCellHeight <= maxSpanY) {
spanX = targetCellWidth;
spanY = targetCellHeight;
}
}
// If minSpanX/Y > spanX/Y, ignore the minSpanX/Y to match the behavior described in
// minResizeWidth & minResizeHeight Android documentation. See
// https://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo
this.minSpanX = Math.min(spanX, minSpanX);
this.minSpanY = Math.min(spanY, minSpanY);
this.maxSpanX = maxSpanX;
this.maxSpanY = maxSpanY;
this.mIsMinSizeFulfilled = Math.min(spanX, minSpanX) <= idp.numColumns && Math.min(spanY, minSpanY) <= idp.numRows;
// Ensures the default span X and span Y will not exceed the current grid size.
this.spanX = Math.min(spanX, idp.numColumns);
this.spanY = Math.min(spanY, idp.numRows);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class TaplTestsQuickstep method testPressBack.
// TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
// after the bug resolved.
@Ignore("b/205027405")
@Test
@PortraitLandscape
@ScreenRecord
public void testPressBack() throws Exception {
mLauncher.getWorkspace().switchToAllApps();
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
} finally {
allApps.unfreeze();
}
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class TaplTestsLauncher3 method testPressBack.
@Ignore("b/205027405")
@Test
@PortraitLandscape
public void testPressBack() throws Exception {
mLauncher.getWorkspace().switchToAllApps();
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
} finally {
allApps.unfreeze();
}
mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
mLauncher.pressBack();
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
}
Aggregations