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

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

Snap for 8808387 from 2f63c77b to tm-qpr1-release

Change-Id: Ie6971e94490c43f29b8092b14d613f9f9da035f9
parents 718d2324 2f63c77b
Loading
Loading
Loading
Loading
+42 −13
Original line number Diff line number Diff line
@@ -129,7 +129,11 @@ public class ClipboardManager extends android.text.ClipboardManager {
        try {
            Objects.requireNonNull(clip);
            clip.prepareToLeaveProcess(true);
            mService.setPrimaryClip(clip, mContext.getOpPackageName(), mContext.getUserId());
            mService.setPrimaryClip(
                    clip,
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -154,7 +158,11 @@ public class ClipboardManager extends android.text.ClipboardManager {
            Objects.requireNonNull(sourcePackage);
            clip.prepareToLeaveProcess(true);
            mService.setPrimaryClipAsPackage(
                    clip, mContext.getOpPackageName(), mContext.getUserId(), sourcePackage);
                    clip,
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId(),
                    sourcePackage);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -167,7 +175,10 @@ public class ClipboardManager extends android.text.ClipboardManager {
     */
    public void clearPrimaryClip() {
        try {
            mService.clearPrimaryClip(mContext.getOpPackageName(), mContext.getUserId());
            mService.clearPrimaryClip(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -183,24 +194,29 @@ public class ClipboardManager extends android.text.ClipboardManager {
     */
    public @Nullable ClipData getPrimaryClip() {
        try {
            return mService.getPrimaryClip(mContext.getOpPackageName(), mContext.getUserId());
            return mService.getPrimaryClip(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    /**
     * Returns a description of the current primary clip on the clipboard
     * but not a copy of its data.
     * Returns a description of the current primary clip on the clipboard but not a copy of its
     * data.
     *
     * <em>If the application is not the default IME or does not have input focus this return
     * <p><em>If the application is not the default IME or does not have input focus this return
     * {@code null}.</em>
     *
     * @see #setPrimaryClip(ClipData)
     */
    public @Nullable ClipDescription getPrimaryClipDescription() {
        try {
            return mService.getPrimaryClipDescription(mContext.getOpPackageName(),
            return mService.getPrimaryClipDescription(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
@@ -215,7 +231,10 @@ public class ClipboardManager extends android.text.ClipboardManager {
     */
    public boolean hasPrimaryClip() {
        try {
            return mService.hasPrimaryClip(mContext.getOpPackageName(), mContext.getUserId());
            return mService.hasPrimaryClip(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -226,7 +245,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
            if (mPrimaryClipChangedListeners.isEmpty()) {
                try {
                    mService.addPrimaryClipChangedListener(
                            mPrimaryClipChangedServiceListener, mContext.getOpPackageName(),
                            mPrimaryClipChangedServiceListener,
                            mContext.getOpPackageName(),
                            mContext.getAttributionTag(),
                            mContext.getUserId());
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
@@ -242,7 +263,9 @@ public class ClipboardManager extends android.text.ClipboardManager {
            if (mPrimaryClipChangedListeners.isEmpty()) {
                try {
                    mService.removePrimaryClipChangedListener(
                            mPrimaryClipChangedServiceListener, mContext.getOpPackageName(),
                            mPrimaryClipChangedServiceListener,
                            mContext.getOpPackageName(),
                            mContext.getAttributionTag(),
                            mContext.getUserId());
                } catch (RemoteException e) {
                    throw e.rethrowFromSystemServer();
@@ -280,7 +303,10 @@ public class ClipboardManager extends android.text.ClipboardManager {
    @Deprecated
    public boolean hasText() {
        try {
            return mService.hasClipboardText(mContext.getOpPackageName(), mContext.getUserId());
            return mService.hasClipboardText(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
@@ -297,7 +323,10 @@ public class ClipboardManager extends android.text.ClipboardManager {
    @RequiresPermission(Manifest.permission.SET_CLIP_SOURCE)
    public String getPrimaryClipSource() {
        try {
            return mService.getPrimaryClipSource(mContext.getOpPackageName(), mContext.getUserId());
            return mService.getPrimaryClipSource(
                    mContext.getOpPackageName(),
                    mContext.getAttributionTag(),
                    mContext.getUserId());
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+10 −10
Original line number Diff line number Diff line
@@ -26,22 +26,22 @@ import android.content.IOnPrimaryClipChangedListener;
 * {@hide}
 */
interface IClipboard {
    void setPrimaryClip(in ClipData clip, String callingPackage, int userId);
    void setPrimaryClipAsPackage(in ClipData clip, String callingPackage, int userId,
    void setPrimaryClip(in ClipData clip, String callingPackage, String attributionTag, int userId);
    void setPrimaryClipAsPackage(in ClipData clip, String callingPackage, String attributionTag, int userId,
            String sourcePackage);
    void clearPrimaryClip(String callingPackage, int userId);
    ClipData getPrimaryClip(String pkg, int userId);
    ClipDescription getPrimaryClipDescription(String callingPackage, int userId);
    boolean hasPrimaryClip(String callingPackage, int userId);
    void clearPrimaryClip(String callingPackage, String attributionTag, int userId);
    ClipData getPrimaryClip(String pkg, String attributionTag, int userId);
    ClipDescription getPrimaryClipDescription(String callingPackage, String attributionTag, int userId);
    boolean hasPrimaryClip(String callingPackage, String attributionTag, int userId);
    void addPrimaryClipChangedListener(in IOnPrimaryClipChangedListener listener,
            String callingPackage, int userId);
            String callingPackage, String attributionTag, int userId);
    void removePrimaryClipChangedListener(in IOnPrimaryClipChangedListener listener,
            String callingPackage, int userId);
            String callingPackage, String attributionTag, int userId);

    /**
     * Returns true if the clipboard contains text; false otherwise.
     */
    boolean hasClipboardText(String callingPackage, int userId);
    boolean hasClipboardText(String callingPackage, String attributionTag, int userId);

    String getPrimaryClipSource(String callingPackage, int userId);
    String getPrimaryClipSource(String callingPackage, String attributionTag, int userId);
}
+5 −0
Original line number Diff line number Diff line
@@ -909,6 +909,11 @@ public class InsetsState implements Parcelable {
            if (source == null && otherSource == null) {
                continue;
            }
            if (excludeInvisibleImeFrames && i == ITYPE_IME
                    && ((source == null && !otherSource.isVisible())
                            || (otherSource == null && !source.isVisible()))) {
                continue;
            }
            if (source == null || otherSource == null) {
                return false;
            }
+17 −6
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ import android.os.RemoteException;
import android.util.Log;
import android.view.accessibility.IAccessibilityEmbeddedConnection;

import java.lang.ref.WeakReference;

class RemoteAccessibilityController {
    private static final String TAG = "RemoteAccessibilityController";
    private int mHostId;
@@ -80,12 +82,17 @@ class RemoteAccessibilityController {
    /**
     * Wrapper of accessibility embedded connection for embedded view hierarchy.
     */
    private final class RemoteAccessibilityEmbeddedConnection implements IBinder.DeathRecipient {
    private static final class RemoteAccessibilityEmbeddedConnection
            implements IBinder.DeathRecipient {
        private final WeakReference<RemoteAccessibilityController> mController;
        private final IAccessibilityEmbeddedConnection mConnection;
        private final IBinder mLeashToken;

        RemoteAccessibilityEmbeddedConnection(IAccessibilityEmbeddedConnection connection,
        RemoteAccessibilityEmbeddedConnection(
                RemoteAccessibilityController controller,
                IAccessibilityEmbeddedConnection connection,
                IBinder leashToken) {
            mController = new WeakReference<>(controller);
            mConnection = connection;
            mLeashToken = leashToken;
        }
@@ -109,9 +116,13 @@ class RemoteAccessibilityController {
        @Override
        public void binderDied() {
            unlinkToDeath();
            runOnUiThread(() -> {
                if (mConnectionWrapper == this) {
                    mConnectionWrapper = null;
            RemoteAccessibilityController controller = mController.get();
            if (controller == null) {
                return;
            }
            controller.runOnUiThread(() -> {
                if (controller.mConnectionWrapper == this) {
                    controller.mConnectionWrapper = null;
                }
            });
        }
@@ -128,7 +139,7 @@ class RemoteAccessibilityController {
            }
            if (connection != null && leashToken != null) {
                mConnectionWrapper =
                    new RemoteAccessibilityEmbeddedConnection(connection, leashToken);
                    new RemoteAccessibilityEmbeddedConnection(this, connection, leashToken);
                mConnectionWrapper.linkToDeath();
            }
        } catch (RemoteException e) {
+23 −10
Original line number Diff line number Diff line
@@ -25,11 +25,11 @@ import android.graphics.BLASTBufferQueue;
import android.graphics.FrameInfo;
import android.graphics.HardwareRenderer;
import android.graphics.Picture;
import android.graphics.Point;
import android.graphics.RecordingCanvas;
import android.graphics.Rect;
import android.graphics.RenderNode;
import android.os.Trace;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Surface.OutOfResourcesException;
import android.view.View.AttachInfo;
@@ -596,11 +596,18 @@ public final class ThreadedRenderer extends HardwareRenderer {
     */
    void setLightCenter(AttachInfo attachInfo) {
        // Adjust light position for window offsets.
        final Point displaySize = attachInfo.mPoint;
        attachInfo.mDisplay.getRealSize(displaySize);
        final float lightX = displaySize.x / 2f - attachInfo.mWindowLeft;
        DisplayMetrics displayMetrics = new DisplayMetrics();
        attachInfo.mDisplay.getRealMetrics(displayMetrics);
        final float lightX = displayMetrics.widthPixels / 2f - attachInfo.mWindowLeft;
        final float lightY = mLightY - attachInfo.mWindowTop;
        setLightSourceGeometry(lightX, lightY, mLightZ, mLightRadius);
        // To prevent shadow distortion on larger screens, scale the z position of the light source
        // relative to the smallest screen dimension.
        final float zRatio = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels)
                / (450f * displayMetrics.density);
        final float zWeightedAdjustment = (zRatio + 2) / 3f;
        final float lightZ = mLightZ * zWeightedAdjustment;

        setLightSourceGeometry(lightX, lightY, lightZ, mLightRadius);
    }

    /**
@@ -849,12 +856,18 @@ public final class ThreadedRenderer extends HardwareRenderer {
        public void setLightCenter(final Display display,
                final int windowLeft, final int windowTop) {
            // Adjust light position for window offsets.
            final Point displaySize = new Point();
            display.getRealSize(displaySize);
            final float lightX = displaySize.x / 2f - windowLeft;
            DisplayMetrics displayMetrics = new DisplayMetrics();
            display.getRealMetrics(displayMetrics);
            final float lightX = displayMetrics.widthPixels / 2f - windowLeft;
            final float lightY = mLightY - windowTop;

            setLightSourceGeometry(lightX, lightY, mLightZ, mLightRadius);
            // To prevent shadow distortion on larger screens, scale the z position of the light
            // source relative to the smallest screen dimension.
            final float zRatio = Math.min(displayMetrics.widthPixels, displayMetrics.heightPixels)
                    / (450f * displayMetrics.density);
            final float zWeightedAdjustment = (zRatio + 2) / 3f;
            final float lightZ = mLightZ * zWeightedAdjustment;

            setLightSourceGeometry(lightX, lightY, lightZ, mLightRadius);
        }

        public RenderNode getRootNode() {
Loading