Search in sources :

Example 71 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class LauncherAccessibilityDelegate method getSupportedActions.

/**
 * Returns all the accessibility actions that can be handled by the host.
 */
public static List<LauncherAction> getSupportedActions(Launcher launcher, View host) {
    if (host == null || !(host.getTag() instanceof ItemInfo)) {
        return Collections.emptyList();
    }
    PopupContainerWithArrow container = PopupContainerWithArrow.getOpen(launcher);
    LauncherAccessibilityDelegate delegate = container != null ? container.getAccessibilityDelegate() : launcher.getAccessibilityDelegate();
    List<LauncherAction> result = new ArrayList<>();
    delegate.getSupportedActions(host, (ItemInfo) host.getTag(), result);
    return result;
}
Also used : PendingAddItemInfo(com.android.launcher3.PendingAddItemInfo) ItemInfo(com.android.launcher3.model.data.ItemInfo) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) ArrayList(java.util.ArrayList) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow)

Example 72 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class WorkModeSwitch method onClick.

@Override
public void onClick(View view) {
    if (Utilities.ATLEAST_P && isEnabled()) {
        setFlag(FLAG_PROFILE_TOGGLE_ONGOING);
        Launcher launcher = Launcher.getLauncher(getContext());
        launcher.getStatsLogManager().logger().log(LAUNCHER_TURN_OFF_WORK_APPS_TAP);
        launcher.getAppsView().getWorkManager().setWorkProfileEnabled(false);
    }
}
Also used : Launcher(com.android.launcher3.Launcher)

Example 73 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsLauncher3 method runIconLaunchFromAllAppsTest.

public static void runIconLaunchFromAllAppsTest(AbstractLauncherUiTest test, AllApps allApps) {
    allApps.freeze();
    try {
        final AppIcon app = allApps.getAppIcon("TestActivity7");
        assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName()));
        test.executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the " + "top " + "one", test.isInBackground(launcher)));
    } finally {
        allApps.unfreeze();
    }
}
Also used : AppIcon(com.android.launcher3.tapl.AppIcon)

Example 74 with Launcher

use of com.android.launcher3.Launcher 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 75 with Launcher

use of com.android.launcher3.Launcher in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsLauncher3 method testDragAppIcon.

@Test
@PortraitLandscape
public void testDragAppIcon() throws Throwable {
    // 1. Open all apps and wait for load complete.
    // 2. Drag icon to homescreen.
    // 3. Verify that the icon works on homescreen.
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
        mLauncher.getWorkspace().getWorkspaceAppIcon(APP_NAME).launch(getAppPackageName());
    } finally {
        allApps.unfreeze();
    }
    executeOnLauncher(launcher -> assertTrue("Launcher activity is the top activity; expecting another activity to be the top " + "one", isInBackground(launcher)));
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Aggregations

Launcher (com.android.launcher3.Launcher)194 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)102 Test (org.junit.Test)102 View (android.view.View)87 LargeTest (androidx.test.filters.LargeTest)83 ItemInfo (com.android.launcher3.model.data.ItemInfo)83 Rect (android.graphics.Rect)80 Point (android.graphics.Point)77 Intent (android.content.Intent)71 ArrayList (java.util.ArrayList)69 DeviceProfile (com.android.launcher3.DeviceProfile)66 BaseQuickstepLauncher (com.android.launcher3.BaseQuickstepLauncher)64 Context (android.content.Context)61 LauncherAppWidgetInfo (com.android.launcher3.model.data.LauncherAppWidgetInfo)49 RecentsView (com.android.quickstep.views.RecentsView)46 DragLayer (com.android.launcher3.dragndrop.DragLayer)45 ComponentName (android.content.ComponentName)43 FolderInfo (com.android.launcher3.model.data.FolderInfo)42 ViewGroup (android.view.ViewGroup)41 AllApps (com.android.launcher3.tapl.AllApps)40