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

Commit 05ea4390 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Attempt to fix the ActivityThreadClientTest test case failed."

parents 9be3548c 6d12c9c9
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -25,10 +25,12 @@ import static android.app.servertransaction.ActivityLifecycleItem.ON_STOP;

import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.mockitoSession;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;

import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.when;

import android.app.Activity;
@@ -36,6 +38,7 @@ import android.app.ActivityTaskManager;
import android.app.ActivityThread;
import android.app.ActivityThread.ActivityClientRecord;
import android.app.IActivityTaskManager;
import android.app.LoadedApk;
import android.app.servertransaction.PendingTransactionActions;
import android.content.ComponentName;
import android.content.Intent;
@@ -346,6 +349,14 @@ public class ActivityThreadClientTest {
            info.applicationInfo.packageName = info.packageName;
            info.applicationInfo.uid = UserHandle.myUserId();

            // mock the function for preventing NPE in emulator environment. The purpose of the
            // test is for activity client state changes, we don't focus on the updating for the
            // ApplicationInfo.
            LoadedApk packageInfo = mThread.peekPackageInfo(info.packageName,
                    true /* includeCode */);
            spyOn(packageInfo);
            doNothing().when(packageInfo).updateApplicationInfo(any(), any());

            return new ActivityClientRecord(new Binder(), Intent.makeMainActivity(component),
                    0 /* ident */, info, new Configuration(),
                    CompatibilityInfo.DEFAULT_COMPATIBILITY_INFO, null /* referrer */,