use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ArrowOS.
the class LoaderTask method run.
public void run() {
synchronized (this) {
// Skip fast if we are already stopped.
if (mStopped) {
return;
}
}
Object traceToken = TraceHelper.INSTANCE.beginSection(TAG);
TimingLogger logger = new TimingLogger(TAG, "run");
LoaderMemoryLogger memoryLogger = new LoaderMemoryLogger();
try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
List<ShortcutInfo> allShortcuts = new ArrayList<>();
Trace.beginSection("LoadWorkspace");
try {
loadWorkspace(allShortcuts, memoryLogger);
} finally {
Trace.endSection();
}
logASplit(logger, "loadWorkspace");
// (e.g. both grid preview and minimal device mode uses a different db)
if (mApp.getInvariantDeviceProfile().dbFile.equals(mDbName)) {
verifyNotStopped();
sanitizeData();
logASplit(logger, "sanitizeData");
}
verifyNotStopped();
mResults.bindWorkspace(true);
logASplit(logger, "bindWorkspace");
mModelDelegate.workspaceLoadComplete();
// Notify the installer packages of packages with active installs on the first screen.
sendFirstScreenActiveInstallsBroadcast();
logASplit(logger, "sendFirstScreenActiveInstallsBroadcast");
// Take a break
waitForIdle();
logASplit(logger, "step 1 complete");
verifyNotStopped();
// second step
Trace.beginSection("LoadAllApps");
List<LauncherActivityInfo> allActivityList;
try {
allActivityList = loadAllApps();
} finally {
Trace.endSection();
}
logASplit(logger, "loadAllApps");
verifyNotStopped();
mResults.bindAllApps();
logASplit(logger, "bindAllApps");
verifyNotStopped();
IconCacheUpdateHandler updateHandler = mIconCache.getUpdateHandler();
setIgnorePackages(updateHandler);
updateHandler.updateIcons(allActivityList, LauncherActivityCachingLogic.newInstance(mApp.getContext()), mApp.getModel()::onPackageIconsUpdated);
logASplit(logger, "update icon cache");
if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
verifyNotStopped();
logASplit(logger, "save shortcuts in icon cache");
updateHandler.updateIcons(allShortcuts, new ShortcutCachingLogic(), mApp.getModel()::onPackageIconsUpdated);
}
// Take a break
waitForIdle();
logASplit(logger, "step 2 complete");
verifyNotStopped();
// third step
List<ShortcutInfo> allDeepShortcuts = loadDeepShortcuts();
logASplit(logger, "loadDeepShortcuts");
verifyNotStopped();
mResults.bindDeepShortcuts();
logASplit(logger, "bindDeepShortcuts");
if (FeatureFlags.ENABLE_DEEP_SHORTCUT_ICON_CACHE.get()) {
verifyNotStopped();
logASplit(logger, "save deep shortcuts in icon cache");
updateHandler.updateIcons(allDeepShortcuts, new ShortcutCachingLogic(), (pkgs, user) -> {
});
}
// Take a break
waitForIdle();
logASplit(logger, "step 3 complete");
verifyNotStopped();
// fourth step
List<ComponentWithLabelAndIcon> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null);
logASplit(logger, "load widgets");
verifyNotStopped();
mResults.bindWidgets();
logASplit(logger, "bindWidgets");
verifyNotStopped();
updateHandler.updateIcons(allWidgetsList, new ComponentWithIconCachingLogic(mApp.getContext(), true), mApp.getModel()::onWidgetLabelsUpdated);
logASplit(logger, "save widgets in icon cache");
// fifth step
if (FeatureFlags.FOLDER_NAME_SUGGEST.get()) {
loadFolderNames();
}
verifyNotStopped();
updateHandler.finish();
logASplit(logger, "finish icon update");
mModelDelegate.modelLoadComplete();
transaction.commit();
memoryLogger.clearLogs();
} catch (CancellationException e) {
// Loader stopped, ignore
logASplit(logger, "Cancelled");
} catch (Exception e) {
memoryLogger.printLogs();
throw e;
} finally {
logger.dumpToLog();
}
TraceHelper.INSTANCE.endSection(traceToken);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ArrowOS.
the class AbsSwipeUpHandler method doLogGesture.
private void doLogGesture(GestureEndTarget endTarget, @Nullable TaskView targetTask) {
StatsLogManager.EventEnum event;
switch(endTarget) {
case HOME:
event = LAUNCHER_HOME_GESTURE;
break;
case RECENTS:
event = LAUNCHER_OVERVIEW_GESTURE;
break;
case LAST_TASK:
case NEW_TASK:
event = mLogDirectionUpOrLeft ? LAUNCHER_QUICKSWITCH_LEFT : LAUNCHER_QUICKSWITCH_RIGHT;
break;
default:
event = IGNORE;
}
StatsLogger logger = StatsLogManager.newInstance(mContext).logger().withSrcState(LAUNCHER_STATE_BACKGROUND).withDstState(endTarget.containerType);
if (targetTask != null) {
logger.withItemInfo(targetTask.getItemInfo());
}
DeviceProfile dp = mDp;
if (dp == null || mDownPos == null) {
// We probably never received an animation controller, skip logging.
return;
}
int pageIndex = endTarget == LAST_TASK ? LOG_NO_OP_PAGE_INDEX : mRecentsView.getNextPage();
// TODO: set correct container using the pageIndex
logger.log(event);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ArrowOS.
the class TaplTestsLauncher3 method testDragToFolder.
@Ignore("b/205014516")
@Test
@PortraitLandscape
public void testDragToFolder() throws Exception {
final AppIcon playStoreIcon = createShortcutIfNotExist("Play Store");
final AppIcon gmailIcon = createShortcutIfNotExist("Gmail");
FolderIcon folderIcon = gmailIcon.dragToIcon(playStoreIcon);
Folder folder = folderIcon.open();
folder.getAppIcon("Play Store");
folder.getAppIcon("Gmail");
Workspace workspace = folder.close();
assertNull("Gmail should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Gmail"));
assertNull("Play Store should be moved to a folder.", workspace.tryGetWorkspaceAppIcon("Play Store"));
final AppIcon youTubeIcon = createShortcutIfNotExist("YouTube");
folderIcon = youTubeIcon.dragToIcon(folderIcon);
folder = folderIcon.open();
folder.getAppIcon("YouTube");
folder.close();
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ArrowOS.
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);
}
use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by ProtonAOSP.
the class PinRequestHelper method createWorkspaceItemFromPinItemRequest.
/**
* request.accept() will initiate the following flow:
* -> go-to-system-process for actual processing (a)
* -> callback-to-launcher on UI thread (b)
* -> post callback on the worker thread (c)
* -> Update model and unpin (in system) any shortcut not in out model. (d)
*
* Note that (b) will take at-least one frame as it involves posting callback from binder
* thread to UI thread.
* If (d) happens before we add this shortcut to our model, we will end up unpinning
* the shortcut in the system.
* Here its the caller's responsibility to add the newly created WorkspaceItemInfo immediately
* to the model (which may involves a single post-to-worker-thread). That will guarantee
* that (d) happens after model is updated.
*/
@Nullable
@TargetApi(Build.VERSION_CODES.O)
public static WorkspaceItemInfo createWorkspaceItemFromPinItemRequest(Context context, final PinItemRequest request, final long acceptDelay) {
if (request != null && request.getRequestType() == PinItemRequest.REQUEST_TYPE_SHORTCUT && request.isValid()) {
if (acceptDelay <= 0) {
if (!request.accept()) {
return null;
}
} else {
// Block the worker thread until the accept() is called.
MODEL_EXECUTOR.execute(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(acceptDelay);
} catch (InterruptedException e) {
// Ignore
}
if (request.isValid()) {
request.accept();
}
}
});
}
ShortcutInfo si = request.getShortcutInfo();
WorkspaceItemInfo info = new WorkspaceItemInfo(si, context);
// Apply the unbadged icon synchronously using the caching logic directly and
// fetch the actual icon asynchronously.
info.bitmap = new ShortcutCachingLogic().loadIcon(context, si);
LauncherAppState.getInstance(context).getModel().updateAndBindWorkspaceItem(info, si);
return info;
} else {
return null;
}
}
Aggregations