Remove redundant appInfo field in ActivityRecord

ActivityRecord#appInfo contains duplicate information already present
in ActivityRecord#info. Since it can be updated at runtime, it needs
to be non-final and we need to remember to always update them
together.

This CL removes the appInfo field and switches all usages to
info.applicationInfo instead. No change in logic.

Test: Build and flash
Change-Id: Ia637a5874d2ec1f5516f7fb23e00c5a99e11f0a9
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
index bc0f747..a0a2967 100644
--- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
+++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java
@@ -225,7 +225,7 @@
 
         private WindowingModeTransitionInfoSnapshot(WindowingModeTransitionInfo info,
                 ActivityRecord launchedActivity, int windowsFullyDrawnDelayMs) {
-            applicationInfo = launchedActivity.appInfo;
+            applicationInfo = launchedActivity.info.applicationInfo;
             packageName = launchedActivity.packageName;
             launchedActivityName = launchedActivity.info.name;
             launchedActivityLaunchedFromPackage = launchedActivity.launchedFromPackage;
@@ -582,7 +582,7 @@
             final WindowingModeTransitionInfo info = mWindowingModeTransitionInfo.valueAt(i);
 
             // App isn't attached to record yet, so match with info.
-            if (info.launchedActivity.appInfo == appInfo) {
+            if (info.launchedActivity.info.applicationInfo == appInfo) {
                 info.bindApplicationDelayMs = calculateCurrentDelay();
             }
         }
@@ -649,13 +649,13 @@
         mMetricsLogger.write(builder);
         StatsLog.write(
                 StatsLog.APP_START_CANCELED,
-                info.launchedActivity.appInfo.uid,
+                info.launchedActivity.info.applicationInfo.uid,
                 info.launchedActivity.packageName,
                 convertAppStartTransitionType(type),
                 info.launchedActivity.info.name);
         if (DEBUG_METRICS) {
             Slog.i(TAG, String.format("APP_START_CANCELED(%s, %s, %s, %s)",
-                    info.launchedActivity.appInfo.uid,
+                    info.launchedActivity.info.applicationInfo.uid,
                     info.launchedActivity.packageName,
                     convertAppStartTransitionType(type),
                     info.launchedActivity.info.name));
@@ -821,7 +821,7 @@
         mMetricsLogger.write(builder);
         StatsLog.write(
                 StatsLog.APP_START_FULLY_DRAWN,
-                info.launchedActivity.appInfo.uid,
+                info.launchedActivity.info.applicationInfo.uid,
                 info.launchedActivity.packageName,
                 restoredFromBundle
                         ? StatsLog.APP_START_FULLY_DRAWN__TYPE__WITH_BUNDLE
@@ -961,7 +961,7 @@
     private WindowProcessController findProcessForActivity(ActivityRecord launchedActivity) {
         return launchedActivity != null
                 ? mSupervisor.mService.mProcessNames.get(
-                        launchedActivity.processName, launchedActivity.appInfo.uid)
+                        launchedActivity.processName, launchedActivity.info.applicationInfo.uid)
                 : null;
     }
 
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index ba61055..657b1b4 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -245,8 +245,6 @@
     private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;
     private static final String TAG_FOCUS = TAG + POSTFIX_FOCUS;
 
-    private static final boolean SHOW_ACTIVITY_START_TIME = true;
-
     private static final String ATTR_ID = "id";
     private static final String TAG_INTENT = "intent";
     private static final String ATTR_USERID = "user_id";
@@ -262,9 +260,7 @@
     // TODO: Remove after unification
     AppWindowToken mAppWindowToken;
 
-    final ActivityInfo info; // all about me
-    // TODO: This is duplicated state already contained in info.applicationInfo - remove
-    ApplicationInfo appInfo; // information about activity's app
+    final ActivityInfo info; // activity info provided by developer in AndroidManifest
     final int launchedFromPid; // always the pid who started the activity.
     final int launchedFromUid; // always the uid who started the activity.
     final String launchedFromPackage; // always the package who started the activity.
@@ -447,7 +443,8 @@
         pw.print(prefix); pw.print("taskAffinity="); pw.println(taskAffinity);
         pw.print(prefix); pw.print("mActivityComponent=");
                 pw.println(mActivityComponent.flattenToShortString());
-        if (appInfo != null) {
+        if (info != null && info.applicationInfo != null) {
+            final ApplicationInfo appInfo = info.applicationInfo;
             pw.print(prefix); pw.print("baseDir="); pw.println(appInfo.sourceDir);
             if (!Objects.equals(appInfo.sourceDir, appInfo.publicSourceDir)) {
                 pw.print(prefix); pw.print("resDir="); pw.println(appInfo.publicSourceDir);
@@ -617,7 +614,6 @@
     }
 
     void updateApplicationInfo(ApplicationInfo aInfo) {
-        appInfo = aInfo;
         info.applicationInfo = aInfo;
     }
 
@@ -991,7 +987,6 @@
         }
         taskAffinity = aInfo.taskAffinity;
         stateNotNeeded = (aInfo.flags & FLAG_STATE_NOT_NEEDED) != 0;
-        appInfo = aInfo.applicationInfo;
         nonLocalizedLabel = aInfo.nonLocalizedLabel;
         labelRes = aInfo.labelRes;
         if (nonLocalizedLabel == null && labelRes == 0) {
@@ -1050,7 +1045,8 @@
 
         mRotationAnimationHint = aInfo.rotationAnimation;
         lockTaskLaunchMode = aInfo.lockTaskLaunchMode;
-        if (appInfo.isPrivilegedApp() && (lockTaskLaunchMode == LOCK_TASK_LAUNCH_MODE_ALWAYS
+        if (info.applicationInfo.isPrivilegedApp()
+                && (lockTaskLaunchMode == LOCK_TASK_LAUNCH_MODE_ALWAYS
                 || lockTaskLaunchMode == LOCK_TASK_LAUNCH_MODE_NEVER)) {
             lockTaskLaunchMode = LOCK_TASK_LAUNCH_MODE_DEFAULT;
         }
@@ -1120,7 +1116,8 @@
                     task.voiceSession != null, container.getDisplayContent(),
                     ActivityTaskManagerService.getInputDispatchingTimeoutLocked(this)
                             * 1000000L, fullscreen,
-                    (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0, appInfo.targetSdkVersion,
+                    (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0,
+                    info.applicationInfo.targetSdkVersion,
                     info.screenOrientation, mRotationAnimationHint,
                     mLaunchTaskBehind, isAlwaysFocusable());
             if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) {
@@ -1289,7 +1286,7 @@
                 info.resizeMode = RESIZE_MODE_UNRESIZEABLE;
             }
         } else if (mAtmService.getRecentTasks().isRecentsComponent(mActivityComponent,
-                appInfo.uid)) {
+                info.applicationInfo.uid)) {
             activityType = ACTIVITY_TYPE_RECENTS;
         } else if (options != null && options.getLaunchActivityType() == ACTIVITY_TYPE_ASSISTANT
                 && canLaunchAssistActivity(launchedFromPackage)) {
@@ -1487,7 +1484,7 @@
      */
     private boolean checkEnterPictureInPictureAppOpsState() {
         return mAtmService.getAppOpsService().checkOperation(
-                OP_PICTURE_IN_PICTURE, appInfo.uid, packageName) == MODE_ALLOWED;
+                OP_PICTURE_IN_PICTURE, info.applicationInfo.uid, packageName) == MODE_ALLOWED;
     }
 
     boolean isAlwaysFocusable() {
@@ -2466,8 +2463,8 @@
 
         if (windowFromSameProcessAsActivity) {
             return mAtmService.mAmInternal.inputDispatchingTimedOut(anrApp.mOwner,
-                    anrActivity.shortComponentName, anrActivity.appInfo, shortComponentName,
-                    app, false, reason);
+                    anrActivity.shortComponentName, anrActivity.info.applicationInfo,
+                    shortComponentName, app, false, reason);
         } else {
             // In this case another process added windows using this activity token. So, we call the
             // generic service input dispatch timed out method so that the right process is blamed.
@@ -3363,7 +3360,7 @@
         // If a device is in VR mode, and we're transitioning into VR ui mode, add ignore ui mode
         // to the config change.
         // For O and later, apps will be required to add configChanges="uimode" to their manifest.
-        if (appInfo.targetSdkVersion < O
+        if (info.applicationInfo.targetSdkVersion < O
                 && requestedVrComponent != null
                 && onlyVrUiModeChanged) {
             configChanged |= CONFIG_UI_MODE;
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 156fb98..d5bb5c9 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -782,7 +782,7 @@
                 && !topActivity.noDisplay) {
             // Inform the user that they are starting an app that may not work correctly in
             // multi-window mode.
-            final String packageName = topActivity.appInfo.packageName;
+            final String packageName = topActivity.info.applicationInfo.packageName;
             mService.getTaskChangeNotificationController().notifyActivityForcedResizable(
                     topTask.taskId, FORCED_RESIZEABLE_REASON_SPLIT_SCREEN, packageName);
         }
diff --git a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
index cc508d4..a6e9c05 100644
--- a/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
+++ b/services/core/java/com/android/server/wm/ActivityStackSupervisor.java
@@ -761,10 +761,10 @@
 
             final int applicationInfoUid =
                     (r.info.applicationInfo != null) ? r.info.applicationInfo.uid : -1;
-            if ((r.mUserId != proc.mUserId) || (r.appInfo.uid != applicationInfoUid)) {
+            if ((r.mUserId != proc.mUserId) || (r.info.applicationInfo.uid != applicationInfoUid)) {
                 Slog.wtf(TAG,
                         "User ID for activity changing for " + r
-                                + " appInfo.uid=" + r.appInfo.uid
+                                + " appInfo.uid=" + r.info.applicationInfo.uid
                                 + " info.ai.uid=" + applicationInfoUid
                                 + " old=" + r.app + " new=" + proc);
             }
@@ -2462,7 +2462,7 @@
             return;
         }
         mService.getTaskChangeNotificationController().notifyActivityForcedResizable(
-                task.taskId, reason, topActivity.appInfo.packageName);
+                task.taskId, reason, topActivity.info.applicationInfo.packageName);
     }
 
     void activityRelaunchedLocked(IBinder token) {
diff --git a/services/core/java/com/android/server/wm/ActivityStarter.java b/services/core/java/com/android/server/wm/ActivityStarter.java
index 0a88eef..d4284dd 100644
--- a/services/core/java/com/android/server/wm/ActivityStarter.java
+++ b/services/core/java/com/android/server/wm/ActivityStarter.java
@@ -1684,7 +1684,8 @@
         mService.mUgmInternal.grantUriPermissionFromIntent(mCallingUid, mStartActivity.packageName,
                 mIntent, mStartActivity.getUriPermissionsLocked(), mStartActivity.mUserId);
         mService.getPackageManagerInternalLocked().grantEphemeralAccess(
-                mStartActivity.mUserId, mIntent, UserHandle.getAppId(mStartActivity.appInfo.uid),
+                mStartActivity.mUserId, mIntent,
+                UserHandle.getAppId(mStartActivity.info.applicationInfo.uid),
                 UserHandle.getAppId(mCallingUid));
         if (newTask) {
             EventLog.writeEvent(EventLogTags.AM_CREATE_TASK, mStartActivity.mUserId,
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index 16dd555..046ab55 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -3741,7 +3741,7 @@
                     voiceInteractor);
             long token = Binder.clearCallingIdentity();
             try {
-                startRunningVoiceLocked(voiceSession, activityToCallback.appInfo.uid);
+                startRunningVoiceLocked(voiceSession, activityToCallback.info.applicationInfo.uid);
             } finally {
                 Binder.restoreCallingIdentity(token);
             }
@@ -4108,8 +4108,9 @@
                         final ActivityStack stack = r.getActivityStack();
                         stack.setPictureInPictureAspectRatio(aspectRatio);
                         stack.setPictureInPictureActions(actions);
-                        MetricsLoggerWrapper.logPictureInPictureEnter(mContext, r.appInfo.uid,
-                                r.shortComponentName, r.supportsEnterPipOnTaskSwitch);
+                        MetricsLoggerWrapper.logPictureInPictureEnter(mContext,
+                                r.info.applicationInfo.uid, r.shortComponentName,
+                                r.supportsEnterPipOnTaskSwitch);
                         logPictureInPictureArgs(params);
                     }
                 };
diff --git a/services/core/java/com/android/server/wm/AppWarnings.java b/services/core/java/com/android/server/wm/AppWarnings.java
index 6c3fbc1..21b6809 100644
--- a/services/core/java/com/android/server/wm/AppWarnings.java
+++ b/services/core/java/com/android/server/wm/AppWarnings.java
@@ -105,7 +105,8 @@
     public void showUnsupportedDisplaySizeDialogIfNeeded(ActivityRecord r) {
         final Configuration globalConfig = mAtm.getGlobalConfiguration();
         if (globalConfig.densityDpi != DisplayMetrics.DENSITY_DEVICE_STABLE
-                && r.appInfo.requiresSmallestWidthDp > globalConfig.smallestScreenWidthDp) {
+                && r.info.applicationInfo.requiresSmallestWidthDp
+                > globalConfig.smallestScreenWidthDp) {
             mUiHandler.showUnsupportedDisplaySizeDialog(r);
         }
     }
@@ -116,7 +117,8 @@
      * @param r activity record for which the warning may be displayed
      */
     public void showUnsupportedCompileSdkDialogIfNeeded(ActivityRecord r) {
-        if (r.appInfo.compileSdkVersion == 0 || r.appInfo.compileSdkVersionCodename == null) {
+        if (r.info.applicationInfo.compileSdkVersion == 0
+                || r.info.applicationInfo.compileSdkVersionCodename == null) {
             // We don't know enough about this package. Abort!
             return;
         }
@@ -135,14 +137,16 @@
         // the application was built OR both are pre-release with the same SDK_INT but different
         // codenames (e.g. simultaneous pre-release development), then we're likely to run into
         // compatibility issues. Warn the user and offer to check for an update.
-        final int compileSdk = r.appInfo.compileSdkVersion;
+        final int compileSdk = r.info.applicationInfo.compileSdkVersion;
         final int platformSdk = Build.VERSION.SDK_INT;
-        final boolean isCompileSdkPreview = !"REL".equals(r.appInfo.compileSdkVersionCodename);
+        final boolean isCompileSdkPreview =
+                !"REL".equals(r.info.applicationInfo.compileSdkVersionCodename);
         final boolean isPlatformSdkPreview = !"REL".equals(Build.VERSION.CODENAME);
         if ((isCompileSdkPreview && compileSdk < platformSdk)
                 || (isPlatformSdkPreview && platformSdk < compileSdk)
                 || (isCompileSdkPreview && isPlatformSdkPreview && platformSdk == compileSdk
-                    && !Build.VERSION.CODENAME.equals(r.appInfo.compileSdkVersionCodename))) {
+                    && !Build.VERSION.CODENAME.equals(
+                            r.info.applicationInfo.compileSdkVersionCodename))) {
             mUiHandler.showUnsupportedCompileSdkDialog(r);
         }
     }
@@ -153,7 +157,7 @@
      * @param r activity record for which the warning may be displayed
      */
     public void showDeprecatedTargetDialogIfNeeded(ActivityRecord r) {
-        if (r.appInfo.targetSdkVersion < Build.VERSION.MIN_SUPPORTED_TARGET_SDK_INT) {
+        if (r.info.applicationInfo.targetSdkVersion < Build.VERSION.MIN_SUPPORTED_TARGET_SDK_INT) {
             mUiHandler.showDeprecatedTargetDialog(r);
         }
     }
diff --git a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
index e2d0acd..0d18b30 100644
--- a/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
+++ b/services/core/java/com/android/server/wm/TaskLaunchParamsModifier.java
@@ -423,8 +423,8 @@
      * @return {@code true} if it should be forced to maximize; {@code false} otherwise.
      */
     private boolean isTaskForcedMaximized(@NonNull ActivityRecord root) {
-        if (root.appInfo.targetSdkVersion < Build.VERSION_CODES.DONUT
-                || (root.appInfo.flags & SUPPORTS_SCREEN_RESIZEABLE_MASK) == 0) {
+        if (root.info.applicationInfo.targetSdkVersion < Build.VERSION_CODES.DONUT
+                || (root.info.applicationInfo.flags & SUPPORTS_SCREEN_RESIZEABLE_MASK) == 0) {
             return true;
         }
 
diff --git a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
index c4b0a80..29398b6 100644
--- a/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
+++ b/services/tests/wmtests/src/com/android/server/wm/TaskLaunchParamsModifierTests.java
@@ -76,7 +76,7 @@
     @Before
     public void setUp() throws Exception {
         mActivity = new ActivityBuilder(mService).build();
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.N_MR1;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.N_MR1;
         mActivity.info.applicationInfo.flags |= ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES;
 
         mTarget = new TaskLaunchParamsModifier(mSupervisor);
@@ -402,7 +402,7 @@
         mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
         mCurrent.mBounds.set(0, 0, 200, 100);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.CUPCAKE;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.CUPCAKE;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -424,7 +424,7 @@
         mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
         mCurrent.mBounds.set(0, 0, 200, 100);
 
-        mActivity.appInfo.flags = 0;
+        mActivity.info.applicationInfo.flags = 0;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -525,7 +525,7 @@
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchDisplayId(freeformDisplay.mDisplayId);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -539,7 +539,7 @@
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchDisplayId(DEFAULT_DISPLAY);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -892,7 +892,7 @@
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchDisplayId(freeformDisplay.mDisplayId);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -916,7 +916,7 @@
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchDisplayId(freeformDisplay.mDisplayId);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -941,7 +941,7 @@
         final ActivityRecord source = createSourceActivity(freeformDisplay);
         source.setBounds(0, 0, 412, 732);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, source, options, mCurrent, mResult));
@@ -968,7 +968,7 @@
         final ActivityRecord source = createSourceActivity(freeformDisplay);
         source.setBounds(0, 0, 200, 400);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, source, options, mCurrent, mResult));
@@ -990,7 +990,7 @@
         final ActivityRecord source = createSourceActivity(freeformDisplay);
         source.setBounds(1720, 680, 1920, 1080);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, source, options, mCurrent, mResult));
@@ -1012,7 +1012,7 @@
         mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
         mCurrent.mBounds.set(100, 200, 2120, 1380);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -1038,7 +1038,7 @@
         mCurrent.mWindowingMode = WINDOWING_MODE_FREEFORM;
         mCurrent.mBounds.set(100, 200, 2120, 1380);
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, /* layout */ null,
                 mActivity, /* source */ null, options, mCurrent, mResult));
@@ -1058,7 +1058,7 @@
         final ActivityInfo.WindowLayout layout = new WindowLayoutBuilder()
                 .setMinWidth(500).setMinHeight(800).build();
 
-        mActivity.appInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
+        mActivity.info.applicationInfo.targetSdkVersion = Build.VERSION_CODES.LOLLIPOP;
 
         assertEquals(RESULT_CONTINUE, mTarget.onCalculate(/* task */ null, layout, mActivity,
                 /* source */ null, options, mCurrent, mResult));