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

Commit 4951bcc1 authored by Steve Kondik's avatar Steve Kondik
Browse files

Merge tag 'android-6.0.1_r3' of...

Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/frameworks/native into cm-13.0

Android 6.0.1 release 3

Change-Id: I437aaf148d440a8144afe1454948980fc3b40cca
parents 53602ffd a78c2e65
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -340,13 +340,13 @@ public:
        inline void* data() { return mData; }
    };

#ifndef DISABLE_ASHMEM_TRACKING
private:
    size_t mBlobAshmemSize;
#endif
    size_t mOpenAshmemSize;

public:
    // TODO: Remove once ABI can be changed.
    size_t getBlobAshmemSize() const;
    size_t getOpenAshmemSize() const;
};

// ---------------------------------------------------------------------------
+6 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include <utils/String8.h>
#include <utils/Timers.h>
#include <utils/Vector.h>
#include <stdint.h>

/*
 * Additional private constants not defined in ndk/ui/input.h.
@@ -110,6 +111,11 @@ enum {
 */
#define MAX_POINTERS 16

/*
 * Maximum number of samples supported per motion event.
 */
#define MAX_SAMPLES UINT16_MAX

/*
 * Maximum pointer id value supported in a motion event.
 * Smallest pointer id is 0.
+8 −0
Original line number Diff line number Diff line
@@ -124,6 +124,11 @@ public:
     * the mapping in some way. */
    status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const;

    /* Tries to find a replacement key code for a given key code and meta state
     * in character map. */
    void tryRemapKey(int32_t scanCode, int32_t metaState,
            int32_t* outKeyCode, int32_t* outMetaState) const;

#if HAVE_ANDROID_OS
    /* Reads a key map from a parcel. */
    static sp<KeyCharacterMap> readFromParcel(Parcel* parcel);
@@ -151,6 +156,9 @@ private:

        /* The fallback keycode if the key is not handled. */
        int32_t fallbackKeyCode;

        /* The replacement keycode if the key has to be replaced outright. */
        int32_t replacementKeyCode;
    };

    struct Key {
+7 −0
Original line number Diff line number Diff line
@@ -87,6 +87,13 @@ extern bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentif
 */
extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState);

/**
 * Normalizes the meta state such that if either the left or right modifier
 * meta state bits are set then the result will also include the universal
 * bit for that modifier.
 */
extern int32_t normalizeMetaState(int32_t oldMetaState);

/**
 * Returns true if a key is a meta key like ALT or CAPS_LOCK.
 */
+49 −21
Original line number Diff line number Diff line
@@ -96,7 +96,7 @@ enum {
};

void acquire_object(const sp<ProcessState>& proc,
    const flat_binder_object& obj, const void* who)
    const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
    switch (obj.type) {
        case BINDER_TYPE_BINDER:
@@ -123,8 +123,15 @@ void acquire_object(const sp<ProcessState>& proc,
            return;
        }
        case BINDER_TYPE_FD: {
            // intentionally blank -- nothing to do to acquire this, but we do
            // recognize it as a legitimate object type.
            if (obj.cookie != 0) {
                if (outAshmemSize != NULL) {
                    // If we own an ashmem fd, keep track of how much memory it refers to.
                    int size = ashmem_get_size_region(obj.handle);
                    if (size > 0) {
                        *outAshmemSize += size;
                    }
                }
            }
            return;
        }
    }
@@ -132,8 +139,14 @@ void acquire_object(const sp<ProcessState>& proc,
    ALOGD("Invalid object type 0x%08x", obj.type);
}

void release_object(const sp<ProcessState>& proc,
void acquire_object(const sp<ProcessState>& proc,
    const flat_binder_object& obj, const void* who)
{
    acquire_object(proc, obj, who, NULL);
}

static void release_object(const sp<ProcessState>& proc,
    const flat_binder_object& obj, const void* who, size_t* outAshmemSize)
{
    switch (obj.type) {
        case BINDER_TYPE_BINDER:
@@ -160,7 +173,16 @@ void release_object(const sp<ProcessState>& proc,
            return;
        }
        case BINDER_TYPE_FD: {
            if (obj.cookie != 0) close(obj.handle);
            if (outAshmemSize != NULL) {
                if (obj.cookie != 0) {
                    int size = ashmem_get_size_region(obj.handle);
                    if (size > 0) {
                        *outAshmemSize -= size;
                    }

                    close(obj.handle);
                }
            }
            return;
        }
    }
@@ -168,6 +190,12 @@ void release_object(const sp<ProcessState>& proc,
    ALOGE("Invalid object type 0x%08x", obj.type);
}

void release_object(const sp<ProcessState>& proc,
    const flat_binder_object& obj, const void* who)
{
    release_object(proc, obj, who, NULL);
}

inline static status_t finish_flatten_binder(
    const sp<IBinder>& /*binder*/, const flat_binder_object& flat, Parcel* out)
{
@@ -504,7 +532,7 @@ status_t Parcel::appendFrom(const Parcel *parcel, size_t offset, size_t len)

            flat_binder_object* flat
                = reinterpret_cast<flat_binder_object*>(mData + off);
            acquire_object(proc, *flat, this);
            acquire_object(proc, *flat, this, &mOpenAshmemSize);

            if (flat->type == BINDER_TYPE_FD) {
                // If this is a file descriptor, we need to dup it so the
@@ -922,9 +950,7 @@ status_t Parcel::writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob)
    ALOGV("writeBlob: write to ashmem");
    int fd = ashmem_create_region("Parcel Blob", len);
    if (fd < 0) return NO_MEMORY;
#ifndef DISABLE_ASHMEM_TRACKING
    mBlobAshmemSize += len;
#endif

    int result = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE);
    if (result < 0) {
        status = result;
@@ -1026,7 +1052,7 @@ restart_write:
        // Need to write meta-data?
        if (nullMetaData || val.binder != 0) {
            mObjects[mObjectsSize] = mDataPos;
            acquire_object(ProcessState::self(), val, this);
            acquire_object(ProcessState::self(), val, this, &mOpenAshmemSize);
            mObjectsSize++;
        }

@@ -1609,7 +1635,7 @@ void Parcel::releaseObjects()
        i--;
        const flat_binder_object* flat
            = reinterpret_cast<flat_binder_object*>(data+objects[i]);
        release_object(proc, *flat, this);
        release_object(proc, *flat, this, &mOpenAshmemSize);
    }
}

@@ -1623,7 +1649,7 @@ void Parcel::acquireObjects()
        i--;
        const flat_binder_object* flat
            = reinterpret_cast<flat_binder_object*>(data+objects[i]);
        acquire_object(proc, *flat, this);
        acquire_object(proc, *flat, this, &mOpenAshmemSize);
    }
}

@@ -1805,7 +1831,7 @@ status_t Parcel::continueWrite(size_t desired)
                    // will need to rescan because we may have lopped off the only FDs
                    mFdsKnown = false;
                }
                release_object(proc, *flat, this);
                release_object(proc, *flat, this, &mOpenAshmemSize);
            }
            binder_size_t* objects =
                (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t));
@@ -1890,9 +1916,7 @@ void Parcel::initState()
    mFdsKnown = true;
    mAllowFds = true;
    mOwner = NULL;
#ifndef DISABLE_ASHMEM_TRACKING
    mBlobAshmemSize = 0;
#endif
    mOpenAshmemSize = 0;
}

void Parcel::scanForFds() const
@@ -1912,11 +1936,15 @@ void Parcel::scanForFds() const

size_t Parcel::getBlobAshmemSize() const
{
#ifndef DISABLE_ASHMEM_TRACKING
    return mBlobAshmemSize;
#else
    return 0;
#endif
    // This used to return the size of all blobs that were written to ashmem, now we're returning
    // the ashmem currently referenced by this Parcel, which should be equivalent.
    // TODO: Remove method once ABI can be changed.
    return mOpenAshmemSize;
}

size_t Parcel::getOpenAshmemSize() const
{
    return mOpenAshmemSize;
}

// --- Parcel::Blob ---
Loading