Search in sources :

Example 1 with AppLaunchTracker

use of com.android.launcher3.model.AppLaunchTracker in project android_packages_apps_Trebuchet by LineageOS.

the class AbstractLauncherUiTest method setUp.

@Before
public void setUp() throws Exception {
    Log.d(TAG, "Before disabling battery defender");
    mDevice.executeShellCommand("setprop vendor.battery.defender.disable 1");
    Log.d(TAG, "Before enabling stay awake");
    mDevice.executeShellCommand("settings put global stay_on_while_plugged_in 3");
    for (int i = 0; i < 10 && hasSystemUiObject("keyguard_status_view"); ++i) {
        Log.d(TAG, "Before unlocking the phone");
        mDevice.executeShellCommand("input keyevent 82");
        mDevice.waitForIdle();
    }
    Assert.assertTrue("Keyguard still visible", mDevice.wait(Until.gone(By.res(SYSTEMUI_PACKAGE, "keyguard_status_view")), 60000));
    Log.d(TAG, "Keyguard is not visible");
    final String launcherPackageName = mDevice.getLauncherPackageName();
    try {
        final Context context = InstrumentationRegistry.getContext();
        final PackageManager pm = context.getPackageManager();
        final PackageInfo launcherPackage = pm.getPackageInfo(launcherPackageName, 0);
        if (!launcherPackage.versionName.equals("BuildFromAndroidStudio")) {
            Assert.assertEquals("Launcher version doesn't match tests version", pm.getPackageInfo(context.getPackageName(), 0).getLongVersionCode(), launcherPackage.getLongVersionCode());
        }
    } catch (PackageManager.NameNotFoundException e) {
        throw new RuntimeException(e);
    }
    mLauncherPid = 0;
    // Disable app tracker
    AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
    mTargetContext = InstrumentationRegistry.getTargetContext();
    mTargetPackage = mTargetContext.getPackageName();
    mLauncherPid = mLauncher.getPid();
    UserManager userManager = mTargetContext.getSystemService(UserManager.class);
    if (userManager != null) {
        for (UserHandle userHandle : userManager.getUserProfiles()) {
            if (!userHandle.isSystem()) {
                mDevice.executeShellCommand("pm remove-user " + userHandle.getIdentifier());
            }
        }
    }
}
Also used : Context(android.content.Context) AppLaunchTracker(com.android.launcher3.model.AppLaunchTracker) PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) UserManager(android.os.UserManager) UserHandle(android.os.UserHandle) Before(org.junit.Before)

Example 2 with AppLaunchTracker

use of com.android.launcher3.model.AppLaunchTracker in project android_packages_apps_Trebuchet by LineageOS.

the class AppPredictionsUITests method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    List<LauncherActivityInfo> activities = mTargetContext.getSystemService(LauncherApps.class).getActivityList(null, Process.myUserHandle());
    mSampleApp1 = activities.get(0);
    mSampleApp2 = activities.get(1);
    mSampleApp3 = activities.get(2);
    // Disable app tracker
    AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
    PredictionUiStateManager.INSTANCE.initializeForTesting(null);
    mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(Client.HOME);
    mDevice.setOrientationNatural();
}
Also used : AppLaunchTracker(com.android.launcher3.model.AppLaunchTracker) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) LauncherApps(android.content.pm.LauncherApps) Before(org.junit.Before)

Example 3 with AppLaunchTracker

use of com.android.launcher3.model.AppLaunchTracker in project Neo-Launcher by NeoApplications.

the class AppPredictionsUITests method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    List<LauncherActivityInfo> activities = LauncherAppsCompat.getInstance(mTargetContext).getActivityList(null, Process.myUserHandle());
    mSampleApp1 = activities.get(0);
    mSampleApp2 = activities.get(1);
    mSampleApp3 = activities.get(2);
    // Disable app tracker
    AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
    PredictionUiStateManager.INSTANCE.initializeForTesting(null);
    mCallback = PredictionUiStateManager.INSTANCE.get(mTargetContext).appPredictorCallback(Client.HOME);
    mDevice.setOrientationNatural();
}
Also used : AppLaunchTracker(com.android.launcher3.model.AppLaunchTracker) LauncherActivityInfo(android.content.pm.LauncherActivityInfo) Before(org.junit.Before)

Example 4 with AppLaunchTracker

use of com.android.launcher3.model.AppLaunchTracker in project Neo-Launcher by NeoApplications.

the class AbstractLauncherUiTest method setUp.

@Before
public void setUp() throws Exception {
    // Disable app tracker
    AppLaunchTracker.INSTANCE.initializeForTesting(new AppLaunchTracker());
    mTargetContext = InstrumentationRegistry.getTargetContext();
    mTargetPackage = mTargetContext.getPackageName();
}
Also used : AppLaunchTracker(com.android.launcher3.model.AppLaunchTracker) Before(org.junit.Before)

Aggregations

AppLaunchTracker (com.android.launcher3.model.AppLaunchTracker)4 Before (org.junit.Before)4 LauncherActivityInfo (android.content.pm.LauncherActivityInfo)2 Context (android.content.Context)1 LauncherApps (android.content.pm.LauncherApps)1 PackageInfo (android.content.pm.PackageInfo)1 PackageManager (android.content.pm.PackageManager)1 UserHandle (android.os.UserHandle)1 UserManager (android.os.UserManager)1