Search in sources :

Example 16 with IGNORE

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

the class CacheDataUpdatedTaskTest method testCacheUpdate_update_apps.

@Test
// b/131115553
@Ignore("This test fails with resource errors")
public void testCacheUpdate_update_apps() throws Exception {
    // Clear all icons from apps list so that its easy to check what was updated
    for (AppInfo info : allAppsList.data) {
        info.iconBitmap = null;
    }
    executeTaskForTest(newTask(CacheDataUpdatedTask.OP_CACHE_UPDATE, "app1"));
    // Verify that only the app icons of app1 (id 1 & 2) are updated. Custom shortcut (id 7)
    // is not updated
    verifyUpdate(1, 2);
    // Verify that only app1 var updated in allAppsList
    assertFalse(allAppsList.data.isEmpty());
    for (AppInfo info : allAppsList.data) {
        if (info.componentName.getPackageName().equals("app1")) {
            assertNotNull(info.iconBitmap);
        } else {
            assertNull(info.iconBitmap);
        }
    }
}
Also used : AppInfo(com.android.launcher3.AppInfo) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 17 with IGNORE

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

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 b/116853349
    mDragLayer.dump(prefix, writer);
    mStateManager.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);
    }
}
Also used : ViewGroup(android.view.ViewGroup) DragObject(com.android.launcher3.DropTarget.DragObject) Point(android.graphics.Point) ActivityNotFoundException(android.content.ActivityNotFoundException)

Example 18 with IGNORE

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

the class PackageInstallStateChangedTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
    if (mInstallInfo.state == PackageInstallerCompat.STATUS_INSTALLED) {
        try {
            // For instant apps we do not get package-add. Use setting events to update
            // any pinned icons.
            ApplicationInfo ai = app.getContext().getPackageManager().getApplicationInfo(mInstallInfo.packageName, 0);
            if (InstantAppResolver.newInstance(app.getContext()).isInstantApp(ai)) {
                app.getModel().onPackageAdded(ai.packageName, mInstallInfo.user);
            }
        } catch (PackageManager.NameNotFoundException e) {
        // Ignore
        }
        // Ignore install success events as they are handled by Package add events.
        return;
    }
    synchronized (apps) {
        PromiseAppInfo updated = apps.updatePromiseInstallInfo(mInstallInfo);
        if (updated != null) {
            scheduleCallbackTask(c -> c.bindPromiseAppProgressUpdated(updated));
        }
        bindApplicationsIfNeeded();
    }
    synchronized (dataModel) {
        final HashSet<ItemInfo> updates = new HashSet<>();
        for (ItemInfo info : dataModel.itemsIdMap) {
            if (info instanceof WorkspaceItemInfo) {
                WorkspaceItemInfo si = (WorkspaceItemInfo) info;
                ComponentName cn = si.getTargetComponent();
                if (si.hasPromiseIconUi() && (cn != null) && mInstallInfo.packageName.equals(cn.getPackageName())) {
                    si.setInstallProgress(mInstallInfo.progress);
                    if (mInstallInfo.state == PackageInstallerCompat.STATUS_FAILED) {
                        // Mark this info as broken.
                        si.status &= ~WorkspaceItemInfo.FLAG_INSTALL_SESSION_ACTIVE;
                    }
                    updates.add(si);
                }
            }
        }
        for (LauncherAppWidgetInfo widget : dataModel.appWidgets) {
            if (widget.providerName.getPackageName().equals(mInstallInfo.packageName)) {
                widget.installProgress = mInstallInfo.progress;
                updates.add(widget);
            }
        }
        if (!updates.isEmpty()) {
            scheduleCallbackTask(new CallbackTask() {

                @Override
                public void execute(Callbacks callbacks) {
                    callbacks.bindRestoreItemsChange(updates);
                }
            });
        }
    }
}
Also used : CallbackTask(com.android.launcher3.LauncherModel.CallbackTask) ItemInfo(com.android.launcher3.ItemInfo) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo) ApplicationInfo(android.content.pm.ApplicationInfo) LauncherAppWidgetInfo(com.android.launcher3.LauncherAppWidgetInfo) PackageManager(android.content.pm.PackageManager) Callbacks(com.android.launcher3.model.BgDataModel.Callbacks) PromiseAppInfo(com.android.launcher3.PromiseAppInfo) ComponentName(android.content.ComponentName) HashSet(java.util.HashSet) WorkspaceItemInfo(com.android.launcher3.WorkspaceItemInfo)

Example 19 with IGNORE

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

the class TaplTestsLauncher3 method testPressHomeOnAllAppsContextMenu.

@Test
@Ignore
public void testPressHomeOnAllAppsContextMenu() throws Exception {
    final AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
    allApps.freeze();
    try {
        allApps.getAppIcon("TestActivity7").openMenu();
    } finally {
        allApps.unfreeze();
    }
    mLauncher.pressHome();
}
Also used : AllApps(com.android.launcher3.tapl.AllApps) Ignore(org.junit.Ignore) LargeTest(androidx.test.filters.LargeTest) Test(org.junit.Test)

Example 20 with IGNORE

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

the class PackageInstallStateChangedTask method execute.

@Override
public void execute(LauncherAppState app, BgDataModel dataModel, AllAppsList apps) {
    if (mInstallInfo.state == PackageInstallInfo.STATUS_INSTALLED) {
        try {
            // For instant apps we do not get package-add. Use setting events to update
            // any pinned icons.
            ApplicationInfo ai = app.getContext().getPackageManager().getApplicationInfo(mInstallInfo.packageName, 0);
            if (InstantAppResolver.newInstance(app.getContext()).isInstantApp(ai)) {
                app.getModel().onPackageAdded(ai.packageName, mInstallInfo.user);
            }
        } catch (PackageManager.NameNotFoundException e) {
        // Ignore
        }
        // Ignore install success events as they are handled by Package add events.
        return;
    }
    synchronized (apps) {
        List<AppInfo> updatedAppInfos = apps.updatePromiseInstallInfo(mInstallInfo);
        if (!updatedAppInfos.isEmpty()) {
            for (AppInfo appInfo : updatedAppInfos) {
                scheduleCallbackTask(c -> c.bindIncrementalDownloadProgressUpdated(appInfo));
            }
        }
        bindApplicationsIfNeeded();
    }
    synchronized (dataModel) {
        final HashSet<ItemInfo> updates = new HashSet<>();
        dataModel.forAllWorkspaceItemInfos(mInstallInfo.user, si -> {
            if (si.hasPromiseIconUi() && mInstallInfo.packageName.equals(si.getTargetPackage())) {
                si.setProgressLevel(mInstallInfo);
                updates.add(si);
            }
        });
        for (LauncherAppWidgetInfo widget : dataModel.appWidgets) {
            if (widget.providerName.getPackageName().equals(mInstallInfo.packageName)) {
                widget.installProgress = mInstallInfo.progress;
                updates.add(widget);
            }
        }
        if (!updates.isEmpty()) {
            scheduleCallbackTask(callbacks -> callbacks.bindRestoreItemsChange(updates));
        }
    }
}
Also used : PackageManager(android.content.pm.PackageManager) ItemInfo(com.android.launcher3.model.data.ItemInfo) ApplicationInfo(android.content.pm.ApplicationInfo) LauncherAppWidgetInfo(com.android.launcher3.model.data.LauncherAppWidgetInfo) AppInfo(com.android.launcher3.model.data.AppInfo) HashSet(java.util.HashSet)

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