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

Commit 14d686d3 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 7595830 from 70c0c935 to sc-release

Change-Id: Ia30db8e30b14689021df464bfe14798aecda14d3
parents b85571c9 70c0c935
Loading
Loading
Loading
Loading
+24 −4
Original line number Diff line number Diff line
@@ -369,11 +369,12 @@ public final class ActivityThread extends ClientTransactionHandler
    @UnsupportedAppUsage(trackingBug = 176961850, maxTargetSdk = Build.VERSION_CODES.R,
            publicAlternatives = "Use {@code Context#getResources()#getConfiguration()} instead.")
    Configuration mConfiguration;
    @GuardedBy("this")
    private boolean mUpdateHttpProxyOnBind = false;
    @UnsupportedAppUsage
    Application mInitialApplication;
    @UnsupportedAppUsage
    final ArrayList<Application> mAllApplications
            = new ArrayList<Application>();
    final ArrayList<Application> mAllApplications = new ArrayList<>();
    /**
     * Bookkeeping of instantiated backup agents indexed first by user id, then by package name.
     * Indexing by user id supports parallel backups across users on system packages as they run in
@@ -1187,8 +1188,18 @@ public final class ActivityThread extends ClientTransactionHandler
        }

        public void updateHttpProxy() {
            ActivityThread.updateHttpProxy(
                    getApplication() != null ? getApplication() : getSystemContext());
            final Application app;
            synchronized (ActivityThread.this) {
                app = getApplication();
                if (null == app) {
                    // The app is not bound yet. Make a note to update the HTTP proxy when the
                    // app is bound.
                    mUpdateHttpProxyOnBind = true;
                    return;
                }
            }
            // App is present, update the proxy inline.
            ActivityThread.updateHttpProxy(app);
        }

        public void processInBackground() {
@@ -6685,6 +6696,15 @@ public final class ActivityThread extends ClientTransactionHandler
            sendMessage(H.SET_CONTENT_CAPTURE_OPTIONS_CALLBACK, data.appInfo.packageName);

            mInitialApplication = app;
            final boolean updateHttpProxy;
            synchronized (this) {
                updateHttpProxy = mUpdateHttpProxyOnBind;
                // This synchronized block ensures that any subsequent call to updateHttpProxy()
                // will see a non-null mInitialApplication.
            }
            if (updateHttpProxy) {
                ActivityThread.updateHttpProxy(app);
            }

            // don't bring up providers in restricted mode; they may depend on the
            // app's custom Application class
+25 −9
Original line number Diff line number Diff line
@@ -6122,28 +6122,29 @@ public class Notification implements Parcelable
                // change the background bgColor
                CharSequence title = action.title;
                ColorStateList[] outResultColor = new ColorStateList[1];
                int background = getColors(p).getSecondaryAccentColor();
                int buttonFillColor = getColors(p).getSecondaryAccentColor();
                if (isLegacy()) {
                    title = ContrastColorUtil.clearColorSpans(title);
                } else {
                    title = ensureColorSpanContrast(title, background, outResultColor);
                    int notifBackgroundColor = getColors(p).getBackgroundColor();
                    title = ensureColorSpanContrast(title, notifBackgroundColor, outResultColor);
                }
                button.setTextViewText(R.id.action0, processTextSpans(title));
                boolean hasColorOverride = outResultColor[0] != null;
                if (hasColorOverride) {
                    // There's a span spanning the full text, let's take it and use it as the
                    // background color
                    background = outResultColor[0].getDefaultColor();
                    buttonFillColor = outResultColor[0].getDefaultColor();
                }
                final int textColor = ContrastColorUtil.resolvePrimaryColor(mContext,
                        background, mInNightMode);
                        buttonFillColor, mInNightMode);
                button.setTextColor(R.id.action0, textColor);
                // We only want about 20% alpha for the ripple
                final int rippleColor = (textColor & 0x00ffffff) | 0x33000000;
                button.setColorStateList(R.id.action0, "setRippleColor",
                        ColorStateList.valueOf(rippleColor));
                button.setColorStateList(R.id.action0, "setButtonBackground",
                        ColorStateList.valueOf(background));
                        ColorStateList.valueOf(buttonFillColor));
                if (p.mCallStyleActions) {
                    button.setImageViewIcon(R.id.action0, action.getIcon());
                    boolean priority = action.getExtras().getBoolean(CallStyle.KEY_ACTION_PRIORITY);
@@ -6176,8 +6177,8 @@ public class Notification implements Parcelable
         *                    there exists a full length color span.
         * @return the contrasted charSequence
         */
        private CharSequence ensureColorSpanContrast(CharSequence charSequence, int background,
                ColorStateList[] outResultColor) {
        private static CharSequence ensureColorSpanContrast(CharSequence charSequence,
                int background, ColorStateList[] outResultColor) {
            if (charSequence instanceof Spanned) {
                Spanned ss = (Spanned) charSequence;
                Object[] spans = ss.getSpans(0, ss.length(), Object.class);
@@ -6197,8 +6198,9 @@ public class Notification implements Parcelable
                            int[] colors = textColor.getColors();
                            int[] newColors = new int[colors.length];
                            for (int i = 0; i < newColors.length; i++) {
                                boolean isBgDark = isColorDark(background);
                                newColors[i] = ContrastColorUtil.ensureLargeTextContrast(
                                        colors[i], background, mInNightMode);
                                        colors[i], background, isBgDark);
                            }
                            textColor = new ColorStateList(textColor.getStates().clone(),
                                    newColors);
@@ -6217,8 +6219,9 @@ public class Notification implements Parcelable
                    } else if (resultSpan instanceof ForegroundColorSpan) {
                        ForegroundColorSpan originalSpan = (ForegroundColorSpan) resultSpan;
                        int foregroundColor = originalSpan.getForegroundColor();
                        boolean isBgDark = isColorDark(background);
                        foregroundColor = ContrastColorUtil.ensureLargeTextContrast(
                                foregroundColor, background, mInNightMode);
                                foregroundColor, background, isBgDark);
                        if (fullLength) {
                            outResultColor[0] = ColorStateList.valueOf(foregroundColor);
                            resultSpan = null;
@@ -6237,6 +6240,19 @@ public class Notification implements Parcelable
            return charSequence;
        }

        /**
         * Determines if the color is light or dark.  Specifically, this is using the same metric as
         * {@link ContrastColorUtil#resolvePrimaryColor(Context, int, boolean)} and peers so that
         * the direction of color shift is consistent.
         *
         * @param color the color to check
         * @return true if the color has higher contrast with white than black
         */
        private static boolean isColorDark(int color) {
            // as per ContrastColorUtil.shouldUseDark, this uses the color contrast midpoint.
            return ContrastColorUtil.calculateLuminance(color) <= 0.17912878474;
        }

        /**
         * @return Whether we are currently building a notification from a legacy (an app that
         *         doesn't create material notifications by itself) app.
+60 −0
Original line number Diff line number Diff line
@@ -2317,6 +2317,51 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Float> CONTROL_ZOOM_RATIO =
            new Key<Float>("android.control.zoomRatio", float.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AF regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AF_REGIONS android.control.afRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AF_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AF_REGIONS_SET =
            new Key<Boolean>("android.control.afRegionsSet", boolean.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AE regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AE_REGIONS android.control.aeRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AE_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AE_REGIONS_SET =
            new Key<Boolean>("android.control.aeRegionsSet", boolean.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the AF regions has been set
     * by the client and those regions need not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is
     * set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#CONTROL_AWB_REGIONS android.control.awbRegions}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#CONTROL_AWB_REGIONS
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> CONTROL_AWB_REGIONS_SET =
            new Key<Boolean>("android.control.awbRegionsSet", boolean.class);

    /**
     * <p>Operation mode for edge
     * enhancement.</p>
@@ -3056,6 +3101,21 @@ public final class CaptureRequest extends CameraMetadata<CaptureRequest.Key<?>>
    public static final Key<Integer> SCALER_ROTATE_AND_CROP =
            new Key<Integer>("android.scaler.rotateAndCrop", int.class);

    /**
     * <p>Framework-only private key which informs camera fwk that the scaler crop region
     * ({@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}) has been set by the client and it need
     * not be corrected when {@link CaptureRequest#SENSOR_PIXEL_MODE android.sensor.pixelMode} is set to MAXIMUM_RESOLUTION.</p>
     * <p>This must be set to TRUE by the camera2 java fwk when the camera client sets
     * {@link CaptureRequest#SCALER_CROP_REGION android.scaler.cropRegion}.</p>
     * <p><b>Optional</b> - The value for this key may be {@code null} on some devices.</p>
     *
     * @see CaptureRequest#SCALER_CROP_REGION
     * @see CaptureRequest#SENSOR_PIXEL_MODE
     * @hide
     */
    public static final Key<Boolean> SCALER_CROP_REGION_SET =
            new Key<Boolean>("android.scaler.cropRegionSet", boolean.class);

    /**
     * <p>Duration each pixel is exposed to
     * light.</p>
+10 −2
Original line number Diff line number Diff line
@@ -446,10 +446,16 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
        }
    }

    public void release() {
        synchronized (mInterfaceLock) {
    @Override
    protected void finalize() throws Throwable {
        if (mHandlerThread != null) {
            mHandlerThread.quitSafely();
        }
        super.finalize();
    }

    public void release() {
        synchronized (mInterfaceLock) {
            if (mSessionProcessor != null) {
                try {
                    mSessionProcessor.deInitSession();
@@ -812,6 +818,8 @@ public final class CameraAdvancedExtensionSessionImpl extends CameraExtensionSes
                    Log.e(TAG,"Failed to parcel buffer fence!");
                }
            }
            parcelImage.width = img.getWidth();
            parcelImage.height = img.getHeight();
            parcelImage.format = img.getFormat();
            parcelImage.timestamp = img.getTimestamp();
            parcelImage.transform = img.getTransform();
+10 −0
Original line number Diff line number Diff line
@@ -696,6 +696,16 @@ public class CameraDeviceImpl extends CameraDevice
                mCurrentSession.replaceSessionClose();
            }

            if (mCurrentExtensionSession != null) {
                mCurrentExtensionSession.release();
                mCurrentExtensionSession = null;
            }

            if (mCurrentAdvancedExtensionSession != null) {
                mCurrentAdvancedExtensionSession.release();
                mCurrentAdvancedExtensionSession = null;
            }

            // TODO: dont block for this
            boolean configureSuccess = true;
            CameraAccessException pendingException = null;
Loading