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

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

Snap for 11571437 from fc2deb96 to 24Q3-release

Change-Id: I07552c524dc2cbc21cd7c6dc4efe9c2e6812df0c
parents a14f1cf1 fc2deb96
Loading
Loading
Loading
Loading
+68 −0
Original line number Diff line number Diff line
/*
 * Copyright 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @addtogroup NativeActivity Native Activity
 * @{
 */
/**
 * @file input_transfer_token_jni.h
 */
#ifndef ANDROID_INPUT_TRANSFER_TOKEN_JNI_H
#define ANDROID_INPUT_TRANSFER_TOKEN_JNI_H
#include <sys/cdefs.h>
#include <jni.h>

__BEGIN_DECLS
struct AInputTransferToken;

/**
 * AInputTransferToken can be used to request focus on or to transfer touch gesture to and from
 * an embedded SurfaceControl
 */
typedef struct AInputTransferToken AInputTransferToken;

/**
 * Return the AInputTransferToken wrapped by a Java InputTransferToken object. This must be released
 * using AInputTransferToken_release
 *
 * inputTransferTokenObj must be a non-null instance of android.window.InputTransferToken.
 *
 * Available since API level 35.
 */
AInputTransferToken* _Nonnull AInputTransferToken_fromJava(JNIEnv* _Nonnull env,
        jobject _Nonnull inputTransferTokenObj) __INTRODUCED_IN(__ANDROID_API_V__);
/**
 * Return the Java InputTransferToken object that wraps AInputTransferToken
 *
 * aInputTransferToken must be non null and the returned value is an object of instance
 * android.window.InputTransferToken.
 *
 * Available since API level 35.
 */
jobject _Nonnull AInputTransferToken_toJava(JNIEnv* _Nonnull env,
        const AInputTransferToken* _Nonnull aInputTransferToken) __INTRODUCED_IN(__ANDROID_API_V__);

/**
 * Removes a reference that was previously acquired in native.
 *
 * Available since API level 35.
 */
void AInputTransferToken_release(AInputTransferToken* _Nonnull aInputTransferToken)
        __INTRODUCED_IN(__ANDROID_API_V__);

__END_DECLS
#endif // ANDROID_INPUT_TRANSFER_TOKEN_JNI_H
/** @} */
+1 −1
Original line number Diff line number Diff line
@@ -346,7 +346,7 @@ void ASurfaceTransaction_setZOrder(ASurfaceTransaction* transaction,
 */
void ASurfaceTransaction_setBuffer(ASurfaceTransaction* transaction,
                                   ASurfaceControl* surface_control, AHardwareBuffer* buffer,
                                   int acquire_fence_fd = -1) __INTRODUCED_IN(29);
                                   int acquire_fence_fd) __INTRODUCED_IN(29);

/**
 * Updates the color for \a surface_control.  This will make the background color for the
+8 −6
Original line number Diff line number Diff line
@@ -1192,15 +1192,17 @@ public:
 */
struct PointerCaptureRequest {
public:
    inline PointerCaptureRequest() : enable(false), seq(0) {}
    inline PointerCaptureRequest(bool enable, uint32_t seq) : enable(enable), seq(seq) {}
    inline PointerCaptureRequest() : window(), seq(0) {}
    inline PointerCaptureRequest(sp<IBinder> window, uint32_t seq) : window(window), seq(seq) {}
    inline bool operator==(const PointerCaptureRequest& other) const {
        return enable == other.enable && seq == other.seq;
        return window == other.window && seq == other.seq;
    }
    explicit inline operator bool() const { return enable; }
    inline bool isEnable() const { return window != nullptr; }

    // True iff this is a request to enable Pointer Capture.
    bool enable;
    // The requesting window.
    // If the request is to enable the capture, this is the input token of the window that requested
    // pointer capture. Otherwise, this is nullptr.
    sp<IBinder> window;

    // The sequence number for the request.
    uint32_t seq;
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#pragma once

#include <binder/Binder.h>
#include <binder/IBinder.h>
#include <binder/Parcel.h>
#include <private/gui/ParcelUtils.h>
#include <utils/Errors.h>

namespace android {
struct InputTransferToken : public RefBase, Parcelable {
public:
    InputTransferToken() { mToken = new BBinder(); }

    InputTransferToken(const sp<IBinder>& token) { mToken = token; }

    status_t writeToParcel(Parcel* parcel) const override {
        SAFE_PARCEL(parcel->writeStrongBinder, mToken);
        return NO_ERROR;
    }

    status_t readFromParcel(const Parcel* parcel) {
        SAFE_PARCEL(parcel->readStrongBinder, &mToken);
        return NO_ERROR;
    };

    sp<IBinder> mToken;
};

static inline bool operator==(const sp<InputTransferToken>& token1,
                              const sp<InputTransferToken>& token2) {
    if (token1.get() == token2.get()) {
        return true;
    }
    return token1->mToken == token2->mToken;
}

} // namespace android
 No newline at end of file
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ flag {

flag {
  name: "override_key_behavior_permission_apis"
  is_exported: true
  namespace: "input"
  description: "enable override key behavior permission APIs"
  bug: "309018874"
@@ -115,6 +116,7 @@ flag {

flag {
  name: "input_device_view_behavior_api"
  is_exported: true
  namespace: "input"
  description: "Controls the API to provide InputDevice view behavior."
  bug: "246946631"
Loading