Search in sources :

Example 16 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_Launcher3 by AOSPA.

the class AbstractLauncherUiTest method checkLauncherIntegrity.

private void checkLauncherIntegrity(Launcher launcher, ContainerType expectedContainerType) {
    if (launcher != null) {
        final StateManager<LauncherState> stateManager = launcher.getStateManager();
        final LauncherState stableState = stateManager.getCurrentStableState();
        assertTrue("Stable state != state: " + stableState.getClass().getSimpleName() + ", " + stateManager.getState().getClass().getSimpleName(), stableState == stateManager.getState());
        final boolean isResumed = launcher.hasBeenResumed();
        final boolean isStarted = launcher.isStarted();
        checkLauncherState(launcher, expectedContainerType, isResumed, isStarted);
        final int ordinal = stableState.ordinal;
        switch(expectedContainerType) {
            case WORKSPACE:
            case WIDGETS:
                {
                    assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
                    break;
                }
            case ALL_APPS:
                {
                    assertTrue("Launcher is not resumed in state: " + expectedContainerType, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.ALL_APPS_STATE_ORDINAL);
                    break;
                }
            case OVERVIEW:
                {
                    checkLauncherStateInOverview(launcher, expectedContainerType, isStarted, isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.OVERVIEW_STATE_ORDINAL);
                    break;
                }
            case BACKGROUND:
                {
                    assertTrue("Launcher is resumed in state: " + expectedContainerType, !isResumed);
                    assertTrue(TestProtocol.stateOrdinalToString(ordinal), ordinal == TestProtocol.NORMAL_STATE_ORDINAL);
                    break;
                }
            default:
                throw new IllegalArgumentException("Illegal container: " + expectedContainerType);
        }
    } else {
        assertTrue("Container type is not BACKGROUND or FALLBACK_OVERVIEW: " + expectedContainerType, expectedContainerType == ContainerType.BACKGROUND || expectedContainerType == ContainerType.FALLBACK_OVERVIEW);
    }
}
Also used : LauncherState(com.android.launcher3.LauncherState)

Example 17 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_Launcher3 by AOSPA.

the class Launcher method getFirstMatchForAppClose.

/**
 * Similar to {@link #getFirstMatch} but optimized to finding a suitable view for the app close
 * animation.
 *
 * @param preferredItemId The id of the preferred item to match to if it exists.
 * @param packageName The package name of the app to match.
 * @param user The user of the app to match.
 */
public View getFirstMatchForAppClose(int preferredItemId, String packageName, UserHandle user) {
    final ItemInfoMatcher preferredItem = (info, cn) -> info != null && info.id == preferredItemId;
    final ItemInfoMatcher packageAndUserAndApp = (info, cn) -> info != null && info.itemType == ITEM_TYPE_APPLICATION && info.user.equals(user) && info.getTargetComponent() != null && TextUtils.equals(info.getTargetComponent().getPackageName(), packageName);
    if (isInState(LauncherState.ALL_APPS)) {
        return getFirstMatch(Collections.singletonList(mAppsView.getActiveRecyclerView()), preferredItem, packageAndUserAndApp);
    } else {
        List<ViewGroup> containers = new ArrayList<>(mWorkspace.getPanelCount() + 1);
        containers.add(mWorkspace.getHotseat().getShortcutsAndWidgets());
        mWorkspace.forEachVisiblePage(page -> containers.add(((CellLayout) page).getShortcutsAndWidgets()));
        // Order: Preferred item by itself or in folder, then by matching package/user
        if (ADAPTIVE_ICON_WINDOW_ANIM.get()) {
            return getFirstMatch(containers, preferredItem, forFolderMatch(preferredItem), packageAndUserAndApp, forFolderMatch(packageAndUserAndApp));
        } else {
            // FolderAdaptiveIcon as the background.
            return getFirstMatch(containers, preferredItem, packageAndUserAndApp);
        }
    }
}
Also used : Bundle(android.os.Bundle) BitmapRenderer(com.android.launcher3.icons.BitmapRenderer) NonNull(androidx.annotation.NonNull) PendingAddWidgetInfo(com.android.launcher3.widget.PendingAddWidgetInfo) AccessibilityManagerCompat(com.android.launcher3.compat.AccessibilityManagerCompat) CONFIG_ORIENTATION(android.content.pm.ActivityInfo.CONFIG_ORIENTATION) NO_OFFSET(com.android.launcher3.LauncherState.NO_OFFSET) SQLiteDatabase(android.database.sqlite.SQLiteDatabase) LauncherAtom(com.android.launcher3.logger.LauncherAtom) Log(android.util.Log) ALPHA_INDEX_LAUNCHER_LOAD(com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_LAUNCHER_LOAD) IntentFilter(android.content.IntentFilter) UserCache(com.android.launcher3.pm.UserCache) ActivityTracker(com.android.launcher3.util.ActivityTracker) Stream(java.util.stream.Stream) LayoutParams(android.view.WindowManager.LayoutParams) AbstractFloatingView.getTopOpenViewWithType(com.android.launcher3.AbstractFloatingView.getTopOpenViewWithType) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) QsbContainerView(com.android.launcher3.qsb.QsbContainerView) TextKeyListener(android.text.method.TextKeyListener) TYPE_REBIND_SAFE(com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE) ModelUtils(com.android.launcher3.model.ModelUtils) ViewGroupFocusHelper(com.android.launcher3.keyboard.ViewGroupFocusHelper) ITEM_TYPE_APPLICATION(com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION) SystemClock(android.os.SystemClock) SystemUiController(com.android.launcher3.util.SystemUiController) Supplier(java.util.function.Supplier) LAUNCHER_ALLAPPS_EXIT(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_EXIT) PendingRequestArgs(com.android.launcher3.util.PendingRequestArgs) Toast(android.widget.Toast) TYPE_ALL(com.android.launcher3.AbstractFloatingView.TYPE_ALL) Menu(android.view.Menu) ItemInfoMatcher.forFolderMatch(com.android.launcher3.util.ItemInfoMatcher.forFolderMatch) LauncherAction(com.android.launcher3.accessibility.LauncherAccessibilityDelegate.LauncherAction) IntArray(com.android.launcher3.util.IntArray) Parcelable(android.os.Parcelable) InstanceId(com.android.launcher3.logging.InstanceId) DragController(com.android.launcher3.dragndrop.DragController) LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY_WITH_DEVICE_SEARCH) FLAG_DRAG_AND_DROP(com.android.launcher3.model.ItemInstallQueue.FLAG_DRAG_AND_DROP) CallSuper(androidx.annotation.CallSuper) ItemClickHandler(com.android.launcher3.touch.ItemClickHandler) IntSet(com.android.launcher3.util.IntSet) LauncherAppWidgetHost(com.android.launcher3.widget.LauncherAppWidgetHost) FolderGridOrganizer(com.android.launcher3.folder.FolderGridOrganizer) SharedPreferences(android.content.SharedPreferences) FLAG_CLOSE_POPUPS(com.android.launcher3.LauncherState.FLAG_CLOSE_POPUPS) TestLogging(com.android.launcher3.testing.TestLogging) ComponentKey(com.android.launcher3.util.ComponentKey) RunnableList(com.android.launcher3.util.RunnableList) DotInfo(com.android.launcher3.dot.DotInfo) Rect(android.graphics.Rect) Trace(android.os.Trace) PackageManager(android.content.pm.PackageManager) LAUNCHER_STATE_BACKGROUND(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND) Animator(android.animation.Animator) IconCache(com.android.launcher3.icons.IconCache) OptionsPopupView(com.android.launcher3.views.OptionsPopupView) SPRING_LOADED(com.android.launcher3.LauncherState.SPRING_LOADED) LauncherAccessibilityDelegate.getSupportedActions(com.android.launcher3.accessibility.LauncherAccessibilityDelegate.getSupportedActions) RotationHelper(com.android.launcher3.states.RotationHelper) OverlayPlugin(com.android.systemui.plugins.OverlayPlugin) FLAG_ACTIVITY_PAUSED(com.android.launcher3.model.ItemInstallQueue.FLAG_ACTIVITY_PAUSED) FolderInfo(com.android.launcher3.model.data.FolderInfo) RectF(android.graphics.RectF) AllAppsSwipeController(com.android.launcher3.touch.AllAppsSwipeController) LauncherExterns(com.android.systemui.plugins.shared.LauncherExterns) Collection(java.util.Collection) PendingAppWidgetHostView(com.android.launcher3.widget.PendingAppWidgetHostView) MultiValueAlpha(com.android.launcher3.util.MultiValueAlpha) DragOptions(com.android.launcher3.dragndrop.DragOptions) ALL_APPS(com.android.launcher3.LauncherState.ALL_APPS) WIDGETS(com.android.launcher3.popup.SystemShortcut.WIDGETS) ActivityNotFoundException(android.content.ActivityNotFoundException) Notification(android.app.Notification) ModelWriter(com.android.launcher3.model.ModelWriter) CONFIG_SCREEN_SIZE(android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE) AppInfo(com.android.launcher3.model.data.AppInfo) ActivityResultInfo(com.android.launcher3.util.ActivityResultInfo) LauncherOverlay(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlay) ItemInfo(com.android.launcher3.model.data.ItemInfo) CustomWidgetManager(com.android.launcher3.widget.custom.CustomWidgetManager) PopupContainerWithArrow(com.android.launcher3.popup.PopupContainerWithArrow) HashSet(java.util.HashSet) Build(android.os.Build) ADAPTIVE_ICON_WINDOW_ANIM(com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM) LayoutInflater(android.view.LayoutInflater) SafeCloseable(com.android.launcher3.util.SafeCloseable) OnboardingPrefs(com.android.launcher3.util.OnboardingPrefs) PendingAddShortcutInfo(com.android.launcher3.widget.PendingAddShortcutInfo) Bitmap(android.graphics.Bitmap) OvershootInterpolator(android.view.animation.OvershootInterpolator) IMPORTANT_FOR_ACCESSIBILITY_NO(android.view.View.IMPORTANT_FOR_ACCESSIBILITY_NO) DragView(com.android.launcher3.dragndrop.DragView) TraceHelper(com.android.launcher3.util.TraceHelper) LAUNCHER_ONRESUME(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONRESUME) AllAppsTransitionController(com.android.launcher3.allapps.AllAppsTransitionController) LauncherDragController(com.android.launcher3.dragndrop.LauncherDragController) ViewOnDrawExecutor(com.android.launcher3.util.ViewOnDrawExecutor) TestProtocol(com.android.launcher3.testing.TestProtocol) ImageView(android.widget.ImageView) AnimatorListeners(com.android.launcher3.anim.AnimatorListeners) TYPE_WINDOW_STATE_CHANGED(android.view.accessibility.AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) Process(android.os.Process) LAUNCHER_ALLAPPS_ENTRY(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_ENTRY) AccessibilityEvent(android.view.accessibility.AccessibilityEvent) TargetApi(android.annotation.TargetApi) WidgetsModel(com.android.launcher3.model.WidgetsModel) PrintWriter(java.io.PrintWriter) KeyboardShortcutInfo(android.view.KeyboardShortcutInfo) AllAppsStore(com.android.launcher3.allapps.AllAppsStore) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) LauncherAccessibilityDelegate(com.android.launcher3.accessibility.LauncherAccessibilityDelegate) StringRes(androidx.annotation.StringRes) Nullable(androidx.annotation.Nullable) ItemInstallQueue(com.android.launcher3.model.ItemInstallQueue) TYPE_FOLDER(com.android.launcher3.AbstractFloatingView.TYPE_FOLDER) LauncherAppWidgetHostView(com.android.launcher3.widget.LauncherAppWidgetHostView) DiscoveryBounce(com.android.launcher3.allapps.DiscoveryBounce) NORMAL(com.android.launcher3.LauncherState.NORMAL) PackageManagerHelper(com.android.launcher3.util.PackageManagerHelper) ArrowPopup(com.android.launcher3.popup.ArrowPopup) WidgetsFullSheet(com.android.launcher3.widget.picker.WidgetsFullSheet) FileLog(com.android.launcher3.logging.FileLog) FloatingSurfaceView(com.android.launcher3.views.FloatingSurfaceView) FLAG_NON_INTERACTIVE(com.android.launcher3.LauncherState.FLAG_NON_INTERACTIVE) ArrayList(java.util.ArrayList) FLAG_MULTI_PAGE(com.android.launcher3.LauncherState.FLAG_MULTI_PAGE) IntentSender(android.content.IntentSender) REQUEST_NONE(com.android.launcher3.states.RotationHelper.REQUEST_NONE) AppWidgetHostView(android.appwidget.AppWidgetHostView) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) UserHandle(android.os.UserHandle) DragObject(com.android.launcher3.DropTarget.DragObject) SystemShortcut(com.android.launcher3.popup.SystemShortcut) PluginListener(com.android.systemui.plugins.PluginListener) PopupDataProvider(com.android.launcher3.popup.PopupDataProvider) ActivityContext(com.android.launcher3.views.ActivityContext) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) StateManager(com.android.launcher3.statemanager.StateManager) TextUtils(android.text.TextUtils) FeatureFlags(com.android.launcher3.config.FeatureFlags) AppWidgetManager(android.appwidget.AppWidgetManager) ComponentCallbacks2(android.content.ComponentCallbacks2) TouchController(com.android.launcher3.util.TouchController) WidgetsListBaseEntry(com.android.launcher3.widget.model.WidgetsListBaseEntry) Configuration(android.content.res.Configuration) AlphaProperty(com.android.launcher3.util.MultiValueAlpha.AlphaProperty) LAUNCHER_ONSTOP(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ONSTOP) LauncherOverlayCallbacks(com.android.systemui.plugins.shared.LauncherOverlayManager.LauncherOverlayCallbacks) INSTALL(com.android.launcher3.popup.SystemShortcut.INSTALL) ValueAnimator(android.animation.ValueAnimator) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) SPRING_LOADED_EXIT_DELAY(com.android.launcher3.LauncherAnimUtils.SPRING_LOADED_EXIT_DELAY) PendingIntent(android.app.PendingIntent) KeyboardShortcutGroup(android.view.KeyboardShortcutGroup) NotificationChannel(android.app.NotificationChannel) View(android.view.View) NO_SCALE(com.android.launcher3.LauncherState.NO_SCALE) NotificationManager(android.app.NotificationManager) PinRequestHelper(com.android.launcher3.pm.PinRequestHelper) Predicate(java.util.function.Predicate) ObjectAnimator(android.animation.ObjectAnimator) CancellationSignal(android.os.CancellationSignal) BroadcastReceiver(android.content.BroadcastReceiver) PluginManagerWrapper(com.android.launcher3.uioverrides.plugins.PluginManagerWrapper) ViewGroup(android.view.ViewGroup) SparseArray(android.util.SparseArray) List(java.util.List) Utilities.postAsyncCallback(com.android.launcher3.Utilities.postAsyncCallback) LAUNCHER_STATE_HOME(com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME) NotificationListener(com.android.launcher3.notification.NotificationListener) REQUEST_LOCK(com.android.launcher3.states.RotationHelper.REQUEST_LOCK) LauncherAppWidgetProviderInfo(com.android.launcher3.widget.LauncherAppWidgetProviderInfo) LAUNCHER_WIDGET_RECONFIGURED(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_RECONFIGURED) CONFIG_UI_MODE(android.content.pm.ActivityInfo.CONFIG_UI_MODE) AllAppsContainerView(com.android.launcher3.allapps.AllAppsContainerView) Themes(com.android.launcher3.util.Themes) Context(android.content.Context) KeyEvent(android.view.KeyEvent) WidgetAddFlowHandler(com.android.launcher3.widget.WidgetAddFlowHandler) TYPE_SNACKBAR(com.android.launcher3.AbstractFloatingView.TYPE_SNACKBAR) FolderIcon(com.android.launcher3.folder.FolderIcon) Intent(android.content.Intent) HashMap(java.util.HashMap) UiThreadHelper(com.android.launcher3.util.UiThreadHelper) InstanceIdSequence(com.android.launcher3.logging.InstanceIdSequence) MotionEvent(android.view.MotionEvent) AnimatorSet(android.animation.AnimatorSet) DragLayer(com.android.launcher3.dragndrop.DragLayer) TYPE_ICON_SURFACE(com.android.launcher3.AbstractFloatingView.TYPE_ICON_SURFACE) UNINSTALL(com.android.launcher3.popup.SystemShortcut.UNINSTALL) StatefulActivity(com.android.launcher3.statemanager.StatefulActivity) PackageUserKey(com.android.launcher3.util.PackageUserKey) APP_INFO(com.android.launcher3.popup.SystemShortcut.APP_INFO) WidgetManagerHelper(com.android.launcher3.widget.WidgetManagerHelper) PropertyListBuilder(com.android.launcher3.anim.PropertyListBuilder) StatsLogManager(com.android.launcher3.logging.StatsLogManager) StrictMode(android.os.StrictMode) LauncherOverlayManager(com.android.systemui.plugins.shared.LauncherOverlayManager) FileDescriptor(java.io.FileDescriptor) StateHandler(com.android.launcher3.statemanager.StateManager.StateHandler) ScrimView(com.android.launcher3.views.ScrimView) Thunk(com.android.launcher3.util.Thunk) VisibleForTesting(androidx.annotation.VisibleForTesting) Collections(java.util.Collections) ViewGroup(android.view.ViewGroup) ItemInfoMatcher(com.android.launcher3.util.ItemInfoMatcher) ArrayList(java.util.ArrayList)

Example 18 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsQuickstep method testQuickSwitchFromApp.

@Test
@NavigationModeSwitch
@PortraitLandscape
public void testQuickSwitchFromApp() throws Exception {
    startTestActivity(2);
    startTestActivity(3);
    startTestActivity(4);
    Background background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    assertTrue("The first app we should have quick switched to is not running", isTestActivityRunning(3));
    background = getAndAssertBackground();
    background.quickSwitchToPreviousApp();
    if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) {
        // 3-button mode toggles between 2 apps, rather than going back further.
        assertTrue("Second quick switch should have returned to the first app.", isTestActivityRunning(4));
    } else {
        assertTrue("The second app we should have quick switched to is not running", isTestActivityRunning(2));
    }
    background = getAndAssertBackground();
    background.quickSwitchToPreviousAppSwipeLeft();
    assertTrue("The 2nd app we should have quick switched to is not running", isTestActivityRunning(3));
    background = getAndAssertBackground();
    background.switchToOverview();
}
Also used : Background(com.android.launcher3.tapl.Background) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Example 19 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_Launcher3 by AOSPA.

the class TaplTestsQuickstep method testBackground.

@Test
@NavigationModeSwitch
@PortraitLandscape
public void testBackground() throws Exception {
    startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
    final Background background = getAndAssertBackground();
    assertNotNull("Background.switchToOverview() returned null", background.switchToOverview());
    assertTrue("Launcher internal state didn't switch to Overview", isInState(() -> LauncherState.OVERVIEW));
}
Also used : Background(com.android.launcher3.tapl.Background) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test) NavigationModeSwitch(com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch)

Example 20 with Background

use of com.android.launcher3.tapl.Background in project android_packages_apps_Launcher3 by AOSPA.

the class TouchInteractionService method onConfigurationChanged.

@Override
public void onConfigurationChanged(Configuration newConfig) {
    if (!mDeviceState.isUserUnlocked()) {
        return;
    }
    final BaseActivityInterface activityInterface = mOverviewComponentObserver.getActivityInterface();
    final BaseDraggingActivity activity = activityInterface.getCreatedActivity();
    if (activity == null || activity.isStarted()) {
        // We only care about the existing background activity.
        return;
    }
    if (mOverviewComponentObserver.canHandleConfigChanges(activity.getComponentName(), activity.getResources().getConfiguration().diff(newConfig))) {
        // Since navBar gestural height are different between portrait and landscape,
        // can handle orientation changes and refresh navigation gestural region through
        // onOneHandedModeChanged()
        int newGesturalHeight = ResourceUtils.getNavbarSize(ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getApplicationContext().getResources());
        mDeviceState.onOneHandedModeChanged(newGesturalHeight);
        return;
    }
    preloadOverview(false);
}
Also used : BaseDraggingActivity(com.android.launcher3.BaseDraggingActivity) Point(android.graphics.Point)

Aggregations

View (android.view.View)48 Point (android.graphics.Point)39 Rect (android.graphics.Rect)39 ItemInfo (com.android.launcher3.model.data.ItemInfo)29 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)29 ObjectAnimator (android.animation.ObjectAnimator)28 Background (com.android.launcher3.tapl.Background)28 DragView (com.android.launcher3.dragndrop.DragView)26 DragLayer (com.android.launcher3.dragndrop.DragLayer)25 Animator (android.animation.Animator)24 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)24 LauncherAppWidgetHostView (com.android.launcher3.widget.LauncherAppWidgetHostView)24 Drawable (android.graphics.drawable.Drawable)23 ArrayList (java.util.ArrayList)23 ViewGroup (android.view.ViewGroup)22 ColorDrawable (android.graphics.drawable.ColorDrawable)21 Handler (android.os.Handler)21 FolderIcon (com.android.launcher3.folder.FolderIcon)21 DeepShortcutView (com.android.launcher3.shortcuts.DeepShortcutView)21 Bitmap (android.graphics.Bitmap)20