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

Commit b219a83f authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am f66f8a58: am 95af0c14: Merge "Add support for the PointerLocation overlay." into gingerbread

Merge commit 'f66f8a58'

* commit 'f66f8a58':
  Add support for the PointerLocation overlay.
parents da4c35b9 f66f8a58
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -180,6 +180,11 @@ public class Looper {
        return mThread;
        return mThread;
    }
    }
    
    
    /** @hide */
    public MessageQueue getQueue() {
        return mQueue;
    }
    
    public void dump(Printer pw, String prefix) {
    public void dump(Printer pw, String prefix) {
        pw.println(prefix + this);
        pw.println(prefix + this);
        pw.println(prefix + "mRun=" + mRun);
        pw.println(prefix + "mRun=" + mRun);
+2 −0
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import android.view.IWindowSession;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.InputEvent;
import android.view.InputEvent;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.InputChannel;


/**
/**
 * System private interface to the window manager.
 * System private interface to the window manager.
@@ -119,6 +120,7 @@ interface IWindowManager
    int getKeycodeStateForDevice(int devid, int sw);
    int getKeycodeStateForDevice(int devid, int sw);
    int getTrackballKeycodeState(int sw);
    int getTrackballKeycodeState(int sw);
    int getDPadKeycodeState(int sw);
    int getDPadKeycodeState(int sw);
    InputChannel monitorInput(String inputChannelName);
    
    
    // Report whether the hardware supports the given keys; returns true if successful
    // Report whether the hardware supports the given keys; returns true if successful
    boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
    boolean hasKeys(in int[] keycodes, inout boolean[] keyExists);
+0 −5
Original line number Original line Diff line number Diff line
@@ -779,11 +779,6 @@ public interface WindowManagerPolicy {
     */
     */
    public void enableScreenAfterBoot();
    public void enableScreenAfterBoot();
    
    
    /**
     * Called every time the window manager is dispatching a pointer event.
     */
    public void dispatchedPointerEventLw(MotionEvent ev, int targetX, int targetY);
    
    public void setCurrentOrientationLw(int newOrientation);
    public void setCurrentOrientationLw(int newOrientation);
    
    
    /**
    /**
+2 −1
Original line number Original line Diff line number Diff line
@@ -171,7 +171,8 @@ public:
            status_t            append(const char* other);
            status_t            append(const char* other);
            status_t            append(const char* other, size_t numChars);
            status_t            append(const char* other, size_t numChars);


            status_t            appendFormat(const char* fmt, ...);
            status_t            appendFormat(const char* fmt, ...)
                    __attribute__((format (printf, 2, 3)));


            // Note that this function takes O(N) time to calculate the value.
            // Note that this function takes O(N) time to calculate the value.
            // No cache value is stored.
            // No cache value is stored.
+35 −14
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ import android.graphics.Rect;
import android.os.Handler;
import android.os.Handler;
import android.os.IBinder;
import android.os.IBinder;
import android.os.LocalPowerManager;
import android.os.LocalPowerManager;
import android.os.Looper;
import android.os.PowerManager;
import android.os.PowerManager;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
@@ -48,15 +49,20 @@ import android.provider.Settings;
import com.android.internal.policy.PolicyManager;
import com.android.internal.policy.PolicyManager;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.telephony.ITelephony;
import com.android.internal.telephony.ITelephony;
import com.android.internal.view.BaseInputHandler;
import com.android.internal.widget.PointerLocationView;
import com.android.internal.widget.PointerLocationView;


import android.util.Config;
import android.util.Config;
import android.util.EventLog;
import android.util.EventLog;
import android.util.Log;
import android.util.Log;
import android.util.Slog;
import android.view.Display;
import android.view.Display;
import android.view.Gravity;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.HapticFeedbackConstants;
import android.view.IWindowManager;
import android.view.IWindowManager;
import android.view.InputChannel;
import android.view.InputQueue;
import android.view.InputHandler;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.MotionEvent;
import android.view.WindowOrientationListener;
import android.view.WindowOrientationListener;
@@ -221,6 +227,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    
    
    int mPointerLocationMode = 0;
    int mPointerLocationMode = 0;
    PointerLocationView mPointerLocationView = null;
    PointerLocationView mPointerLocationView = null;
    InputChannel mPointerLocationInputChannel;
    
    private final InputHandler mPointerLocationInputHandler = new BaseInputHandler() {
        @Override
        public void handleMotion(MotionEvent event, Runnable finishedCallback) {
            finishedCallback.run();
            synchronized (mLock) {
                mPointerLocationView.addTouchEvent(event);
            }
        }
    };
    
    
    // The current size of the screen.
    // The current size of the screen.
    int mW, mH;
    int mW, mH;
@@ -617,8 +634,26 @@ public class PhoneWindowManager implements WindowManagerPolicy {
            WindowManagerImpl wm = (WindowManagerImpl)
            WindowManagerImpl wm = (WindowManagerImpl)
                    mContext.getSystemService(Context.WINDOW_SERVICE);
                    mContext.getSystemService(Context.WINDOW_SERVICE);
            wm.addView(addView, lp);
            wm.addView(addView, lp);
            
            if (mPointerLocationInputChannel == null) {
                try {
                    mPointerLocationInputChannel =
                        mWindowManager.monitorInput("PointerLocationView");
                    InputQueue.registerInputChannel(mPointerLocationInputChannel,
                            mPointerLocationInputHandler, mHandler.getLooper().getQueue());
                } catch (RemoteException ex) {
                    Slog.e(TAG, "Could not set up input monitoring channel for PointerLocation.",
                            ex);
                }
            }
        }
        }
        if (removeView != null) {
        if (removeView != null) {
            if (mPointerLocationInputChannel != null) {
                InputQueue.unregisterInputChannel(mPointerLocationInputChannel);
                mPointerLocationInputChannel.dispose();
                mPointerLocationInputChannel = null;
            }
            
            WindowManagerImpl wm = (WindowManagerImpl)
            WindowManagerImpl wm = (WindowManagerImpl)
                    mContext.getSystemService(Context.WINDOW_SERVICE);
                    mContext.getSystemService(Context.WINDOW_SERVICE);
            wm.removeView(removeView);
            wm.removeView(removeView);
@@ -732,20 +767,6 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                : Configuration.KEYBOARDHIDDEN_YES;
                : Configuration.KEYBOARDHIDDEN_YES;
    }
    }
    
    
    public void dispatchedPointerEventLw(MotionEvent ev, int targetX, int targetY) {
        if (mPointerLocationView == null) {
            return;
        }
        synchronized (mLock) {
            if (mPointerLocationView == null) {
                return;
            }
            ev.offsetLocation(targetX, targetY);
            mPointerLocationView.addTouchEvent(ev);
            ev.offsetLocation(-targetX, -targetY);
        }
    }
    
    /** {@inheritDoc} */
    /** {@inheritDoc} */
    public int windowTypeToLayerLw(int type) {
    public int windowTypeToLayerLw(int type) {
        if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
        if (type >= FIRST_APPLICATION_WINDOW && type <= LAST_APPLICATION_WINDOW) {
Loading