Search in sources :

Example 46 with IGNORE

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

the class WorkTabTest method toggleWorks.

@Ignore("b/182844465")
@Test
public void toggleWorks() {
    mDevice.pressHome();
    waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    waitForState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
    getOnceNotNull("Apps view did not bind", launcher -> launcher.getAppsView().getWorkModeSwitch(), 60000);
    UserManager userManager = getFromLauncher(l -> l.getSystemService(UserManager.class));
    assertEquals(2, userManager.getUserProfiles().size());
    UserHandle workProfile = getFromLauncher(l -> {
        UserHandle myHandle = Process.myUserHandle();
        List<UserHandle> userProfiles = userManager.getUserProfiles();
        return userProfiles.get(0) == myHandle ? userProfiles.get(1) : userProfiles.get(0);
    });
    waitForLauncherCondition("work profile can't be turned off", l -> userManager.requestQuietModeEnabled(true, workProfile));
    assertTrue(userManager.isQuietModeEnabled(workProfile));
    executeOnLauncher(launcher -> {
        WorkModeSwitch wf = launcher.getAppsView().getWorkModeSwitch();
        ((AllAppsPagedView) launcher.getAppsView().getContentView()).snapToPageImmediately(AllAppsContainerView.AdapterHolder.WORK);
        wf.toggle();
    });
    waitForLauncherCondition("Work toggle did not work", l -> l.getSystemService(UserManager.class).isQuietModeEnabled(workProfile));
}
Also used : UserManager(android.os.UserManager) UserHandle(android.os.UserHandle) Objects(java.util.Objects) WorkModeSwitch(com.android.launcher3.allapps.WorkModeSwitch) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 47 with IGNORE

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

the class WorkTabTest method testWorkEduIntermittent.

@Ignore("b/182844465")
@Test
public void testWorkEduIntermittent() {
    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 -> launcher.getAppsView().getContentView() instanceof AllAppsPagedView, 60000);
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    // verify personal app edu is seen
    getEduView();
    // dismiss personal edu
    mDevice.pressHome();
    waitForState("Launcher did not go home", () -> NORMAL);
    // open work tab
    executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
    waitForState("Launcher did not switch to all apps", () -> ALL_APPS);
    waitForLauncherCondition("Work tab not setup", launcher -> launcher.getAppsView().getContentView() instanceof AllAppsPagedView, 60000);
    executeOnLauncher(launcher -> {
        AllAppsPagedView pagedView = (AllAppsPagedView) launcher.getAppsView().getContentView();
        pagedView.setCurrentPage(WORK_PAGE);
    });
    WorkEduView workEduView = getEduView();
    // verify work tab edu is shown
    waitForLauncherCondition("Launcher did not show the next edu screen", l -> ((TextView) workEduView.findViewById(R.id.content_text)).getText().equals(l.getResources().getString(R.string.work_profile_edu_work_apps)));
}
Also used : Objects(java.util.Objects) AllAppsPagedView(com.android.launcher3.allapps.AllAppsPagedView) WorkEduView(com.android.launcher3.views.WorkEduView) TextView(android.widget.TextView) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 48 with IGNORE

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

the class SettingsChangeLogger method dispatchUserEvent.

private void dispatchUserEvent() {
    StatsLogger logger = StatsLogManager.newInstance(mContext).logger().withInstanceId(new InstanceIdSequence().newInstanceId());
    logger.log(mNotificationDotsEnabled ? LAUNCHER_NOTIFICATION_DOT_ENABLED : LAUNCHER_NOTIFICATION_DOT_DISABLED);
    logger.log(mNavMode.launcherEvent);
    logger.log(getDevicePrefs(mContext).getBoolean(LAST_PREDICTION_ENABLED_STATE, true) ? LAUNCHER_HOME_SCREEN_SUGGESTIONS_ENABLED : LAUNCHER_HOME_SCREEN_SUGGESTIONS_DISABLED);
    SharedPreferences prefs = getPrefs(mContext);
    StatsLogManager.LauncherEvent gridSizeChangedEvent = null;
    // TODO(b/184981523): This doesn't work for 2-panel grid, which has 6 hotseat icons
    switch(prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, -1)) {
        case 5:
            gridSizeChangedEvent = LAUNCHER_GRID_SIZE_5;
            break;
        case 4:
            gridSizeChangedEvent = LAUNCHER_GRID_SIZE_4;
            break;
        case 3:
            gridSizeChangedEvent = LAUNCHER_GRID_SIZE_3;
            break;
        case 2:
            gridSizeChangedEvent = LAUNCHER_GRID_SIZE_2;
            break;
        default:
            // Ignore illegal input.
            break;
    }
    if (gridSizeChangedEvent != null) {
        logger.log(gridSizeChangedEvent);
    }
    if (FeatureFlags.ENABLE_THEMED_ICONS.get()) {
        logger.log(prefs.getBoolean(KEY_THEMED_ICONS, false) ? LAUNCHER_THEMED_ICON_ENABLED : LAUNCHER_THEMED_ICON_DISABLED);
    }
    mLoggablePrefs.forEach((key, lp) -> logger.log(() -> prefs.getBoolean(key, lp.defaultValue) ? lp.eventIdOn : lp.eventIdOff));
}
Also used : StatsLogger(com.android.launcher3.logging.StatsLogManager.StatsLogger) InstanceIdSequence(com.android.launcher3.logging.InstanceIdSequence) SharedPreferences(android.content.SharedPreferences) StatsLogManager(com.android.launcher3.logging.StatsLogManager)

Example 49 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project Neo-Launcher by NeoApplications.

the class LoaderTask method run.

public void run() {
    synchronized (this) {
        // Skip fast if we are already stopped.
        if (mStopped) {
            return;
        }
    }
    TraceHelper.beginSection(TAG);
    try (LauncherModel.LoaderTransaction transaction = mApp.getModel().beginLoader(this)) {
        TraceHelper.partitionSection(TAG, "step 1.1: loading workspace");
        loadWorkspace();
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 1.2: bind workspace workspace");
        mResults.bindWorkspace();
        // Notify the installer packages of packages with active installs on the first screen.
        TraceHelper.partitionSection(TAG, "step 1.3: send first screen broadcast");
        sendFirstScreenActiveInstallsBroadcast();
        // Take a break
        TraceHelper.partitionSection(TAG, "step 1 completed, wait for idle");
        waitForIdle();
        verifyNotStopped();
        // second step
        TraceHelper.partitionSection(TAG, "step 2.1: loading all apps");
        List<LauncherActivityInfo> allActivityList = loadAllApps();
        TraceHelper.partitionSection(TAG, "step 2.2: Binding all apps");
        verifyNotStopped();
        mResults.bindAllApps();
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 2.3: Update icon cache");
        IconCacheUpdateHandler updateHandler = mIconCache.getUpdateHandler();
        setIgnorePackages(updateHandler);
        updateHandler.updateIcons(allActivityList, LauncherActivityCachingLogic.newInstance(mApp.getContext()), mApp.getModel()::onPackageIconsUpdated);
        // Take a break
        TraceHelper.partitionSection(TAG, "step 2 completed, wait for idle");
        waitForIdle();
        verifyNotStopped();
        // third step
        TraceHelper.partitionSection(TAG, "step 3.1: loading deep shortcuts");
        loadDeepShortcuts();
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 3.2: bind deep shortcuts");
        mResults.bindDeepShortcuts();
        // Take a break
        TraceHelper.partitionSection(TAG, "step 3 completed, wait for idle");
        waitForIdle();
        verifyNotStopped();
        // fourth step
        TraceHelper.partitionSection(TAG, "step 4.1: loading widgets");
        List<ComponentWithLabel> allWidgetsList = mBgDataModel.widgetsModel.update(mApp, null);
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 4.2: Binding widgets");
        mResults.bindWidgets();
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 4.3: save widgets in icon cache");
        updateHandler.updateIcons(allWidgetsList, new ComponentCachingLogic(mApp.getContext(), true), mApp.getModel()::onWidgetLabelsUpdated);
        verifyNotStopped();
        TraceHelper.partitionSection(TAG, "step 5: Finish icon cache update");
        updateHandler.finish();
        transaction.commit();
    } catch (CancellationException e) {
        // Loader stopped, ignore
        TraceHelper.partitionSection(TAG, "Cancelled");
    }
    TraceHelper.endSection(TAG);
}
Also used : LauncherModel(com.android.launcher3.LauncherModel) ComponentCachingLogic(com.android.launcher3.icons.ComponentWithLabel.ComponentCachingLogic) CancellationException(java.util.concurrent.CancellationException) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) IconCacheUpdateHandler(com.android.launcher3.icons.cache.IconCacheUpdateHandler) ComponentWithLabel(com.android.launcher3.icons.ComponentWithLabel)

Example 50 with IGNORE

use of com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE in project Neo-Launcher by NeoApplications.

the class LoaderTask method setIgnorePackages.

private void setIgnorePackages(IconCacheUpdateHandler updateHandler) {
    // Ignore packages which have a promise icon.
    HashSet<String> packagesToIgnore = new HashSet<>();
    synchronized (mBgDataModel) {
        for (ItemInfo info : mBgDataModel.itemsIdMap) {
            if (info instanceof WorkspaceItemInfo) {
                WorkspaceItemInfo si = (WorkspaceItemInfo) info;
                if (si.isPromise() && si.getTargetComponent() != null) {
                    packagesToIgnore.add(si.getTargetComponent().getPackageName());
                }
            } else if (info instanceof LauncherAppWidgetInfo) {
                LauncherAppWidgetInfo lawi = (LauncherAppWidgetInfo) info;
                if (lawi.hasRestoreFlag(LauncherAppWidgetInfo.FLAG_PROVIDER_NOT_READY)) {
                    packagesToIgnore.add(lawi.providerName.getPackageName());
                }
            }
        }
    }
    updateHandler.setPackagesToIgnore(Process.myUserHandle(), packagesToIgnore);
}
Also used : WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ItemInfo(com.android.launcher3.ItemInfo) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) HashSet(java.util.HashSet) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

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