Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e96443e5 authored by Jason Monk's avatar Jason Monk
Browse files

Make Instrumentation more robust to other inputs

Test: atest cts/tests/app/src/android/app/cts/InstrumentationTest.java
Change-Id: I2d55274ab19c4687ce85c086f2da61a4316b8096
Fixes: 70720100
parent 0c179a94
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1210,11 +1210,16 @@ public class Instrumentation {
            Intent intent)
            throws InstantiationException, IllegalAccessException,
            ClassNotFoundException {
        String pkg = intent.getComponent().getPackageName();
        String pkg = intent != null && intent.getComponent() != null
                ? intent.getComponent().getPackageName() : null;
        return getFactory(pkg).instantiateActivity(cl, className, intent);
    }

    private AppComponentFactory getFactory(String pkg) {
        if (pkg == null) {
            Log.e(TAG, "No pkg specified, disabling AppComponentFactory");
            return AppComponentFactory.DEFAULT;
        }
        if (mThread == null) {
            Log.e(TAG, "Uninitialized ActivityThread, likely app-created Instrumentation,"
                    + " disabling AppComponentFactory", new Throwable());