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

Commit 79a784c5 authored by Eric Chiang's avatar Eric Chiang Committed by Android (Google) Code Review
Browse files

Merge "Prevent private VDs from being density scaled." into main

parents 1cc2c1f7 79632388
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1457,10 +1457,10 @@ public final class ActivityThread extends ClientTransactionHandler
        private void updateCompatOverrideScale(CompatibilityInfo info) {
            if (info.hasOverrideScaling()) {
                CompatibilityInfo.setOverrideInvertedScale(info.applicationInvertedScale,
                        info.applicationDensityInvertedScale);
                        info.applicationDensityInvertedScale, info.overrideDensityDisplayIds);
            } else {
                CompatibilityInfo.setOverrideInvertedScale(/* invertScale */ 1f,
                        /* densityInvertScale */1f);
                        /* densityInvertScale */1f, /* densityDisplayIds */ null);
            }
        }

@@ -6779,7 +6779,7 @@ public final class ActivityThread extends ClientTransactionHandler
        final ActivityRelaunchItem activityRelaunchItem = new ActivityRelaunchItem(
                r.token, null /* pendingResults */, null /* pendingIntents */,
                0 /* configChanges */, mergedConfiguration, r.mPreserveWindow,
                r.getActivityWindowInfo());
                r.getActivityWindowInfo(), r.activity.getDisplayId());
        // Make sure to match the existing lifecycle state in the end of the transaction.
        final ActivityLifecycleItem lifecycleRequest =
                TransactionExecutorHelper.getLifecycleRequestForCurrentState(r);
+12 −4
Original line number Diff line number Diff line
@@ -46,17 +46,20 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {

    @NonNull
    private final ActivityWindowInfo mActivityWindowInfo;
    private final int mDisplayId;

    public ActivityConfigurationChangeItem(@NonNull IBinder activityToken,
            @NonNull Configuration config, @NonNull ActivityWindowInfo activityWindowInfo) {
            @NonNull Configuration config, @NonNull ActivityWindowInfo activityWindowInfo,
            int displayId) {
        super(activityToken);
        mConfiguration = new Configuration(config);
        mActivityWindowInfo = new ActivityWindowInfo(activityWindowInfo);
        mDisplayId = displayId;
    }

    @Override
    public void preExecute(@NonNull ClientTransactionHandler client) {
        CompatibilityInfo.applyOverrideIfNeeded(mConfiguration);
        CompatibilityInfo.applyOverrideIfNeeded(mConfiguration, mDisplayId);
        // Notify the client of an upcoming change in the token configuration. This ensures that
        // batches of config change items only process the newest configuration.
        client.updatePendingActivityConfiguration(getActivityToken(), mConfiguration);
@@ -80,6 +83,7 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {
        super.writeToParcel(dest, flags);
        dest.writeTypedObject(mConfiguration, flags);
        dest.writeTypedObject(mActivityWindowInfo, flags);
        dest.writeInt(mDisplayId);
    }

    /** Reads from Parcel. */
@@ -87,6 +91,7 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {
        super(in);
        mConfiguration = requireNonNull(in.readTypedObject(Configuration.CREATOR));
        mActivityWindowInfo = requireNonNull(in.readTypedObject(ActivityWindowInfo.CREATOR));
        mDisplayId = in.readInt();
    }

    public static final @NonNull Creator<ActivityConfigurationChangeItem> CREATOR =
@@ -110,7 +115,8 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {
        }
        final ActivityConfigurationChangeItem other = (ActivityConfigurationChangeItem) o;
        return Objects.equals(mConfiguration, other.mConfiguration)
                && Objects.equals(mActivityWindowInfo, other.mActivityWindowInfo);
                && Objects.equals(mActivityWindowInfo, other.mActivityWindowInfo)
                && mDisplayId == other.mDisplayId;
    }

    @Override
@@ -119,6 +125,7 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {
        result = 31 * result + super.hashCode();
        result = 31 * result + Objects.hashCode(mConfiguration);
        result = 31 * result + Objects.hashCode(mActivityWindowInfo);
        result = 31 * result + mDisplayId;
        return result;
    }

@@ -126,6 +133,7 @@ public class ActivityConfigurationChangeItem extends ActivityTransactionItem {
    public String toString() {
        return "ActivityConfigurationChange{" + super.toString()
                + ",config=" + mConfiguration
                + ",activityWindowInfo=" + mActivityWindowInfo + "}";
                + ",activityWindowInfo=" + mActivityWindowInfo
                + ",displayId=" + mDisplayId + "}";
    }
}
+11 −4
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {

    private final int mConfigChanges;
    private final boolean mPreserveWindow;
    private final int mDisplayId;

    /**
     * A record that was properly configured for relaunch. Execution will be cancelled if not
@@ -74,7 +75,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
            @Nullable List<ResultInfo> pendingResults,
            @Nullable List<ReferrerIntent> pendingNewIntents, int configChanges,
            @NonNull MergedConfiguration config, boolean preserveWindow,
            @NonNull ActivityWindowInfo activityWindowInfo) {
            @NonNull ActivityWindowInfo activityWindowInfo, int displayId) {
        super(activityToken);
        mPendingResults = pendingResults != null ? new ArrayList<>(pendingResults) : null;
        mPendingNewIntents =
@@ -83,13 +84,14 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
        mActivityWindowInfo = new ActivityWindowInfo(activityWindowInfo);
        mConfigChanges = configChanges;
        mPreserveWindow = preserveWindow;
        mDisplayId = displayId;
    }

    @Override
    public void preExecute(@NonNull ClientTransactionHandler client) {
        // The local config is already scaled so only apply if this item is from server side.
        if (!client.isExecutingLocalTransaction()) {
            CompatibilityInfo.applyOverrideIfNeeded(mConfig);
            CompatibilityInfo.applyOverrideIfNeeded(mConfig, mDisplayId);
        }
        mActivityClientRecord = client.prepareRelaunchActivity(getActivityToken(), mPendingResults,
                mPendingNewIntents, mConfigChanges, mConfig, mPreserveWindow, mActivityWindowInfo);
@@ -126,6 +128,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
        dest.writeTypedObject(mActivityWindowInfo, flags);
        dest.writeInt(mConfigChanges);
        dest.writeBoolean(mPreserveWindow);
        dest.writeInt(mDisplayId);
    }

    /** Reads from Parcel. */
@@ -137,6 +140,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
        mActivityWindowInfo = requireNonNull(in.readTypedObject(ActivityWindowInfo.CREATOR));
        mConfigChanges = in.readInt();
        mPreserveWindow = in.readBoolean();
        mDisplayId = in.readInt();
    }

    public static final @NonNull Creator<ActivityRelaunchItem> CREATOR =
@@ -164,7 +168,8 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
                && Objects.equals(mConfig, other.mConfig)
                && Objects.equals(mActivityWindowInfo, other.mActivityWindowInfo)
                && mConfigChanges == other.mConfigChanges
                && mPreserveWindow == other.mPreserveWindow;
                && mPreserveWindow == other.mPreserveWindow
                && mDisplayId == other.mDisplayId;
    }

    @Override
@@ -177,6 +182,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
        result = 31 * result + Objects.hashCode(mActivityWindowInfo);
        result = 31 * result + mConfigChanges;
        result = 31 * result + (mPreserveWindow ? 1 : 0);
        result = 31 * result + mDisplayId;
        return result;
    }

@@ -188,6 +194,7 @@ public class ActivityRelaunchItem extends ActivityTransactionItem {
                + ",config=" + mConfig
                + ",activityWindowInfo=" + mActivityWindowInfo
                + ",configChanges=" + mConfigChanges
                + ",preserveWindow=" + mPreserveWindow + "}";
                + ",preserveWindow=" + mPreserveWindow
                + ",displayId=" + mDisplayId + "}";
    }
}
+14 −7
Original line number Diff line number Diff line
@@ -130,6 +130,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
    private final int mProcState;
    private final boolean mIsForward;
    private final boolean mLaunchedFromBubble;
    private final int mDisplayId;

    public LaunchActivityItem(@NonNull IBinder activityToken, @NonNull Intent intent,
            int ident, @NonNull ActivityInfo info, @NonNull Configuration curConfig,
@@ -143,7 +144,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
            @Nullable IActivityClientController activityClientController,
            @NonNull IBinder shareableActivityToken, boolean launchedFromBubble,
            @Nullable IBinder taskFragmentToken, @NonNull IBinder initialCallerInfoAccessToken,
            @NonNull ActivityWindowInfo activityWindowInfo) {
            @NonNull ActivityWindowInfo activityWindowInfo, int displayId) {
        this(activityToken, ident, new Configuration(curConfig), new Configuration(overrideConfig),
                deviceId, referrer, voiceInteractor, procState,
                state != null ? new Bundle(state) : null,
@@ -154,7 +155,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                profilerInfo != null ? new ProfilerInfo(profilerInfo) : null,
                assistToken, activityClientController, shareableActivityToken, launchedFromBubble,
                taskFragmentToken, initialCallerInfoAccessToken,
                new ActivityWindowInfo(activityWindowInfo));
                new ActivityWindowInfo(activityWindowInfo), displayId);
        mIntent = new Intent(intent);
        mInfo = new ActivityInfo(info);
    }
@@ -173,7 +174,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
            @Nullable IActivityClientController activityClientController,
            @NonNull IBinder shareableActivityToken, boolean launchedFromBubble,
            @Nullable IBinder taskFragmentToken, @NonNull IBinder initialCallerInfoAccessToken,
            @NonNull ActivityWindowInfo activityWindowInfo) {
            @NonNull ActivityWindowInfo activityWindowInfo, int displayId) {
        mActivityToken = activityToken;
        mIdent = ident;
        mCurConfig = curConfig;
@@ -196,14 +197,15 @@ public class LaunchActivityItem extends ClientTransactionItem {
        mTaskFragmentToken = taskFragmentToken;
        mInitialCallerInfoAccessToken = initialCallerInfoAccessToken;
        mActivityWindowInfo = activityWindowInfo;
        mDisplayId = displayId;
    }

    @Override
    public void preExecute(@NonNull ClientTransactionHandler client) {
        client.countLaunchingActivities(1);
        client.updateProcessState(mProcState, false);
        CompatibilityInfo.applyOverrideIfNeeded(mCurConfig);
        CompatibilityInfo.applyOverrideIfNeeded(mOverrideConfig);
        CompatibilityInfo.applyOverrideIfNeeded(mCurConfig, mDisplayId);
        CompatibilityInfo.applyOverrideIfNeeded(mOverrideConfig, mDisplayId);
        client.updatePendingConfiguration(mCurConfig);
        if (mActivityClientController != null) {
            ActivityClient.setActivityClientController(mActivityClientController);
@@ -263,6 +265,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
        dest.writeStrongBinder(mTaskFragmentToken);
        dest.writeStrongBinder(mInitialCallerInfoAccessToken);
        dest.writeTypedObject(mActivityWindowInfo, flags);
        dest.writeInt(mDisplayId);

        dest.writeTypedObject(mIntent, flags);
        dest.writeTypedObject(mInfo, flags);
@@ -293,7 +296,8 @@ public class LaunchActivityItem extends ClientTransactionItem {
                in.readStrongBinder() /* taskFragmentToken */,
                in.readStrongBinder() /* initialCallerInfoAccessToken */,
                requireNonNull(in.readTypedObject(ActivityWindowInfo.CREATOR))
                /* activityWindowInfo */
                /* activityWindowInfo */,
                in.readInt() /* displayId */
        );
        mIntent = in.readTypedObject(Intent.CREATOR);
        mInfo = in.readTypedObject(ActivityInfo.CREATOR);
@@ -338,7 +342,8 @@ public class LaunchActivityItem extends ClientTransactionItem {
                && Objects.equals(mTaskFragmentToken, other.mTaskFragmentToken)
                && Objects.equals(mInitialCallerInfoAccessToken,
                        other.mInitialCallerInfoAccessToken)
                && Objects.equals(mActivityWindowInfo, other.mActivityWindowInfo);
                && Objects.equals(mActivityWindowInfo, other.mActivityWindowInfo)
                && mDisplayId == other.mDisplayId;
    }

    @Override
@@ -364,6 +369,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
        result = 31 * result + Objects.hashCode(mTaskFragmentToken);
        result = 31 * result + Objects.hashCode(mInitialCallerInfoAccessToken);
        result = 31 * result + Objects.hashCode(mActivityWindowInfo);
        result = 31 * result + mDisplayId;
        return result;
    }

@@ -412,6 +418,7 @@ public class LaunchActivityItem extends ClientTransactionItem {
                + ",assistToken=" + mAssistToken
                + ",shareableActivityToken=" + mShareableActivityToken
                + ",activityWindowInfo=" + mActivityWindowInfo
                + ",displayId=" + mDisplayId
                + "}";
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public class MoveToDisplayItem extends ActivityTransactionItem {

    @Override
    public void preExecute(@NonNull ClientTransactionHandler client) {
        CompatibilityInfo.applyOverrideIfNeeded(mConfiguration);
        CompatibilityInfo.applyOverrideIfNeeded(mConfiguration, mTargetDisplayId);
        // Notify the client of an upcoming change in the token configuration. This ensures that
        // batches of config change items only process the newest configuration.
        client.updatePendingActivityConfiguration(getActivityToken(), mConfiguration);
Loading