mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
LauncherInstrumentation enables even when non-system user
Attempting to run a tapl test while the device is in a secondary user
currently fails because the test app doesn't get enabled for
this secondary user. We fix that (at least one issue with it) in this cl.
Test: make PlatformScenarioTests; adb root && adb install -r -g ${ANDROID_PRODUCT_OUT}/testcases/PlatformScenarioTests/$(get_build_var TARGET_ARCH)/PlatformScenarioTests.apk
adb shell am instrument -w -r -e class android.platform.test.scenario.chrome.OpenApp android.platform.test.scenario/androidx.test.runner.AndroidJUnitRunner
(Do this while the current user is SYSTEM as well as Guest)
Bug: 162454040
Change-Id: If6d8e545b41eb20e3fed2935c39069ce97d8b6cd
This commit is contained in:
@@ -64,6 +64,7 @@ import androidx.test.uiautomator.Until;
|
||||
|
||||
import com.android.launcher3.ResourceUtils;
|
||||
import com.android.launcher3.testing.TestProtocol;
|
||||
import com.android.systemui.shared.system.ContextUtils;
|
||||
import com.android.systemui.shared.system.QuickStepContract;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -238,11 +239,12 @@ public final class LauncherInstrumentation {
|
||||
|
||||
if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) {
|
||||
if (TestHelpers.isInLauncherProcess()) {
|
||||
getContext().getPackageManager().setComponentEnabledSetting(
|
||||
cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
|
||||
pm.setComponentEnabledSetting(cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
|
||||
} else {
|
||||
try {
|
||||
mDevice.executeShellCommand("pm enable " + cn.flattenToString());
|
||||
final int userId = ContextUtils.getUserId(getContext());
|
||||
mDevice.executeShellCommand(
|
||||
"pm enable --user " + userId + " " + cn.flattenToString());
|
||||
} catch (IOException e) {
|
||||
fail(e.toString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user