Search in sources :

Example 6 with IGNORE

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

the class WorkTabTest method testWorkEduFlow.

@Ignore("b/182844465")
@Test
public void testWorkEduFlow() {
    mDevice.pressHome();
    waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
    executeOnLauncher(launcher -> launcher.getSharedPrefs().edit().remove(WorkEduView.KEY_WORK_EDU_STEP).remove(WorkEduView.KEY_LEGACY_WORK_EDU_SEEN).commit());
    waitForLauncherCondition("Work tab not setup", launcher -> {
        if (launcher.getAppsView().getContentView() instanceof AllAppsPagedView) {
            launcher.getAppsView().getAppsStore().enableDeferUpdates(DEFER_UPDATES_TEST);
            return true;
        }
        return false;
    }, LauncherInstrumentation.WAIT_TIME_MS);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    WorkEduView workEduView = getEduView();
    // verify personal app edu is seen first and click "next"
    executeOnLauncher(l -> {
        assertEquals(((TextView) workEduView.findViewById(R.id.content_text)).getText(), l.getResources().getString(R.string.work_profile_edu_personal_apps));
        workEduView.findViewById(R.id.proceed).callOnClick();
    });
    AtomicInteger attempt = new AtomicInteger(0);
    // verify work edu is seen next
    waitForLauncherCondition("Launcher did not show the next edu screen", l -> {
        Log.d(TestProtocol.WORK_PROFILE_REMOVED, "running test attempt" + attempt.getAndIncrement());
        if (!(l.getAppsView().getContentView() instanceof AllAppsPagedView)) {
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work tab not setup. Skipping test");
            return false;
        }
        if (((AllAppsPagedView) l.getAppsView().getContentView()).getCurrentPage() != WORK_PAGE) {
            Log.d(TestProtocol.WORK_PROFILE_REMOVED, "Work page not highlighted");
        }
        return ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(l.getResources().getString(R.string.work_profile_edu_work_apps));
    });
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Objects(java.util.Objects) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) WorkEduView(com.android.launcher3.views.WorkEduView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 7 with IGNORE

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

the class RecentsView method cancelSplitSelect.

public PendingAnimation cancelSplitSelect(boolean animate) {
    SplitSelectStateController splitController = mSplitPlaceholderView.getSplitController();
    SplitPositionOption splitOption = splitController.getActiveSplitPositionOption();
    Rect initialBounds = splitController.getInitialBounds();
    splitController.resetState();
    int duration = mActivity.getStateManager().getState().getTransitionDuration(getContext());
    PendingAnimation pendingAnim = new PendingAnimation(duration);
    if (!animate) {
        resetFromSplitSelectionState();
        return pendingAnim;
    }
    addViewInLayout(mSplitHiddenTaskView, mSplitHiddenTaskViewIndex, mSplitHiddenTaskView.getLayoutParams());
    mSplitHiddenTaskView.setAlpha(0);
    int[] oldScroll = new int[getChildCount()];
    getPageScrolls(oldScroll, false, view -> view.getVisibility() != GONE && view != mSplitHiddenTaskView);
    int[] newScroll = new int[getChildCount()];
    getPageScrolls(newScroll, false, SIMPLE_SCROLL_LOGIC);
    boolean needsCurveUpdates = false;
    for (int i = mSplitHiddenTaskViewIndex; i >= 0; i--) {
        View child = getChildAt(i);
        if (child == mSplitHiddenTaskView) {
            TaskView taskView = (TaskView) child;
            int dir = mOrientationHandler.getSplitTaskViewDismissDirection(splitOption, mActivity.getDeviceProfile());
            FloatProperty<TaskView> dismissingTaskViewTranslate;
            Rect hiddenBounds = new Rect(taskView.getLeft(), taskView.getTop(), taskView.getRight(), taskView.getBottom());
            int distanceDelta = 0;
            if (dir == PagedOrientationHandler.SPLIT_TRANSLATE_SECONDARY_NEGATIVE) {
                dismissingTaskViewTranslate = taskView.getSecondaryDissmissTranslationProperty();
                distanceDelta = initialBounds.top - hiddenBounds.top;
                taskView.layout(initialBounds.left, hiddenBounds.top, initialBounds.right, hiddenBounds.bottom);
            } else {
                dismissingTaskViewTranslate = taskView.getPrimaryDismissTranslationProperty();
                distanceDelta = initialBounds.left - hiddenBounds.left;
                taskView.layout(hiddenBounds.left, initialBounds.top, hiddenBounds.right, initialBounds.bottom);
                if (dir == PagedOrientationHandler.SPLIT_TRANSLATE_PRIMARY_POSITIVE) {
                    distanceDelta *= -1;
                }
            }
            pendingAnim.add(ObjectAnimator.ofFloat(mSplitHiddenTaskView, dismissingTaskViewTranslate, distanceDelta));
            pendingAnim.add(ObjectAnimator.ofFloat(mSplitHiddenTaskView, ALPHA, 1));
        } else {
            // ignore views to left
            if (showAsGrid()) {
                // TODO(b/186800707) handle more elegantly for grid
                continue;
            }
            int scrollDiff = newScroll[i] - oldScroll[i];
            if (scrollDiff != 0) {
                FloatProperty translationProperty = child instanceof TaskView ? ((TaskView) child).getPrimaryDismissTranslationProperty() : mOrientationHandler.getPrimaryViewTranslate();
                ResourceProvider rp = DynamicResource.provider(mActivity);
                SpringProperty sp = new SpringProperty(SpringProperty.FLAG_CAN_SPRING_ON_END).setDampingRatio(rp.getFloat(R.dimen.dismiss_task_trans_x_damping_ratio)).setStiffness(rp.getFloat(R.dimen.dismiss_task_trans_x_stiffness));
                pendingAnim.add(ObjectAnimator.ofFloat(child, translationProperty, scrollDiff).setDuration(duration), ACCEL, sp);
                needsCurveUpdates = true;
            }
        }
    }
    if (needsCurveUpdates) {
        pendingAnim.addOnFrameCallback(this::updateCurveProperties);
    }
    pendingAnim.addListener(new AnimationSuccessListener() {

        @Override
        public void onAnimationSuccess(Animator animator) {
            // TODO(b/186800707) Figure out how to undo for grid view
            // Need to handle cases where dismissed task is
            // * Top Row
            // * Bottom Row
            // * Focused Task
            updateGridProperties();
            resetFromSplitSelectionState();
        }
    });
    return pendingAnim;
}
Also used : PendingAnimation(com.android.launcher3.anim.PendingAnimation) SpringProperty(com.android.launcher3.anim.SpringProperty) Rect(android.graphics.Rect) ImageView(android.widget.ImageView) View(android.view.View) ListView(android.widget.ListView) PagedView(com.android.launcher3.PagedView) TextPaint(android.text.TextPaint) Point(android.graphics.Point) ValueAnimator(android.animation.ValueAnimator) Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) SplitPositionOption(com.android.launcher3.util.SplitConfigurationOptions.SplitPositionOption) ResourceProvider(com.android.systemui.plugins.ResourceProvider) SplitSelectStateController(com.android.quickstep.util.SplitSelectStateController) FloatProperty(android.util.FloatProperty) AnimationSuccessListener(com.android.launcher3.anim.AnimationSuccessListener)

Example 8 with IGNORE

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

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);
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 9 with IGNORE

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

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();
}
Also used : FolderIcon(com.android.launcher3.tapl.FolderIcon) AppIcon(com.android.launcher3.tapl.AppIcon) Folder(com.android.launcher3.tapl.Folder) Workspace(com.android.launcher3.tapl.Workspace) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 10 with IGNORE

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

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)

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