summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java2
-rw-r--r--tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java2
-rw-r--r--tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java2
-rw-r--r--tests/AttestationVerificationTest/src/android/security/attestationverification/PeerDeviceSystemAttestationVerificationTest.kt2
-rw-r--r--tests/AttestationVerificationTest/src/android/security/attestationverification/SystemAttestationVerificationTest.kt2
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java191
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java16
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java4
-rw-r--r--tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java36
-rw-r--r--tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java2
-rw-r--r--tests/Input/OWNERS1
-rw-r--r--tests/Input/src/com/android/test/input/AnrTest.kt2
-rw-r--r--tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt4
-rw-r--r--tests/Internal/src/stub/DummyWallpaperService.java2
-rw-r--r--tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java8
-rw-r--r--tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt60
-rw-r--r--tests/SilkFX/src/com/android/test/silkfx/materials/BackgroundBlurActivity.kt12
-rw-r--r--tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt6
-rw-r--r--tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java2
-rw-r--r--tests/StagedInstallTest/OWNERS2
-rw-r--r--tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt2
-rw-r--r--tests/TrustTests/src/android/trust/test/lib/ScreenLockRule.kt2
-rw-r--r--tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java2
-rw-r--r--tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java4
-rw-r--r--tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java28
25 files changed, 100 insertions, 296 deletions
diff --git a/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java b/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
index 0f694c293330..fe9126003967 100644
--- a/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
+++ b/tests/ApkVerityTest/ApkVerityTestApp/feature_split/src/com/android/apkverity/feature_x/DummyActivity.java
@@ -18,5 +18,5 @@ package com.android.apkverity.feature_x;
import android.app.Activity;
-/** Dummy class just to generate some dex */
+/** Placeholder class just to generate some dex */
public class DummyActivity extends Activity {}
diff --git a/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java b/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
index 837c7be37504..a7bd771400c0 100644
--- a/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
+++ b/tests/ApkVerityTest/ApkVerityTestApp/src/com/android/apkverity/DummyActivity.java
@@ -18,5 +18,5 @@ package com.android.apkverity;
import android.app.Activity;
-/** Dummy class just to generate some dex */
+/** Placeholder class just to generate some dex */
public class DummyActivity extends Activity {}
diff --git a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
index 1a58f17ef6a0..fa452dd78873 100644
--- a/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
+++ b/tests/AppLaunch/src/com/android/tests/applaunch/AppLaunch.java
@@ -674,7 +674,7 @@ public class AppLaunch extends InstrumentationTestCase {
return true;
}
- // iorap compiler filters specified: the compilerFilter must be in the whitelist.
+ // iorap compiler filters specified: the compilerFilter must be in the allowlist.
if (mIorapCompilerFilters.indexOf(compilerFilter) != -1) {
return true;
}
diff --git a/tests/AttestationVerificationTest/src/android/security/attestationverification/PeerDeviceSystemAttestationVerificationTest.kt b/tests/AttestationVerificationTest/src/android/security/attestationverification/PeerDeviceSystemAttestationVerificationTest.kt
index 32c2230e4880..ad95fbc36867 100644
--- a/tests/AttestationVerificationTest/src/android/security/attestationverification/PeerDeviceSystemAttestationVerificationTest.kt
+++ b/tests/AttestationVerificationTest/src/android/security/attestationverification/PeerDeviceSystemAttestationVerificationTest.kt
@@ -39,7 +39,7 @@ class PeerDeviceSystemAttestationVerificationTest {
@Before
fun setup() {
rule.getScenario().onActivity {
- avm = it.getSystemService(AttestationVerificationManager::class.java)
+ avm = it.getSystemService(AttestationVerificationManager::class.java)!!
activity = it
}
invalidAttestationByteArray = TEST_ATTESTATION_CERT_FILENAME.fromPEMFileToByteArray()
diff --git a/tests/AttestationVerificationTest/src/android/security/attestationverification/SystemAttestationVerificationTest.kt b/tests/AttestationVerificationTest/src/android/security/attestationverification/SystemAttestationVerificationTest.kt
index 169effaa45ca..8f06b4a2ea0a 100644
--- a/tests/AttestationVerificationTest/src/android/security/attestationverification/SystemAttestationVerificationTest.kt
+++ b/tests/AttestationVerificationTest/src/android/security/attestationverification/SystemAttestationVerificationTest.kt
@@ -43,7 +43,7 @@ class SystemAttestationVerificationTest {
@Before
fun setup() {
rule.getScenario().onActivity {
- avm = it.getSystemService(AttestationVerificationManager::class.java)
+ avm = it.getSystemService(AttestationVerificationManager::class.java)!!
activity = it
androidKeystore = KeyStore.getInstance(ANDROID_KEYSTORE).apply { load(null) }
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
index 216e743938ca..df140b976768 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/BackingStore.java
@@ -14,17 +14,10 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
import android.graphics.Bitmap;
-import android.os.Build;
-import android.renderscript.Allocation;
-import android.renderscript.Element;
-import android.renderscript.RenderScript;
-import android.renderscript.Type;
import android.util.Log;
import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.Vector;
@@ -42,14 +35,11 @@ final class BackingStore {
static final int ACCESS_OBJECT = 0x08;
/** Access mode Bitmap: Frame data will be accessed as a Bitmap. */
static final int ACCESS_BITMAP = 0x10;
- /** Access mode Allocation: Frame data will be accessed as a RenderScript Allocation. */
- static final int ACCESS_ALLOCATION = 0x20;
private static final int BACKING_BYTEBUFFER = 1;
private static final int BACKING_TEXTURE = 2;
private static final int BACKING_OBJECT = 3;
private static final int BACKING_BITMAP = 4;
- private static final int BACKING_ALLOCATION = 5;
private final FrameType mType;
private int[] mDimensions;
@@ -243,14 +233,6 @@ final class BackingStore {
case ACCESS_BITMAP:
backing = new BitmapBacking();
break;
- case ACCESS_ALLOCATION:
- if (!AllocationBacking.isSupported()) {
- throw new RuntimeException(
- "Attempted to create an AllocationBacking in context that does " +
- "not support RenderScript!");
- }
- backing = new AllocationBacking(mFrameManager.getContext().getRenderScript());
- break;
}
if (backing == null) {
throw new RuntimeException(
@@ -518,9 +500,6 @@ final class BackingStore {
RenderTarget renderTarget = (RenderTarget) backing.lock(ACCESS_RENDERTARGET);
mBitmap.copyPixelsFromBuffer(
renderTarget.getPixelData(mDimensions[0], mDimensions[1]));
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- createBitmap();
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -528,12 +507,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- allocation.copyTo(mBitmap);
- }
-
@Override
public Object lock(int accessType) {
return mBitmap;
@@ -612,8 +585,6 @@ final class BackingStore {
int w = mDimensions[0];
int h = mDimensions[1];
ImageShader.renderTextureToTarget(texture, getRenderTarget(), w, h);
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -621,14 +592,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- ByteBuffer pixels = ByteBuffer.allocateDirect(getSize());
- allocation.copyTo(pixels.array());
- mTexture.allocateWithPixels(pixels, mDimensions[0], mDimensions[1]);
- }
-
@Override
public Object lock(int accessType) {
switch (accessType) {
@@ -733,8 +696,6 @@ final class BackingStore {
ByteBuffer otherBuffer = (ByteBuffer) backing.lock(ACCESS_BYTES);
mBuffer.put(otherBuffer);
otherBuffer.rewind();
- } else if ((access & ACCESS_ALLOCATION) != 0 && AllocationBacking.isSupported()) {
- syncToAllocationBacking(backing);
} else {
throw new RuntimeException("Cannot sync bytebuffer backing!");
}
@@ -743,23 +704,6 @@ final class BackingStore {
mIsDirty = false;
}
- @TargetApi(11)
- private void syncToAllocationBacking(Backing backing) {
- Allocation allocation = (Allocation) backing.lock(ACCESS_ALLOCATION);
- if (getElementId() == FrameType.ELEMENT_RGBA8888) {
- byte[] bytes = mBuffer.array();
- allocation.copyTo(bytes);
- } else if (getElementId() == FrameType.ELEMENT_FLOAT32) {
- float[] floats = new float[getSize() / 4];
- allocation.copyTo(floats);
- mBuffer.asFloatBuffer().put(floats);
- } else {
- throw new RuntimeException(
- "Trying to sync to an allocation with an unsupported element id: "
- + getElementId());
- }
- }
-
@Override
public Object lock(int accessType) {
return mBuffer.rewind();
@@ -791,139 +735,4 @@ final class BackingStore {
}
}
-
- @TargetApi(11)
- static class AllocationBacking extends Backing {
-
- private final RenderScript mRenderScript;
- private Allocation mAllocation = null;
-
- public AllocationBacking(RenderScript renderScript) {
- mRenderScript = renderScript;
- }
-
- @Override
- public void allocate(FrameType frameType) {
- assertCompatible(frameType);
-
- Element element = null;
- switch (frameType.getElementId()) {
- case FrameType.ELEMENT_RGBA8888:
- element = Element.RGBA_8888(mRenderScript);
- break;
- case FrameType.ELEMENT_FLOAT32:
- element = Element.F32(mRenderScript);
- break;
- }
- Type.Builder imageTypeBuilder = new Type.Builder(mRenderScript, element);
- imageTypeBuilder.setX(mDimensions.length >= 1 ? mDimensions[0] : 1);
- imageTypeBuilder.setY(mDimensions.length == 2 ? mDimensions[1] : 1);
- Type imageType = imageTypeBuilder.create();
-
- mAllocation = Allocation.createTyped(mRenderScript, imageType);
- }
-
- @Override
- public int readAccess() {
- return ACCESS_ALLOCATION;
- }
-
- @Override
- public int writeAccess() {
- return ACCESS_ALLOCATION;
- }
-
- @Override
- public boolean requiresGpu() {
- return false;
- }
-
- @Override
- public void syncTo(Backing backing) {
- int access = backing.readAccess();
- if ((access & ACCESS_TEXTURE) != 0) {
- RenderTarget target = (RenderTarget) backing.lock(ACCESS_RENDERTARGET);
- ByteBuffer pixels = ByteBuffer.allocateDirect(getSize());
- GLToolbox.readTarget(target, pixels, mDimensions[0], mDimensions[1]);
- mAllocation.copyFrom(pixels.array());
- } else if ((access & ACCESS_BITMAP) != 0) {
- Bitmap bitmap = (Bitmap) backing.lock(ACCESS_BITMAP);
- mAllocation.copyFrom(bitmap);
- } else if ((access & ACCESS_BYTES) != 0) {
- ByteBuffer buffer = (ByteBuffer) backing.lock(ACCESS_BYTES);
- if (buffer.order() != ByteOrder.nativeOrder()) {
- throw new RuntimeException(
- "Trying to sync to the ByteBufferBacking with non-native byte order!");
- }
- byte[] bytes;
- if (buffer.hasArray()) {
- bytes = buffer.array();
- } else {
- bytes = new byte[getSize()];
- buffer.get(bytes);
- buffer.rewind();
- }
- mAllocation.copyFromUnchecked(bytes);
- } else {
- throw new RuntimeException("Cannot sync allocation backing!");
- }
- backing.unlock();
- mIsDirty = false;
- }
-
- @Override
- public Object lock(int accessType) {
- return mAllocation;
- }
-
- @Override
- public void unlock() {
- }
-
- @Override
- public int getType() {
- return BACKING_ALLOCATION;
- }
-
- @Override
- public boolean shouldCache() {
- return true;
- }
-
- @Override
- public void destroy() {
- if (mAllocation != null) {
- mAllocation.destroy();
- mAllocation = null;
- }
- }
-
- @Override
- public int getSize() {
- int elementCount = 1;
- for (int dim : mDimensions) {
- elementCount *= dim;
- }
- return getElementSize() * elementCount;
- }
-
- public static boolean isSupported() {
- return Build.VERSION.SDK_INT >= 11;
- }
-
- private void assertCompatible(FrameType type) {
- // TODO: consider adding support for other data types.
- if (type.getElementId() != FrameType.ELEMENT_RGBA8888
- && type.getElementId() != FrameType.ELEMENT_FLOAT32) {
- throw new RuntimeException(
- "Cannot allocate allocation with a non-RGBA or non-float data type!");
- }
- if (mDimensions == null || mDimensions.length > 2) {
- throw new RuntimeException(
- "Cannot create an allocation with more than 2 dimensions!");
- }
- }
-
- }
-
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
index 0e24f5be954a..20cc1bf3cb80 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/FrameBuffer1D.java
@@ -16,9 +16,6 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
-import android.renderscript.Allocation;
-
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
@@ -40,19 +37,6 @@ public class FrameBuffer1D extends Frame {
return (ByteBuffer)mBackingStore.lockData(mode, BackingStore.ACCESS_BYTES);
}
- /**
- * Access frame's data using a RenderScript {@link Allocation}.
- * This is a convenience method and is equivalent to calling {@code lockData} with an
- * {@code accessFormat} of {@code ACCESS_ALLOCATION}.
- *
- * @return The Allocation instance holding the Frame's data.
- */
- @TargetApi(11)
- public Allocation lockAllocation(int mode) {
- assertAccessible(mode);
- return (Allocation) mBackingStore.lockData(mode, BackingStore.ACCESS_ALLOCATION);
- }
-
public int getLength() {
return mLength;
}
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
index 001396527267..4b7ca5306bfb 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/GraphExporter.java
@@ -113,7 +113,7 @@ public class GraphExporter {
getDotName(target.getFilter().getName()) + ":" +
getDotName(target.getName()) + "_IN;\n" );
} else {
- // Found a unconnected output port, add dummy node
+ // Found a unconnected output port, add placeholder node
String color = filter.getSignature().getOutputPortInfo(portName).isRequired()
? "red" : "blue"; // red for unconnected, required ports
dotFile.write(" " +
@@ -131,7 +131,7 @@ public class GraphExporter {
if(target != null) {
// Found a connection -- nothing to do, connections have been written out above
} else {
- // Found a unconnected input port, add dummy node
+ // Found a unconnected input port, add placeholder node
String color = filter.getSignature().getInputPortInfo(portName).isRequired()
? "red" : "blue"; // red for unconnected, required ports
dotFile.write(" " +
diff --git a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
index b7212f982bce..8fd44d2df975 100644
--- a/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
+++ b/tests/Camera2Tests/SmartCamera/SimpleCamera/src/androidx/media/filterfw/MffContext.java
@@ -16,15 +16,12 @@
package androidx.media.filterfw;
-import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ConfigurationInfo;
-import android.os.Build;
import android.os.Handler;
import android.os.Looper;
-import android.renderscript.RenderScript;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
@@ -66,9 +63,9 @@ public class MffContext {
/**
* On older Android versions the Camera may need a SurfaceView to render into in order to
- * function. You may specify a dummy SurfaceView here if you do not want the context to
+ * function. You may specify a placeholder SurfaceView here if you do not want the context to
* create its own view. Note, that your view may or may not be used. You cannot rely on
- * your dummy view to be used by the Camera. If you pass null, no dummy view will be used.
+ * your placeholder view to be used by the Camera. If you pass null, no placeholder view will be used.
* In this case your application may not run correctly on older devices if you use the
* camera. This flag has no effect if you do not require the camera.
*/
@@ -104,7 +101,7 @@ public class MffContext {
/** The current context state. */
private State mState = new State();
- /** A dummy SurfaceView that is required for Camera operation on older devices. */
+ /** A placeholder SurfaceView that is required for Camera operation on older devices. */
private SurfaceView mDummySurfaceView = null;
/** Handler to execute code in the context's thread, such as issuing callbacks. */
@@ -116,9 +113,6 @@ public class MffContext {
/** Flag whether camera streaming is supported in this context. */
private boolean mCameraStreamingSupport;
- /** RenderScript base master class. */
- private RenderScript mRenderScript;
-
/**
* Creates a new MffContext with the default configuration.
*
@@ -126,7 +120,7 @@ public class MffContext {
* multiple MffContexts, however data between them cannot be shared. The context must be
* created in a thread with a Looper (such as the main/UI thread).
*
- * On older versions of Android, the MffContext may create a visible dummy view for the
+ * On older versions of Android, the MffContext may create a visible placeholder view for the
* camera to render into. This is a 1x1 SurfaceView that is placed into the top-left corner.
*
* @param context The application context to attach the MffContext to.
@@ -142,7 +136,7 @@ public class MffContext {
* multiple MffContexts, however data between them cannot be shared. The context must be
* created in a thread with a Looper (such as the main/UI thread).
*
- * On older versions of Android, the MffContext may create a visible dummy view for the
+ * On older versions of Android, the MffContext may create a visible placeholder view for the
* camera to render into. This is a 1x1 SurfaceView that is placed into the top-left corner.
* You may alternatively specify your own SurfaceView in the configuration.
*
@@ -200,9 +194,7 @@ public class MffContext {
mCameraStreamer.stop();
mCameraStreamer.tearDown();
}
- if (Build.VERSION.SDK_INT >= 11) {
- maybeDestroyRenderScript();
- }
+
stopRunners(false);
waitUntilStopped();
tearDown();
@@ -301,14 +293,6 @@ public class MffContext {
return mCameraStreamingSupport;
}
- @TargetApi(11)
- public final RenderScript getRenderScript() {
- if (mRenderScript == null) {
- mRenderScript = RenderScript.create(mApplicationContext);
- }
- return mRenderScript;
- }
-
final void assertOpenGLSupported() {
if (!isOpenGLSupported()) {
throw new RuntimeException("Attempting to use OpenGL ES 2 in a context that does not "
@@ -459,12 +443,4 @@ public class MffContext {
return (context instanceof Activity) ? (Activity) context : null;
}
- @TargetApi(11)
- private void maybeDestroyRenderScript() {
- if (mRenderScript != null) {
- mRenderScript.destroy();
- mRenderScript = null;
- }
- }
-
}
diff --git a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
index e995a26ea5c9..2ca91fbc1d3d 100644
--- a/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
+++ b/tests/DynamicCodeLoggerIntegrationTests/src/com/android/dcl/Simple.java
@@ -16,7 +16,7 @@
package com.android.dcl;
-/** Dummy class which is built into a jar purely so we can pass it to DexClassLoader. */
+/** Placeholder class which is built into a jar purely so we can pass it to DexClassLoader. */
public final class Simple {
public Simple() {}
}
diff --git a/tests/Input/OWNERS b/tests/Input/OWNERS
index d701f23cb9b8..3cffce960b1c 100644
--- a/tests/Input/OWNERS
+++ b/tests/Input/OWNERS
@@ -1 +1,2 @@
+# Bug component: 136048
include /core/java/android/hardware/input/OWNERS
diff --git a/tests/Input/src/com/android/test/input/AnrTest.kt b/tests/Input/src/com/android/test/input/AnrTest.kt
index d185ee6ae116..7bc5df52e316 100644
--- a/tests/Input/src/com/android/test/input/AnrTest.kt
+++ b/tests/Input/src/com/android/test/input/AnrTest.kt
@@ -134,7 +134,7 @@ class AnrTest {
private fun getExitReasons(): List<ApplicationExitInfo> {
lateinit var infos: List<ApplicationExitInfo>
instrumentation.runOnMainSync {
- val am = instrumentation.getContext().getSystemService(ActivityManager::class.java)
+ val am = instrumentation.getContext().getSystemService(ActivityManager::class.java)!!
infos = am.getHistoricalProcessExitReasons(PACKAGE_NAME, ALL_PIDS, NO_MAX)
}
return infos
diff --git a/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt b/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt
index 3a24406e2b73..63782f1bf955 100644
--- a/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt
+++ b/tests/Input/src/com/android/test/input/UnresponsiveGestureMonitorActivity.kt
@@ -45,9 +45,9 @@ class UnresponsiveGestureMonitorActivity : Activity() {
private lateinit var mInputMonitor: InputMonitor
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- val inputManager = getSystemService(InputManager::class.java)
+ val inputManager = checkNotNull(getSystemService(InputManager::class.java))
mInputMonitor = inputManager.monitorGestureInput(MONITOR_NAME, displayId)
mInputEventReceiver = UnresponsiveReceiver(
- mInputMonitor.getInputChannel(), Looper.myLooper())
+ mInputMonitor.getInputChannel(), Looper.myLooper()!!)
}
}
diff --git a/tests/Internal/src/stub/DummyWallpaperService.java b/tests/Internal/src/stub/DummyWallpaperService.java
index 084c036bea26..db1b7805a316 100644
--- a/tests/Internal/src/stub/DummyWallpaperService.java
+++ b/tests/Internal/src/stub/DummyWallpaperService.java
@@ -19,7 +19,7 @@ package stub;
import android.service.wallpaper.WallpaperService;
/**
- * Dummy wallpaper service only for test purposes, won't draw anything.
+ * Placeholder wallpaper service only for test purposes, won't draw anything.
*/
public class DummyWallpaperService extends WallpaperService {
@Override
diff --git a/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java b/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
index 731be8e3d9f0..a77950fe4a2d 100644
--- a/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
+++ b/tests/PlatformCompatGating/src/com/android/compat/testing/DummyApi.java
@@ -24,7 +24,7 @@ import android.os.ServiceManager;
import com.android.internal.compat.IPlatformCompat;
/**
- * This is a dummy API to test gating
+ * This is a placeholder API to test gating
*
* @hide
*/
@@ -36,7 +36,7 @@ public class DummyApi {
public static final long CHANGE_SYSTEM_SERVER = 666016;
/**
- * Dummy method
+ * Placeholder method
* @return "A" if change is enabled, "B" otherwise.
*/
public static String dummyFunc() {
@@ -47,7 +47,7 @@ public class DummyApi {
}
/**
- * Dummy combined method
+ * Placeholder combined method
* @return "0" if {@link CHANGE_ID_1} is disabled and {@link CHANGE_ID_2} is disabled,
"1" if {@link CHANGE_ID_1} is disabled and {@link CHANGE_ID_2} is enabled,
"2" if {@link CHANGE_ID_1} is enabled and {@link CHANGE_ID_2} is disabled,
@@ -68,7 +68,7 @@ public class DummyApi {
}
/**
- * Dummy api using system server API.
+ * Placeholder api using system server API.
*/
public static boolean dummySystemServer(Context context) {
IPlatformCompat platformCompat = IPlatformCompat.Stub
diff --git a/tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt b/tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt
index 8a653045c97b..1a79a11a3718 100644
--- a/tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt
+++ b/tests/SilkFX/src/com/android/test/silkfx/hdr/GainmapMetadataEditor.kt
@@ -99,23 +99,23 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
(view.getParent() as ViewGroup).removeView(view)
parent.addView(view)
- view.findViewById<Button>(R.id.gainmap_metadata_done)!!.setOnClickListener {
+ view.requireViewById<Button>(R.id.gainmap_metadata_done).setOnClickListener {
closeEditor()
}
- view.findViewById<Button>(R.id.gainmap_metadata_reset)!!.setOnClickListener {
+ view.requireViewById<Button>(R.id.gainmap_metadata_reset).setOnClickListener {
resetGainmapMetadata()
}
updateMetadataUi()
- val gainmapMinSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_gainmapmin)
- val gainmapMaxSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_gainmapmax)
- val capacityMinSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_capacitymin)
- val capacityMaxSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_capacitymax)
- val gammaSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_gamma)
- val offsetSdrSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_offsetsdr)
- val offsetHdrSeek = view.findViewById<SeekBar>(R.id.gainmap_metadata_offsethdr)
+ val gainmapMinSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_gainmapmin)
+ val gainmapMaxSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_gainmapmax)
+ val capacityMinSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_capacitymin)
+ val capacityMaxSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_capacitymax)
+ val gammaSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_gamma)
+ val offsetSdrSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_offsetsdr)
+ val offsetHdrSeek = view.requireViewById<SeekBar>(R.id.gainmap_metadata_offsethdr)
arrayOf(gainmapMinSeek, gainmapMaxSeek, capacityMinSeek, capacityMaxSeek, gammaSeek,
offsetSdrSeek, offsetHdrSeek).forEach {
it.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener{
@@ -140,13 +140,13 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
}
private fun updateMetadataUi() {
- val gainmapMinSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_gainmapmin)
- val gainmapMaxSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_gainmapmax)
- val capacityMinSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_capacitymin)
- val capacityMaxSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_capacitymax)
- val gammaSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_gamma)
- val offsetSdrSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_offsetsdr)
- val offsetHdrSeek = parent.findViewById<SeekBar>(R.id.gainmap_metadata_offsethdr)
+ val gainmapMinSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_gainmapmin)
+ val gainmapMaxSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_gainmapmax)
+ val capacityMinSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_capacitymin)
+ val capacityMaxSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_capacitymax)
+ val gammaSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_gamma)
+ val offsetSdrSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_offsetsdr)
+ val offsetHdrSeek = parent.requireViewById<SeekBar>(R.id.gainmap_metadata_offsethdr)
gainmapMinSeek.setProgress(
((currentMetadata.ratioMin - minRatioMin) / maxRatioMin * maxProgress).toInt())
@@ -166,19 +166,19 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
((1.0 - Math.log(currentMetadata.offsetHdr.toDouble() / Math.log(3.0)) / -11.0)
.toFloat() * maxProgress).toInt())
- parent.findViewById<TextView>(R.id.gainmap_metadata_gainmapmin_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gainmapmin_val).setText(
"%.3f".format(currentMetadata.ratioMin))
- parent.findViewById<TextView>(R.id.gainmap_metadata_gainmapmax_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gainmapmax_val).setText(
"%.3f".format(currentMetadata.ratioMax))
- parent.findViewById<TextView>(R.id.gainmap_metadata_capacitymin_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_capacitymin_val).setText(
"%.3f".format(currentMetadata.capacityMin))
- parent.findViewById<TextView>(R.id.gainmap_metadata_capacitymax_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_capacitymax_val).setText(
"%.3f".format(currentMetadata.capacityMax))
- parent.findViewById<TextView>(R.id.gainmap_metadata_gamma_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gamma_val).setText(
"%.3f".format(currentMetadata.gamma))
- parent.findViewById<TextView>(R.id.gainmap_metadata_offsetsdr_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_offsetsdr_val).setText(
"%.5f".format(currentMetadata.offsetSdr))
- parent.findViewById<TextView>(R.id.gainmap_metadata_offsethdr_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_offsethdr_val).setText(
"%.5f".format(currentMetadata.offsetHdr))
}
@@ -201,7 +201,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
private fun updateGainmapMin(normalized: Float) {
val newValue = minRatioMin + normalized * (maxRatioMin - minRatioMin)
- parent.findViewById<TextView>(R.id.gainmap_metadata_gainmapmin_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gainmapmin_val).setText(
"%.3f".format(newValue))
currentMetadata.ratioMin = newValue
if (showingEdits) {
@@ -212,7 +212,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
private fun updateGainmapMax(normalized: Float) {
val newValue = minRatioMax + normalized * (maxRatioMax - minRatioMax)
- parent.findViewById<TextView>(R.id.gainmap_metadata_gainmapmax_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gainmapmax_val).setText(
"%.3f".format(newValue))
currentMetadata.ratioMax = newValue
if (showingEdits) {
@@ -223,7 +223,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
private fun updateCapacityMin(normalized: Float) {
val newValue = minCapacityMin + normalized * (maxCapacityMin - minCapacityMin)
- parent.findViewById<TextView>(R.id.gainmap_metadata_capacitymin_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_capacitymin_val).setText(
"%.3f".format(newValue))
currentMetadata.capacityMin = newValue
if (showingEdits) {
@@ -234,7 +234,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
private fun updateCapacityMax(normalized: Float) {
val newValue = minCapacityMax + normalized * (maxCapacityMax - minCapacityMax)
- parent.findViewById<TextView>(R.id.gainmap_metadata_capacitymax_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_capacitymax_val).setText(
"%.3f".format(newValue))
currentMetadata.capacityMax = newValue
if (showingEdits) {
@@ -245,7 +245,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
private fun updateGamma(normalized: Float) {
val newValue = minGamma + normalized * (maxGamma - minGamma)
- parent.findViewById<TextView>(R.id.gainmap_metadata_gamma_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_gamma_val).setText(
"%.3f".format(newValue))
currentMetadata.gamma = newValue
if (showingEdits) {
@@ -259,7 +259,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
if (normalized > 0.0f ) {
newValue = Math.pow(3.0, (1.0 - normalized.toDouble()) * -11.0).toFloat()
}
- parent.findViewById<TextView>(R.id.gainmap_metadata_offsetsdr_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_offsetsdr_val).setText(
"%.5f".format(newValue))
currentMetadata.offsetSdr = newValue
if (showingEdits) {
@@ -273,7 +273,7 @@ class GainmapMetadataEditor(val parent: ViewGroup, val renderView: View) {
if (normalized > 0.0f ) {
newValue = Math.pow(3.0, (1.0 - normalized.toDouble()) * -11.0).toFloat()
}
- parent.findViewById<TextView>(R.id.gainmap_metadata_offsethdr_val)!!.setText(
+ parent.requireViewById<TextView>(R.id.gainmap_metadata_offsethdr_val).setText(
"%.5f".format(newValue))
currentMetadata.offsetHdr = newValue
if (showingEdits) {
diff --git a/tests/SilkFX/src/com/android/test/silkfx/materials/BackgroundBlurActivity.kt b/tests/SilkFX/src/com/android/test/silkfx/materials/BackgroundBlurActivity.kt
index 9d17d38d4298..4d38660e6029 100644
--- a/tests/SilkFX/src/com/android/test/silkfx/materials/BackgroundBlurActivity.kt
+++ b/tests/SilkFX/src/com/android/test/silkfx/materials/BackgroundBlurActivity.kt
@@ -132,7 +132,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
mBlurForceDisabled = disabled
Settings.Global.putInt(getContentResolver(), Settings.Global.DISABLE_WINDOW_BLURS,
if (mBlurForceDisabled) 1 else 0)
- (findViewById(R.id.toggle_blur_enabled) as Button)
+ (requireViewById(R.id.toggle_blur_enabled) as Button)
.setText(if (mBlurForceDisabled) "Enable blurs" else "Disable blurs")
}
@@ -142,13 +142,13 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
fun setBackgroundBlur(radius: Int) {
mBackgroundBlurRadius = radius
- (findViewById(R.id.background_blur_radius) as TextView).setText(radius.toString())
+ (requireViewById(R.id.background_blur_radius) as TextView).setText(radius.toString())
window.setBackgroundBlurRadius(mBackgroundBlurRadius)
}
fun setBlurBehind(radius: Int) {
mBlurBehindRadius = radius
- (findViewById(R.id.blur_behind_radius) as TextView).setText(radius.toString())
+ (requireViewById(R.id.blur_behind_radius) as TextView).setText(radius.toString())
window.getAttributes().setBlurBehindRadius(mBlurBehindRadius)
window.setAttributes(window.getAttributes())
}
@@ -159,7 +159,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
} else {
mDimAmountNoBlur = amount
}
- (findViewById(R.id.dim_amount) as TextView).setText("%.2f".format(amount))
+ (requireViewById(R.id.dim_amount) as TextView).setText("%.2f".format(amount))
window.getAttributes().dimAmount = amount
window.setAttributes(window.getAttributes())
}
@@ -168,7 +168,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
mBatterySavingModeOn = on
Settings.Global.putInt(getContentResolver(),
Settings.Global.LOW_POWER_MODE, if (on) 1 else 0)
- (findViewById(R.id.toggle_battery_saving_mode) as Button).setText(
+ (requireViewById(R.id.toggle_battery_saving_mode) as Button).setText(
if (on) "Exit low power mode" else "Enter low power mode")
}
@@ -182,7 +182,7 @@ class BackgroundBlurActivity : Activity(), SeekBar.OnSeekBarChangeListener {
} else {
mAlphaNoBlur = alpha
}
- (findViewById(R.id.background_alpha) as TextView).setText("%.2f".format(alpha))
+ (requireViewById(R.id.background_alpha) as TextView).setText("%.2f".format(alpha))
mBackgroundDrawable.setAlpha((alpha * 255f).toInt())
getWindowManager().updateViewLayout(window.getDecorView(), window.getAttributes())
}
diff --git a/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt
index 2f2578b87f35..41baeadf7a8c 100644
--- a/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt
+++ b/tests/SilkFX/src/com/android/test/silkfx/materials/GlassView.kt
@@ -190,9 +190,9 @@ class GlassView(context: Context, attributeSet: AttributeSet) : FrameLayout(cont
sensorManager?.unregisterListener(sensorListener)
}
- override fun onDraw(canvas: Canvas?) {
+ override fun onDraw(canvas: Canvas) {
updateGlassRenderNode()
- canvas?.drawRenderNode(renderNode)
+ canvas.drawRenderNode(renderNode)
}
fun resetGyroOffsets() {
@@ -227,4 +227,4 @@ class GlassView(context: Context, attributeSet: AttributeSet) : FrameLayout(cont
renderNodeIsDirty = false
}
}
-} \ No newline at end of file
+}
diff --git a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
index 3567c08d0285..cc6cebf88907 100644
--- a/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
+++ b/tests/SoundTriggerTestApp/src/com/android/test/soundtrigger/SoundTriggerTestService.java
@@ -469,7 +469,7 @@ public class SoundTriggerTestService extends Service {
}
}
- // Create a few dummy models if we didn't load anything.
+ // Create a few placeholder models if we didn't load anything.
if (!loadedModel) {
Properties dummyModelProperties = new Properties();
for (String name : new String[]{"1", "2", "3"}) {
diff --git a/tests/StagedInstallTest/OWNERS b/tests/StagedInstallTest/OWNERS
index aac68e994a39..d7301dc9c895 100644
--- a/tests/StagedInstallTest/OWNERS
+++ b/tests/StagedInstallTest/OWNERS
@@ -1,3 +1,5 @@
+# Bug component: 36137
+
include /services/core/java/com/android/server/pm/OWNERS
dariofreni@google.com
diff --git a/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt b/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt
index 1400dde5781d..c1a7bd9e1d8f 100644
--- a/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt
+++ b/tests/TrustTests/src/android/trust/test/lib/LockStateTrackingRule.kt
@@ -30,7 +30,7 @@ import org.junit.runners.model.Statement
*/
class LockStateTrackingRule : TestRule {
private val context: Context = getApplicationContext()
- private val windowManager = WindowManagerGlobal.getWindowManagerService()
+ private val windowManager = checkNotNull(WindowManagerGlobal.getWindowManagerService())
@Volatile lateinit var lockState: LockState
private set
diff --git a/tests/TrustTests/src/android/trust/test/lib/ScreenLockRule.kt b/tests/TrustTests/src/android/trust/test/lib/ScreenLockRule.kt
index 4189baae10cb..f1edca3ff86e 100644
--- a/tests/TrustTests/src/android/trust/test/lib/ScreenLockRule.kt
+++ b/tests/TrustTests/src/android/trust/test/lib/ScreenLockRule.kt
@@ -36,7 +36,7 @@ import org.junit.runners.model.Statement
class ScreenLockRule : TestRule {
private val context: Context = getApplicationContext()
private val uiDevice = UiDevice.getInstance(getInstrumentation())
- private val windowManager = WindowManagerGlobal.getWindowManagerService()
+ private val windowManager = checkNotNull(WindowManagerGlobal.getWindowManagerService())
private val lockPatternUtils = LockPatternUtils(context)
private var instantLockSavedValue = false
diff --git a/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
index 9999aba37d8d..673c73aa2aac 100644
--- a/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
+++ b/tests/libs-permissions/system_ext/java/com/android/test/libs/system_ext/LibsSystemExtTest.java
@@ -22,7 +22,7 @@ package com.android.test.libs.system_ext;
public class LibsSystemExtTest {
/**
- * Dummy method for testing.
+ * Placeholder method for testing.
*/
public static void test() {
}
diff --git a/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java b/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
index b94bb41c0988..d10ae307fdf4 100644
--- a/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
+++ b/tests/utils/testutils/java/android/os/test/FakePermissionEnforcer.java
@@ -47,6 +47,10 @@ public class FakePermissionEnforcer extends PermissionEnforcer {
mGranted.remove(permission);
}
+ public void revokeAll() {
+ mGranted.clear();
+ }
+
private boolean granted(String permission) {
return mGranted.contains(permission);
}
diff --git a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
index 89271e1218d8..302af523a4bd 100644
--- a/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
+++ b/tests/vcn/java/com/android/server/vcn/VcnGatewayConnectionConnectedStateTest.java
@@ -42,6 +42,7 @@ import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
@@ -345,6 +346,33 @@ public class VcnGatewayConnectionConnectedStateTest extends VcnGatewayConnection
verify(mConnMgr).reportNetworkConnectivity(eq(mNetworkAgent.getNetwork()), eq(false));
}
+ @Test
+ public void testMigrationHandleFailure() throws Exception {
+ triggerChildOpened();
+ mTestLooper.dispatchAll();
+ assertEquals(mIkeConnectionInfo, mGatewayConnection.getIkeConnectionInfo());
+
+ mGatewayConnection
+ .getUnderlyingNetworkControllerCallback()
+ .onSelectedUnderlyingNetworkChanged(TEST_UNDERLYING_NETWORK_RECORD_2);
+
+ final IkeSessionConnectionInfo newIkeConnectionInfo =
+ new IkeSessionConnectionInfo(
+ TEST_ADDR_V4, TEST_ADDR_V4_2, TEST_UNDERLYING_NETWORK_RECORD_2.network);
+ getIkeSessionCallback().onIkeSessionConnectionInfoChanged(newIkeConnectionInfo);
+ getChildSessionCallback()
+ .onIpSecTransformsMigrated(makeDummyIpSecTransform(), makeDummyIpSecTransform());
+
+ doThrow(new IllegalArgumentException("testMigrationHandleFailure"))
+ .when(mIpSecSvc)
+ .setNetworkForTunnelInterface(anyInt(), any(), any());
+
+ mTestLooper.dispatchAll();
+
+ assertEquals(mGatewayConnection.mDisconnectingState, mGatewayConnection.getCurrentState());
+ verify(mIkeSession).close();
+ }
+
private void triggerChildOpened() {
triggerChildOpened(Collections.singletonList(TEST_INTERNAL_ADDR), TEST_DNS_ADDR);
}