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

Commit c757fb94 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 5153607 from 5363caaf to qt-release

Change-Id: I5fe2c2eb87c58757cd3a90519a99d226cd1dffa8
parents 9d8abf56 5363caaf
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -36,6 +36,9 @@ public:
    DECLARE_META_INTERFACE(InputFlinger)

    virtual void setInputWindows(const Vector<InputWindowInfo>& inputHandles) = 0;

    virtual void registerInputChannel(const sp<InputChannel>& channel) = 0;
    virtual void unregisterInputChannel(const sp<InputChannel>& channel) = 0;
};


@@ -46,6 +49,8 @@ class BnInputFlinger : public BnInterface<IInputFlinger> {
public:
    enum {
        SET_INPUT_WINDOWS_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION,
        REGISTER_INPUT_CHANNEL_TRANSACTION,
        UNREGISTER_INPUT_CHANNEL_TRANSACTION
    };

    virtual status_t onTransact(uint32_t code, const Parcel& data,
+7 −2
Original line number Diff line number Diff line
@@ -244,7 +244,12 @@ struct PointerCoords {
    float getAxisValue(int32_t axis) const;
    status_t setAxisValue(int32_t axis, float value);

    void scale(float scale);
    void scale(float globalScale);

    // Scale the pointer coordinates according to a global scale and a
    // window scale. The global scale will be applied to TOUCH/TOOL_MAJOR/MINOR
    // axes, however the window scaling will not.
    void scale(float globalScale, float windowXScale, float windowYScale);
    void applyOffset(float xOffset, float yOffset);

    inline float getX() const {
@@ -595,7 +600,7 @@ public:

    void offsetLocation(float xOffset, float yOffset);

    void scale(float scaleFactor);
    void scale(float globalScaleFactor);

    // Apply 3x3 perspective matrix transformation.
    // Matrix is in row-major form and compatible with SkMatrix.
+11 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@

#include <string>

#include <binder/IBinder.h>
#include <binder/Parcel.h>

#include <input/Input.h>
#include <utils/RefBase.h>
#include <utils/Timers.h>
@@ -29,8 +32,12 @@ namespace android {
 * Describes the properties of an application that can receive input.
 */
struct InputApplicationInfo {
    sp<IBinder> token;
    std::string name;
    nsecs_t dispatchingTimeout;

    status_t write(Parcel& output) const;
    static InputApplicationInfo read(const Parcel& from);
};


@@ -54,6 +61,10 @@ public:
        return mInfo ? mInfo->dispatchingTimeout : defaultValue;
    }

    inline sp<IBinder> getApplicationToken() const {
        return mInfo ? mInfo->token : nullptr;
    }

    /**
     * Requests that the state of this object be updated to reflect
     * the most current available information about the application.
+37 −8
Original line number Diff line number Diff line
@@ -117,16 +117,41 @@ struct InputWindowInfo {
        INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004,
    };
    
    sp<InputChannel> inputChannel;
    /* These values are filled in by the WM and passed through SurfaceFlinger
     * unless specified otherwise.
     */
    sp<IBinder> token;
    std::string name;
    int32_t layoutParamsFlags;
    int32_t layoutParamsType;
    nsecs_t dispatchingTimeout;

    /* These values are filled in by SurfaceFlinger. */
    int32_t frameLeft;
    int32_t frameTop;
    int32_t frameRight;
    int32_t frameBottom;
    float scaleFactor;

    /*
     * SurfaceFlinger consumes this value to shrink the computed frame. This is
     * different from shrinking the touchable region in that it DOES shift the coordinate
     * space where-as the touchable region does not and is more like "cropping". This
     * is used for window shadows.
     */
    int32_t surfaceInset = 0;

    // A global scaling factor for all windows. Unlike windowScaleX/Y this results
    // in scaling of the TOUCH_MAJOR/TOUCH_MINOR axis.
    float globalScaleFactor;

    // Scaling factors applied to individual windows.
    float windowXScale = 1.0f;
    float windowYScale = 1.0f;

    /*
     * This is filled in by the WM relative to the frame and then translated
     * to absolute coordinates by SurfaceFlinger once the frame is computed.
     */
    Region touchableRegion;
    bool visible;
    bool canReceiveKeys;
@@ -138,6 +163,7 @@ struct InputWindowInfo {
    int32_t ownerUid;
    int32_t inputFeatures;
    int32_t displayId;
    InputApplicationInfo applicationInfo;

    void addTouchableRegion(const Rect& region);

@@ -168,20 +194,23 @@ struct InputWindowInfo {
 */
class InputWindowHandle : public RefBase {
public:
    const sp<InputApplicationHandle> inputApplicationHandle;

    inline const InputWindowInfo* getInfo() const {
        return &mInfo;
    }

    sp<InputChannel> getInputChannel() const;
    sp<IBinder> getToken() const;

    sp<IBinder> getApplicationToken() {
        return mInfo.applicationInfo.token;
    }

    inline std::string getName() const {
        return mInfo.inputChannel ? mInfo.name : "<invalid>";
        return mInfo.token ? mInfo.name : "<invalid>";
    }

    inline nsecs_t getDispatchingTimeout(nsecs_t defaultValue) const {
        return mInfo.inputChannel? mInfo.dispatchingTimeout : defaultValue;
        return mInfo.token ? mInfo.dispatchingTimeout : defaultValue;
    }

    /**
@@ -202,7 +231,7 @@ public:
    void releaseChannel();

protected:
    explicit InputWindowHandle(const sp<InputApplicationHandle>& inputApplicationHandle);
    explicit InputWindowHandle();
    virtual ~InputWindowHandle();

    InputWindowInfo mInfo;
+32 −6
Original line number Diff line number Diff line
@@ -109,9 +109,7 @@ static const char *kCommandStrings[] = {
    "BC_DEAD_BINDER_DONE"
};

// The work source represents the UID of the process we should attribute the transaction to.
// We use -1 to specify that the work source was not set using #setWorkSource.
static const int kUnsetWorkSource = -1;
static const int64_t kWorkSourcePropagatedBitIndex = 32;

static const char* getReturnString(uint32_t cmd)
{
@@ -389,12 +387,29 @@ int32_t IPCThreadState::getStrictModePolicy() const

int64_t IPCThreadState::setCallingWorkSourceUid(uid_t uid)
{
    // Note: we currently only use half of the int64. We return an int64 for extensibility.
    int64_t token = mWorkSource;
    int64_t token = setCallingWorkSourceUidWithoutPropagation(uid);
    mPropagateWorkSource = true;
    return token;
}

int64_t IPCThreadState::setCallingWorkSourceUidWithoutPropagation(uid_t uid)
{
    const int64_t propagatedBit = ((int64_t)mPropagateWorkSource) << kWorkSourcePropagatedBitIndex;
    int64_t token = propagatedBit | mWorkSource;
    mWorkSource = uid;
    return token;
}

void IPCThreadState::clearPropagateWorkSource()
{
    mPropagateWorkSource = false;
}

bool IPCThreadState::shouldPropagateWorkSource() const
{
    return mPropagateWorkSource;
}

uid_t IPCThreadState::getCallingWorkSourceUid() const
{
    return mWorkSource;
@@ -408,7 +423,8 @@ int64_t IPCThreadState::clearCallingWorkSource()
void IPCThreadState::restoreCallingWorkSource(int64_t token)
{
    uid_t uid = (int)token;
    setCallingWorkSourceUid(uid);
    setCallingWorkSourceUidWithoutPropagation(uid);
    mPropagateWorkSource = ((token >> kWorkSourcePropagatedBitIndex) & 1) == 1;
}

void IPCThreadState::setLastTransactionBinderFlags(int32_t flags)
@@ -765,6 +781,7 @@ status_t IPCThreadState::clearDeathNotification(int32_t handle, BpBinder* proxy)
IPCThreadState::IPCThreadState()
    : mProcess(ProcessState::self()),
      mWorkSource(kUnsetWorkSource),
      mPropagateWorkSource(false),
      mStrictModePolicy(0),
      mLastTransactionBinderFlags(0)
{
@@ -1127,6 +1144,13 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
            const uid_t origUid = mCallingUid;
            const int32_t origStrictModePolicy = mStrictModePolicy;
            const int32_t origTransactionBinderFlags = mLastTransactionBinderFlags;
            const int32_t origWorkSource = mWorkSource;
            const bool origPropagateWorkSet = mPropagateWorkSource;
            // Calling work source will be set by Parcel#enforceInterface. Parcel#enforceInterface
            // is only guaranteed to be called for AIDL-generated stubs so we reset the work source
            // here to never propagate it.
            clearCallingWorkSource();
            clearPropagateWorkSource();

            mCallingPid = tr.sender_pid;
            mCallingUid = tr.sender_euid;
@@ -1179,6 +1203,8 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
            mCallingUid = origUid;
            mStrictModePolicy = origStrictModePolicy;
            mLastTransactionBinderFlags = origTransactionBinderFlags;
            mWorkSource = origWorkSource;
            mPropagateWorkSource = origPropagateWorkSet;

            IF_LOG_TRANSACTIONS() {
                TextOutput::Bundle _b(alog);
Loading