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

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

Merge "Add Context.getDisplayId() to avoid possible IPC"

parents 6e7ece7e 5281b6b4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5054,7 +5054,7 @@ public final class ActivityThread extends ClientTransactionHandler {
    private void performConfigurationChangedForActivity(ActivityClientRecord r,
            Configuration newBaseConfig) {
        performConfigurationChangedForActivity(r, newBaseConfig,
                r.activity.getDisplay().getDisplayId(), false /* movedToDifferentDisplay */);
                r.activity.getDisplayId(), false /* movedToDifferentDisplay */);
    }

    /**
@@ -5406,7 +5406,7 @@ public final class ActivityThread extends ClientTransactionHandler {
            return;
        }
        final boolean movedToDifferentDisplay = displayId != INVALID_DISPLAY
                && displayId != r.activity.getDisplay().getDisplayId();
                && displayId != r.activity.getDisplayId();

        // Perform updates.
        r.overrideConfig = overrideConfig;
+9 −7
Original line number Diff line number Diff line
@@ -2088,8 +2088,7 @@ class ContextImpl extends Context {
            ContextImpl c = new ContextImpl(this, mMainThread, pi, null, mActivityToken,
                    new UserHandle(UserHandle.getUserId(application.uid)), flags, null);

            final int displayId = mDisplay != null
                    ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
            final int displayId = getDisplayId();

            c.setResources(createResources(mActivityToken, pi, null, displayId, null,
                    getDisplayAdjustments(displayId).getCompatibilityInfo()));
@@ -2124,8 +2123,7 @@ class ContextImpl extends Context {
            ContextImpl c = new ContextImpl(this, mMainThread, pi, null, mActivityToken, user,
                    flags, null);

            final int displayId = mDisplay != null
                    ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
            final int displayId = getDisplayId();

            c.setResources(createResources(mActivityToken, pi, null, displayId, null,
                    getDisplayAdjustments(displayId).getCompatibilityInfo()));
@@ -2152,8 +2150,7 @@ class ContextImpl extends Context {
        final ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, splitName,
                mActivityToken, mUser, mFlags, classLoader);

        final int displayId = mDisplay != null
                ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
        final int displayId = getDisplayId();

        context.setResources(ResourcesManager.getInstance().getResources(
                mActivityToken,
@@ -2177,7 +2174,7 @@ class ContextImpl extends Context {
        ContextImpl context = new ContextImpl(this, mMainThread, mPackageInfo, mSplitName,
                mActivityToken, mUser, mFlags, mClassLoader);

        final int displayId = mDisplay != null ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
        final int displayId = getDisplayId();
        context.setResources(createResources(mActivityToken, mPackageInfo, mSplitName, displayId,
                overrideConfiguration, getDisplayAdjustments(displayId).getCompatibilityInfo()));
        return context;
@@ -2249,6 +2246,11 @@ class ContextImpl extends Context {
        return mDisplay;
    }

    @Override
    public int getDisplayId() {
        return mDisplay != null ? mDisplay.getDisplayId() : Display.DEFAULT_DISPLAY;
    }

    @Override
    public void updateDisplay(int displayId) {
        mDisplay = mResourcesManager.getAdjustedDisplay(displayId, mResources);
+8 −0
Original line number Diff line number Diff line
@@ -4981,6 +4981,14 @@ public abstract class Context {
    @UnsupportedAppUsage
    public abstract Display getDisplay();

    /**
     * Gets the display ID.
     *
     * @return display ID associated with this {@link Context}.
     * @hide
     */
    public abstract int getDisplayId();

    /**
     * @hide
     */
+8 −0
Original line number Diff line number Diff line
@@ -917,6 +917,14 @@ public class ContextWrapper extends Context {
        return mBase.getDisplay();
    }

    /**
     * @hide
     */
    @Override
    public int getDisplayId() {
        return mBase.getDisplayId();
    }

    /**
     * @hide
     */
+1 −1
Original line number Diff line number Diff line
@@ -397,7 +397,7 @@ public final class DisplayManager {
        if (display == null) {
            // TODO: We cannot currently provide any override configurations for metrics on displays
            // other than the display the context is associated with.
            final Context context = mContext.getDisplay().getDisplayId() == displayId
            final Context context = mContext.getDisplayId() == displayId
                    ? mContext : mContext.getApplicationContext();

            display = mGlobal.getCompatibleDisplay(displayId, context.getResources());
Loading