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

Commit a512bfda authored by Michael Wright's avatar Michael Wright Committed by Garfield Tan
Browse files

Move PointerController from sp to shared_ptr

Bug: 160010896
Test: atest PointerController_test, atest InputReader_test, manual usage
Change-Id: Ic43ab94ca76c736fde0d217efeab99b2afd6f622
Merged-In: Ic43ab94ca76c736fde0d217efeab99b2afd6f622
parent cb64d4e3
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -332,7 +332,8 @@ public:
    virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0;
    virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0;


    /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */
    /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */
    virtual sp<PointerControllerInterface> obtainPointerController(int32_t deviceId) = 0;
    virtual std::shared_ptr<PointerControllerInterface> obtainPointerController(
            int32_t deviceId) = 0;


    /* Notifies the input reader policy that some input devices have changed
    /* Notifies the input reader policy that some input devices have changed
     * and provides information about all current input devices.
     * and provides information about all current input devices.
+1 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,7 @@ namespace android {
 * The pointer controller is responsible for providing synchronization and for tracking
 * The pointer controller is responsible for providing synchronization and for tracking
 * display orientation changes if needed.
 * display orientation changes if needed.
 */
 */
class PointerControllerInterface : public virtual RefBase {
class PointerControllerInterface {
protected:
protected:
    PointerControllerInterface() { }
    PointerControllerInterface() { }
    virtual ~PointerControllerInterface() { }
    virtual ~PointerControllerInterface() { }
+1 −1
Original line number Original line Diff line number Diff line
@@ -107,7 +107,7 @@ private:


    int32_t mOrientation;
    int32_t mOrientation;


    sp<PointerControllerInterface> mPointerController;
    std::shared_ptr<PointerControllerInterface> mPointerController;


    int32_t mButtonState;
    int32_t mButtonState;
    nsecs_t mDownTime;
    nsecs_t mDownTime;
+2 −2
Original line number Original line Diff line number Diff line
@@ -17,12 +17,12 @@
#ifndef _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H
#ifndef _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H
#define _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H
#define _UI_INPUTREADER_TOUCH_CURSOR_INPUT_MAPPER_COMMON_H


#include <stdint.h>

#include "EventHub.h"
#include "EventHub.h"
#include "InputListener.h"
#include "InputListener.h"
#include "InputReaderContext.h"
#include "InputReaderContext.h"


#include <stdint.h>

namespace android {
namespace android {


// --- Static Definitions ---
// --- Static Definitions ---
+1 −1
Original line number Original line Diff line number Diff line
@@ -778,7 +778,7 @@ void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) {
            mPointerController->setDisplayViewport(defaultViewport.value_or(mViewport));
            mPointerController->setDisplayViewport(defaultViewport.value_or(mViewport));
        }
        }
    } else {
    } else {
        mPointerController.clear();
        mPointerController.reset();
    }
    }


    if (viewportChanged || deviceModeChanged) {
    if (viewportChanged || deviceModeChanged) {
Loading