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

Commit a770df1d authored by Xin Li's avatar Xin Li
Browse files

DO NOT MERGE - Merge build QP1A.190711.019 into stage-aosp-master

Bug: 139893257
Change-Id: I94fce9c5c0b35cbb88ee27fa4cd037927964d2cd
parents d5f1fed4 57bb140b
Loading
Loading
Loading
Loading
+21 −5
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ import java.util.Arrays;

/**
 * Variant of {@link FileDescriptor} that allows its creator to specify regions
 * that should be redacted (appearing as zeros to the reader).
 * that should be redacted.
 *
 * @hide
 */
@@ -44,13 +44,16 @@ public class RedactingFileDescriptor {
    private static final boolean DEBUG = true;

    private volatile long[] mRedactRanges;
    private volatile long[] mFreeOffsets;

    private FileDescriptor mInner = null;
    private ParcelFileDescriptor mOuter = null;

    private RedactingFileDescriptor(Context context, File file, int mode, long[] redactRanges)
    private RedactingFileDescriptor(
            Context context, File file, int mode, long[] redactRanges, long[] freeOffsets)
            throws IOException {
        mRedactRanges = checkRangesArgument(redactRanges);
        mFreeOffsets = freeOffsets;

        try {
            try {
@@ -88,13 +91,17 @@ public class RedactingFileDescriptor {
     *
     * @param file The underlying file to open.
     * @param mode The {@link ParcelFileDescriptor} mode to open with.
     * @param redactRanges List of file offsets that should be redacted, stored
     * @param redactRanges List of file ranges that should be redacted, stored
     *            as {@code [start1, end1, start2, end2, ...]}. Start values are
     *            inclusive and end values are exclusive.
     * @param freePositions List of file offsets at which the four byte value 'free' should be
     *            written instead of zeros within parts of the file covered by {@code redactRanges}.
     *            Non-redacted bytes will not be modified even if covered by a 'free'. This is
     *            useful for overwriting boxes in ISOBMFF files with padding data.
     */
    public static ParcelFileDescriptor open(Context context, File file, int mode,
            long[] redactRanges) throws IOException {
        return new RedactingFileDescriptor(context, file, mode, redactRanges).mOuter;
            long[] redactRanges, long[] freePositions) throws IOException {
        return new RedactingFileDescriptor(context, file, mode, redactRanges, freePositions).mOuter;
    }

    /**
@@ -169,6 +176,15 @@ public class RedactingFileDescriptor {
                for (long j = start; j < end; j++) {
                    data[(int) (j - offset)] = 0;
                }
                // Overwrite data at 'free' offsets within the redaction ranges.
                for (long freeOffset : mFreeOffsets) {
                    final long freeEnd = freeOffset + 4;
                    final long redactFreeStart = Math.max(freeOffset, start);
                    final long redactFreeEnd = Math.min(freeEnd, end);
                    for (long j = redactFreeStart; j < redactFreeEnd; j++) {
                        data[(int) (j - offset)] = (byte) "free".charAt((int) (j - freeOffset));
                    }
                }
            }
            return n;
        }
+1 −1
Original line number Diff line number Diff line
@@ -300,5 +300,5 @@ interface IWindowSession {
    /**
     * Called when the system gesture exclusion has changed.
     */
    void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
    oneway void reportSystemGestureExclusionChanged(IWindow window, in List<Rect> exclusionRects);
}
+15 −0
Original line number Diff line number Diff line
@@ -967,6 +967,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    static boolean sBrokenInsetsDispatch;
    /**
     * Prior to Q, calling
     * {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)}
     * did not call update the window format so the opacity of the background was not correctly
     * applied to the window. Some applications rely on this misbehavior to work properly.
     * <p>
     * From Q, {@link com.android.internal.policy.DecorView#setBackgroundDrawable(Drawable)} is
     * the same as {@link com.android.internal.policy.DecorView#setWindowBackground(Drawable)}
     * which updates the window format.
     * @hide
     */
    protected static boolean sBrokenWindowBackground;
    /** @hide */
    @IntDef({NOT_FOCUSABLE, FOCUSABLE, FOCUSABLE_AUTO})
    @Retention(RetentionPolicy.SOURCE)
@@ -5104,6 +5117,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            sBrokenInsetsDispatch = ViewRootImpl.sNewInsetsMode != NEW_INSETS_MODE_FULL
                    || targetSdkVersion < Build.VERSION_CODES.Q;
            sBrokenWindowBackground = targetSdkVersion < Build.VERSION_CODES.Q;
            sCompatibilityDone = true;
        }
    }
+295 −210

File changed.

Preview size limit exceeded, changes collapsed.

+83 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading