Merge "Not using shell command to enable test provider" into sc-v2-dev am: 7d87779deb

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15533100

Change-Id: Ia359325ff80abaa1a43d52207d01085d0f700d38
This commit is contained in:
TreeHugger Robot
2021-08-12 23:14:39 +00:00
committed by Automerger Merge Worker
@@ -66,7 +66,6 @@ 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;
@@ -246,16 +245,12 @@ public final class LauncherInstrumentation {
ComponentName cn = new ComponentName(pi.packageName, pi.name);
if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) {
if (TestHelpers.isInLauncherProcess()) {
mInstrumentation.getUiAutomation().adoptShellPermissionIdentity(
android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE);
try {
pm.setComponentEnabledSetting(cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP);
} else {
try {
final int userId = ContextUtils.getUserId(getContext());
mDevice.executeShellCommand(
"pm enable --user " + userId + " " + cn.flattenToString());
} catch (IOException e) {
fail(e.toString());
}
} finally {
mInstrumentation.getUiAutomation().dropShellPermissionIdentity();
}
}
}
@@ -305,7 +300,7 @@ public final class LauncherInstrumentation {
public boolean isTwoPanels() {
return getTestInfo(TestProtocol.REQUEST_IS_TWO_PANELS)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
private void setForcePauseTimeout(long timeout) {