Loading tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +11 −6 Original line number Diff line number Diff line Loading @@ -66,6 +66,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; Loading Loading @@ -245,12 +246,16 @@ public final class LauncherInstrumentation { ComponentName cn = new ComponentName(pi.packageName, pi.name); if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) { mInstrumentation.getUiAutomation().adoptShellPermissionIdentity( android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE); try { if (TestHelpers.isInLauncherProcess()) { pm.setComponentEnabledSetting(cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP); } finally { mInstrumentation.getUiAutomation().dropShellPermissionIdentity(); } else { try { final int userId = ContextUtils.getUserId(getContext()); mDevice.executeShellCommand( "pm enable --user " + userId + " " + cn.flattenToString()); } catch (IOException e) { fail(e.toString()); } } } } Loading Loading
tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +11 −6 Original line number Diff line number Diff line Loading @@ -66,6 +66,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; Loading Loading @@ -245,12 +246,16 @@ public final class LauncherInstrumentation { ComponentName cn = new ComponentName(pi.packageName, pi.name); if (pm.getComponentEnabledSetting(cn) != COMPONENT_ENABLED_STATE_ENABLED) { mInstrumentation.getUiAutomation().adoptShellPermissionIdentity( android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE); try { if (TestHelpers.isInLauncherProcess()) { pm.setComponentEnabledSetting(cn, COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP); } finally { mInstrumentation.getUiAutomation().dropShellPermissionIdentity(); } else { try { final int userId = ContextUtils.getUserId(getContext()); mDevice.executeShellCommand( "pm enable --user " + userId + " " + cn.flattenToString()); } catch (IOException e) { fail(e.toString()); } } } } Loading