Search in sources :

Example 41 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_404Launcher by P-404.

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);
}
Also used : ViewGroup(android.view.ViewGroup) DragObject(com.android.launcher3.DropTarget.DragObject) ActivityNotFoundException(android.content.ActivityNotFoundException)

Example 42 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_404Launcher by P-404.

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;
}
Also used : Rect(android.graphics.Rect) Bundle(android.os.Bundle) AccessibilityDelegate(android.view.View.AccessibilityDelegate) KeyboardDragAndDropView(com.android.launcher3.keyboard.KeyboardDragAndDropView) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) BubbleTextView(com.android.launcher3.BubbleTextView) OptionsPopupView(com.android.launcher3.views.OptionsPopupView) IGNORE(com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE) Handler(android.os.Handler) AccessibilityAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction) FolderInfo(com.android.launcher3.model.data.FolderInfo) View(android.view.View) ButtonDropTarget(com.android.launcher3.ButtonDropTarget) Log(android.util.Log) PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) RectF(android.graphics.RectF) ACTION_LONG_CLICK(android.view.accessibility.AccessibilityNodeInfo.ACTION_LONG_CLICK) Launcher(com.android.launcher3.Launcher) Favorites(com.android.launcher3.LauncherSettings.Favorites) DragOptions(com.android.launcher3.dragndrop.DragOptions) SparseArray(android.util.SparseArray) WidgetSizes(com.android.launcher3.widget.util.WidgetSizes) List(java.util.List) NotificationListener(com.android.launcher3.notification.NotificationListener) ShortcutUtil(com.android.launcher3.util.ShortcutUtil) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) Workspace(com.android.launcher3.Workspace) NORMAL(com.android.launcher3.LauncherState.NORMAL) Folder(com.android.launcher3.folder.Folder) AccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) ArrowPopup(com.android.launcher3.popup.ArrowPopup) KeyEvent(android.view.KeyEvent) AppInfo(com.android.launcher3.model.data.AppInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) ArrayList(java.util.ArrayList) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) ItemLongClickListener(com.android.launcher3.touch.ItemLongClickListener) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AnimatorListeners.forSuccessCallback(com.android.launcher3.anim.AnimatorListeners.forSuccessCallback) DragObject(com.android.launcher3.DropTarget.DragObject) DragListener(com.android.launcher3.dragndrop.DragController.DragListener) IntArray(com.android.launcher3.util.IntArray) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) Point(android.graphics.Point) TextUtils(android.text.TextUtils) CellLayout(com.android.launcher3.CellLayout) OptionItem(com.android.launcher3.views.OptionsPopupView.OptionItem) IntSet(com.android.launcher3.util.IntSet) R(com.android.launcher3.R) Thunk(com.android.launcher3.util.Thunk) Collections(java.util.Collections) DragView(com.android.launcher3.dragndrop.DragView) OptionItem(com.android.launcher3.views.OptionsPopupView.OptionItem) CellLayout(com.android.launcher3.CellLayout) ArrayList(java.util.ArrayList) AppWidgetProviderInfo(android.appwidget.AppWidgetProviderInfo) DragView(com.android.launcher3.dragndrop.DragView) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView)

Example 43 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by crdroidandroid.

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");
    try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
        List<ShortcutInfo> allShortcuts = new ArrayList<>();
        loadWorkspace(allShortcuts);
        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();
        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
        List<LauncherActivityInfo> allActivityList = loadAllApps();
        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();
    } catch (CancellationException e) {
        // Loader stopped, ignore
        logASplit(logger, "Cancelled");
    } finally {
        logger.dumpToLog();
    }
    TraceHelper.INSTANCE.endSection(traceToken);
}
Also used : LauncherModel(com.android.launcher3.LauncherModel) ShortcutInfo(android.content.pm.ShortcutInfo) ArrayList(java.util.ArrayList) ShortcutCachingLogic(com.android.launcher3.icons.ShortcutCachingLogic) ComponentWithIconCachingLogic(com.android.launcher3.icons.ComponentWithLabelAndIcon.ComponentWithIconCachingLogic) TimingLogger(android.util.TimingLogger) CancellationException(java.util.concurrent.CancellationException) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) ComponentWithLabelAndIcon(com.android.launcher3.icons.ComponentWithLabelAndIcon) IconCacheUpdateHandler(com.android.launcher3.icons.cache.IconCacheUpdateHandler)

Example 44 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by crdroidandroid.

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;
    }
}
Also used : ShortcutInfo(android.content.pm.ShortcutInfo) ShortcutCachingLogic(com.android.launcher3.icons.ShortcutCachingLogic) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) TargetApi(android.annotation.TargetApi) Nullable(androidx.annotation.Nullable)

Example 45 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project android_packages_apps_Launcher3 by crdroidandroid.

the class DragView method crossFadeContent.

public void crossFadeContent(Drawable crossFadeDrawable, int duration) {
    if (mContent.getParent() == null) {
        // If the content is already removed, ignore
        return;
    }
    View newContent = getViewFromDrawable(getContext(), crossFadeDrawable);
    newContent.measure(makeMeasureSpec(mWidth, EXACTLY), makeMeasureSpec(mHeight, EXACTLY));
    newContent.layout(0, 0, mWidth, mHeight);
    addViewInLayout(newContent, 0, new LayoutParams(mWidth, mHeight));
    AnimatorSet anim = new AnimatorSet();
    anim.play(ObjectAnimator.ofFloat(newContent, VIEW_ALPHA, 0, 1));
    anim.play(ObjectAnimator.ofFloat(mContent, VIEW_ALPHA, 0));
    anim.setDuration(duration).setInterpolator(Interpolators.DEACCEL_1_5);
    anim.start();
}
Also used : AnimatorSet(android.animation.AnimatorSet) ImageView(android.widget.ImageView) View(android.view.View) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView)

Aggregations

Ignore (org.junit.Ignore)17 Test (org.junit.Test)17 LargeTest (androidx.test.filters.LargeTest)16 ShortcutInfo (android.content.pm.ShortcutInfo)13 Point (android.graphics.Point)12 DragObject (com.android.launcher3.DropTarget.DragObject)12 ShortcutCachingLogic (com.android.launcher3.icons.ShortcutCachingLogic)12 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)12 Rect (android.graphics.Rect)11 DeviceProfile (com.android.launcher3.DeviceProfile)11 ItemInfo (com.android.launcher3.model.data.ItemInfo)11 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)11 ArrayList (java.util.ArrayList)11 AppInfo (com.android.launcher3.model.data.AppInfo)10 View (android.view.View)8 ActivityNotFoundException (android.content.ActivityNotFoundException)7 LauncherActivityInfo (android.content.pm.LauncherActivityInfo)7 ViewGroup (android.view.ViewGroup)7 AllApps (com.android.launcher3.tapl.AllApps)7 TargetApi (android.annotation.TargetApi)6