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

Commit 0658235d authored by Naomi Musgrave's avatar Naomi Musgrave Committed by Android (Google) Code Review
Browse files

Merge "[DO NOT MERGE] Revert "Temporary flag for Launcher to debug their usage...

Merge "[DO NOT MERGE] Revert "Temporary flag for Launcher to debug their usage of sandboxed display APIs"" into sc-v2-dev
parents cb3a43fe 608a6797
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -1463,10 +1463,10 @@ public final class Display {
            return false;
            return false;
        }
        }
        final Configuration config = mResources.getConfiguration();
        final Configuration config = mResources.getConfiguration();
        // TODO(b/179308296) Temporarily - never report max bounds to only Launcher if the feature
        // TODO(b/179308296) Temporarily exclude Launcher from being given max bounds, by checking
        // is disabled.
        // if the caller is the recents component.
        return config != null && !config.windowConfiguration.getMaxBounds().isEmpty()
        return config != null && !config.windowConfiguration.getMaxBounds().isEmpty()
                && (mDisplayInfo.shouldConstrainMetricsForLauncher || !isRecentsComponent());
                && !isRecentsComponent();
    }
    }


    /**
    /**
+1 −14
Original line number Original line Diff line number Diff line
@@ -305,13 +305,6 @@ public final class DisplayInfo implements Parcelable {
     */
     */
    public float brightnessDefault;
    public float brightnessDefault;


    /**
     * @hide
     * True if Display#getRealSize and getRealMetrics should be constrained for Launcher, false
     * otherwise.
     */
    public boolean shouldConstrainMetricsForLauncher = false;

    /**
    /**
     * The {@link RoundedCorners} if present, otherwise {@code null}.
     * The {@link RoundedCorners} if present, otherwise {@code null}.
     */
     */
@@ -388,8 +381,7 @@ public final class DisplayInfo implements Parcelable {
                && brightnessMinimum == other.brightnessMinimum
                && brightnessMinimum == other.brightnessMinimum
                && brightnessMaximum == other.brightnessMaximum
                && brightnessMaximum == other.brightnessMaximum
                && brightnessDefault == other.brightnessDefault
                && brightnessDefault == other.brightnessDefault
                && Objects.equals(roundedCorners, other.roundedCorners)
                && Objects.equals(roundedCorners, other.roundedCorners);
                && shouldConstrainMetricsForLauncher == other.shouldConstrainMetricsForLauncher;
    }
    }


    @Override
    @Override
@@ -440,7 +432,6 @@ public final class DisplayInfo implements Parcelable {
        brightnessMaximum = other.brightnessMaximum;
        brightnessMaximum = other.brightnessMaximum;
        brightnessDefault = other.brightnessDefault;
        brightnessDefault = other.brightnessDefault;
        roundedCorners = other.roundedCorners;
        roundedCorners = other.roundedCorners;
        shouldConstrainMetricsForLauncher = other.shouldConstrainMetricsForLauncher;
    }
    }


    public void readFromParcel(Parcel source) {
    public void readFromParcel(Parcel source) {
@@ -497,7 +488,6 @@ public final class DisplayInfo implements Parcelable {
        for (int i = 0; i < numUserDisabledFormats; i++) {
        for (int i = 0; i < numUserDisabledFormats; i++) {
            userDisabledHdrTypes[i] = source.readInt();
            userDisabledHdrTypes[i] = source.readInt();
        }
        }
        shouldConstrainMetricsForLauncher = source.readBoolean();
    }
    }


    @Override
    @Override
@@ -552,7 +542,6 @@ public final class DisplayInfo implements Parcelable {
        for (int i = 0; i < userDisabledHdrTypes.length; i++) {
        for (int i = 0; i < userDisabledHdrTypes.length; i++) {
            dest.writeInt(userDisabledHdrTypes[i]);
            dest.writeInt(userDisabledHdrTypes[i]);
        }
        }
        dest.writeBoolean(shouldConstrainMetricsForLauncher);
    }
    }


    @Override
    @Override
@@ -807,8 +796,6 @@ public final class DisplayInfo implements Parcelable {
        sb.append(brightnessMaximum);
        sb.append(brightnessMaximum);
        sb.append(", brightnessDefault ");
        sb.append(", brightnessDefault ");
        sb.append(brightnessDefault);
        sb.append(brightnessDefault);
        sb.append(", shouldConstrainMetricsForLauncher ");
        sb.append(shouldConstrainMetricsForLauncher);
        sb.append("}");
        sb.append("}");
        return sb.toString();
        return sb.toString();
    }
    }
+2 −18
Original line number Original line Diff line number Diff line
@@ -63,6 +63,8 @@ import android.hardware.display.DisplayManagerGlobal;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal;
import android.hardware.display.DisplayManagerInternal.DisplayGroupListener;
import android.hardware.display.DisplayManagerInternal.DisplayGroupListener;
import android.hardware.display.DisplayManagerInternal.DisplayTransactionListener;
import android.hardware.display.DisplayManagerInternal.DisplayTransactionListener;
import android.hardware.display.DisplayManagerInternal.RefreshRateLimitation;
import android.hardware.display.DisplayManagerInternal.RefreshRateRange;
import android.hardware.display.DisplayViewport;
import android.hardware.display.DisplayViewport;
import android.hardware.display.DisplayedContentSample;
import android.hardware.display.DisplayedContentSample;
import android.hardware.display.DisplayedContentSamplingAttributes;
import android.hardware.display.DisplayedContentSamplingAttributes;
@@ -649,9 +651,6 @@ public final class DisplayManagerService extends SystemService {
        synchronized (mSyncRoot) {
        synchronized (mSyncRoot) {
            final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(displayId);
            final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(displayId);
            if (display != null) {
            if (display != null) {
                // Do not let constrain be overwritten by override from WindowManager.
                info.shouldConstrainMetricsForLauncher =
                        display.getDisplayInfoLocked().shouldConstrainMetricsForLauncher;
                if (display.setDisplayInfoOverrideFromWindowManagerLocked(info)) {
                if (display.setDisplayInfoOverrideFromWindowManagerLocked(info)) {
                    handleLogicalDisplayChangedLocked(display);
                    handleLogicalDisplayChangedLocked(display);
                    scheduleTraversalLocked(false);
                    scheduleTraversalLocked(false);
@@ -1781,21 +1780,6 @@ public final class DisplayManagerService extends SystemService {
        }
        }
    }
    }


    void setShouldConstrainMetricsForLauncher(boolean constrain) {
        // Apply constrain for every display.
        synchronized (mSyncRoot) {
            int[] displayIds = mLogicalDisplayMapper.getDisplayIdsLocked(Process.myUid());
            for (int i : displayIds) {
                final LogicalDisplay display = mLogicalDisplayMapper.getDisplayLocked(i);
                if (display == null) {
                    return;
                }
                display.getDisplayInfoLocked().shouldConstrainMetricsForLauncher = constrain;
                setDisplayInfoOverrideFromWindowManagerInternal(i, display.getDisplayInfoLocked());
            }
        }
    }

    private void clearViewportsLocked() {
    private void clearViewportsLocked() {
        mViewports.clear();
        mViewports.clear();
    }
    }
+0 −16
Original line number Original line Diff line number Diff line
@@ -58,8 +58,6 @@ class DisplayManagerShellCommand extends ShellCommand {
                return setDisplayModeDirectorLoggingEnabled(false);
                return setDisplayModeDirectorLoggingEnabled(false);
            case "dwb-set-cct":
            case "dwb-set-cct":
                return setAmbientColorTemperatureOverride();
                return setAmbientColorTemperatureOverride();
            case "constrain-launcher-metrics":
                return setConstrainLauncherMetrics();
            default:
            default:
                return handleDefaultCommands(cmd);
                return handleDefaultCommands(cmd);
        }
        }
@@ -90,9 +88,6 @@ class DisplayManagerShellCommand extends ShellCommand {
        pw.println("    Disable display mode director logging.");
        pw.println("    Disable display mode director logging.");
        pw.println("  dwb-set-cct CCT");
        pw.println("  dwb-set-cct CCT");
        pw.println("    Sets the ambient color temperature override to CCT (use -1 to disable).");
        pw.println("    Sets the ambient color temperature override to CCT (use -1 to disable).");
        pw.println("  constrain-launcher-metrics [true|false]");
        pw.println("    Sets if Display#getRealSize and getRealMetrics should be constrained for ");
        pw.println("    Launcher.");
        pw.println();
        pw.println();
        Intent.printIntentArgsHelp(pw , "");
        Intent.printIntentArgsHelp(pw , "");
    }
    }
@@ -155,15 +150,4 @@ class DisplayManagerShellCommand extends ShellCommand {
        mService.setAmbientColorTemperatureOverride(cct);
        mService.setAmbientColorTemperatureOverride(cct);
        return 0;
        return 0;
    }
    }

    private int setConstrainLauncherMetrics() {
        String constrainText = getNextArg();
        if (constrainText == null) {
            getErrPrintWriter().println("Error: no value specified");
            return 1;
        }
        boolean constrain = Boolean.parseBoolean(constrainText);
        mService.setShouldConstrainMetricsForLauncher(constrain);
        return 0;
    }
}
}
+0 −2
Original line number Original line Diff line number Diff line
@@ -233,8 +233,6 @@ final class LogicalDisplay {
                info.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
                info.physicalXDpi = mOverrideDisplayInfo.physicalXDpi;
                info.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
                info.physicalYDpi = mOverrideDisplayInfo.physicalYDpi;
                info.roundedCorners = mOverrideDisplayInfo.roundedCorners;
                info.roundedCorners = mOverrideDisplayInfo.roundedCorners;
                info.shouldConstrainMetricsForLauncher =
                        mOverrideDisplayInfo.shouldConstrainMetricsForLauncher;
            }
            }
            mInfo.set(info);
            mInfo.set(info);
        }
        }