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

Commit aaa21700 authored by Pradosh Das's avatar Pradosh Das Committed by Linux Build Service Account
Browse files

Add Digital Pen system service and its features.

Add digital pen system service and
its features such as hovering icon, extended display,
rotation of the display when main display is rotated,
and dynamically change off screen dimensions

Change-Id: I56fafde227efb4abaf7c9ce8c78dd16100582b06
parent 574c6468
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -261,6 +261,7 @@ LOCAL_SRC_FILES += \
	core/java/android/speech/IRecognitionService.aidl \
	core/java/android/speech/tts/ITextToSpeechCallback.aidl \
	core/java/android/speech/tts/ITextToSpeechService.aidl \
	core/java/codeaurora/ultrasound/IDigitalPenDimensionsCallback.aidl \
	core/java/com/android/internal/app/IAppOpsCallback.aidl \
	core/java/com/android/internal/app/IAppOpsService.aidl \
	core/java/com/android/internal/app/IBatteryStats.aidl \
@@ -439,7 +440,8 @@ LOCAL_JAR_PACKAGES := \
    android.hardware \
    com \
    javax \
    org
    org \
    codeaurora

include $(BUILD_JAVA_LIBRARY)
framework2_module := $(LOCAL_INSTALLED_MODULE)
+4 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.hardware.input;

import android.hardware.input.InputDeviceIdentifier;
import android.graphics.Bitmap;
import android.hardware.input.KeyboardLayout;
import android.hardware.input.IInputDevicesChangedListener;
import android.hardware.input.TouchCalibration;
@@ -63,4 +64,7 @@ interface IInputManager {
    // Input device vibrator control.
    void vibrate(int deviceId, in long[] pattern, int repeat, IBinder token);
    void cancelVibrate(int deviceId, IBinder token);

    // Custom hover icon support.
    void setCustomHoverIcon(in Bitmap icon, int hotSpotX, int hotSpotY);
}
+40 −0
Original line number Diff line number Diff line
@@ -25,8 +25,12 @@ import android.content.res.XmlResourceParser;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.hardware.input.IInputManager;
import android.hardware.input.IInputManager.Stub;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.util.Log;

/**
@@ -59,6 +63,10 @@ public final class PointerIcon implements Parcelable {
    /** {@hide} Style constant: Spot anchor icon for touchpads. */
    public static final int STYLE_SPOT_ANCHOR = 2002;

    /** {@hide} Style constant: Hovering icon for stylus. */
    public static final int STYLE_STYLUS_HOVER = 2003;


    // OEM private styles should be defined starting at this range to avoid
    // conflicts with any system styles that may be defined in the future.
    private static final int STYLE_OEM_FIRST = 10000;
@@ -68,6 +76,9 @@ public final class PointerIcon implements Parcelable {

    private static final PointerIcon gNullIcon = new PointerIcon(STYLE_NULL);

    private static IInputManager sInputManager;
    private static Object sInputManagerSync = new Object();

    private final int mStyle;
    private int mSystemIconResourceId;
    private Bitmap mBitmap;
@@ -202,6 +213,24 @@ public final class PointerIcon implements Parcelable {
        return icon;
    }

    /**
     * Changes the shape of the hover cursor. If the cursor is
     * visible it will be changed as soon as possible.
     *
     * @param bitmap bitmap for the cursor
     * @param hotSpotX x position of hot-spot for cursor offset
     *                 adjustment
     * @param hotSpotY y position of hot-spot for cursor offset
     *                 adjustment
     *
     * @throws RemoteException if failed to set the cursor
     */
    public static void setCustomHoverIcon(Bitmap bitmap, int hotSpotX, int hotSpotY)
    throws RemoteException
    {
        getInputManager().setCustomHoverIcon(bitmap, hotSpotX, hotSpotY);
    }

    /**
     * Loads the bitmap and hotspot information for a pointer icon, if it is not already loaded.
     * Returns a pointer icon (not necessarily the same instance) with the information filled in.
@@ -433,8 +462,19 @@ public final class PointerIcon implements Parcelable {
                return com.android.internal.R.styleable.Pointer_pointerIconSpotTouch;
            case STYLE_SPOT_ANCHOR:
                return com.android.internal.R.styleable.Pointer_pointerIconSpotAnchor;
            case STYLE_STYLUS_HOVER:
                return com.android.internal.R.styleable.Pointer_pointerIconStylusHover;
            default:
                return 0;
        }
    }

    private static IInputManager getInputManager() {
        synchronized(sInputManagerSync) {
            if(sInputManager == null) {
                sInputManager = IInputManager.Stub.asInterface(ServiceManager.getService("input"));
            }
            return sInputManager;
        }
    }
}
+41 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014, The Linux Foundation. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *     * Neither the name of The Linux Foundation nor the names of its
 *       contributors may be used to endorse or promote products derived
 *       from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

package codeaurora.ultrasound;

/**
 * Interface for DigitalPenOffScreenDisplayAdapter to
 * receive off-screen dimensions change callback.
 *
 * {@hide}
 */
oneway interface IDigitalPenDimensionsCallback {
    void onDimensionsChange(int width, int height);
}
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ enum {
    POINTER_ICON_STYLE_SPOT_HOVER = 2000,
    POINTER_ICON_STYLE_SPOT_TOUCH = 2001,
    POINTER_ICON_STYLE_SPOT_ANCHOR = 2002,
    POINTER_ICON_STYLE_STYLUS_HOVER = 2003,
};

/*
Loading