Revert "Add "Touchscreen" app to properly setup touchscreen calibration"
This reverts commit 19f71681a460a1335c631fd2d096d90a42bfaa2b.
This is no longer needed since ro.sf.hwrotation has been merged in
frameworks/native based on
https://android-review.googlesource.com/c/platform/frameworks/native/+/671042
diff --git a/Touchscreen/Android.mk b/Touchscreen/Android.mk
deleted file mode 100644
index 3966b30..0000000
--- a/Touchscreen/Android.mk
+++ /dev/null
@@ -1,14 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_CERTIFICATE := platform
-LOCAL_PRIVILEGED_MODULE := true
-LOCAL_PACKAGE_NAME := Touchscreen
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_DEX_PREOPT := false
-
-include $(BUILD_PACKAGE)
diff --git a/Touchscreen/AndroidManifest.xml b/Touchscreen/AndroidManifest.xml
deleted file mode 100644
index 50e3b92..0000000
--- a/Touchscreen/AndroidManifest.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="me.phh.treble.touchscreen"
- android:sharedUserId="android.uid.system">
-
- <uses-permission android:name="android.permission.SET_INPUT_CALIBRATION" />
- <application
- android:label="@string/app_label">
-
- <receiver android:name=".Starter">
- <intent-filter>
- <action android:name="android.intent.action.BOOT_COMPLETED"/>
- </intent-filter>
- </receiver>
- </application>
-
-</manifest>
diff --git a/Touchscreen/res/values/strings.xml b/Touchscreen/res/values/strings.xml
deleted file mode 100644
index 1bd9b00..0000000
--- a/Touchscreen/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="app_label">Hardware Overlay Picker</string>
-</resources>
diff --git a/Touchscreen/src/me/phh/treble/touchscreen/Starter.java b/Touchscreen/src/me/phh/treble/touchscreen/Starter.java
deleted file mode 100644
index bc5fcf4..0000000
--- a/Touchscreen/src/me/phh/treble/touchscreen/Starter.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package me.phh.treble.touchscreen;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.om.IOverlayManager;
-import android.hardware.input.InputManager;
-import android.view.InputDevice;
-import android.view.MotionEvent;
-import android.hardware.input.TouchCalibration;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.SystemProperties;
-import android.util.Log;
-
-public class Starter extends BroadcastReceiver {
- private final static String TAG = "TouchScreen";
-
- private int getRotation(Context ctxt, Intent intent) {
- int rotation = -1;
- String vndFingerprint = SystemProperties.get("ro.vendor.build.fingerprint", "");
- int hwrotation = SystemProperties.getInt("ro.sf.hwrotation", -1);
- if(vndFingerprint.contains("full_x970_t10") && hwrotation == 270) {
- rotation = 271;
- }
- if(intent.hasExtra("rotation")) {
- rotation = intent.getIntExtra("rotation", rotation);
- }
- return rotation;
- }
-
- @Override
- public void onReceive(Context ctxt, Intent intent) {
- int rotation = getRotation(ctxt, intent);
- if(rotation == -1) return;
- android.util.Log.d("PHH", "Applying rotation " + rotation);
- InputManager im = ctxt.getSystemService(InputManager.class);
- int[] ids = im.getInputDeviceIds();
- for(int id: ids) {
- InputDevice dev = im.getInputDevice(id);
- String descriptor = dev.getDescriptor();
- android.util.Log.d("PHH", "Checking device " + descriptor + ":" + dev.getSources());
- if( (dev.getSources() & InputDevice.SOURCE_TOUCHSCREEN) == InputDevice.SOURCE_TOUCHSCREEN ) {
- InputDevice.MotionRange rangeX = dev.getMotionRange(MotionEvent.AXIS_X);
- InputDevice.MotionRange rangeY = dev.getMotionRange(MotionEvent.AXIS_Y);
-
- float dX = rangeX.getMax();
- float dY = rangeY.getMax();
- //TouchCalibration cal = new TouchCalibration(
- // 0.0f, dX/dY, 0.0f,
- // dY/dX, 0.0f, 0.0f);
- TouchCalibration cal;
- if(rotation == 0) {
- cal = new TouchCalibration(
- 1.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f);
- } else if(rotation == 90) {
- cal = new TouchCalibration(
- 0.0f, dX/dY, 0.0f,
- dY/dX, 0.0f, 0.0f);
- } else if(rotation == 91) {
- cal = new TouchCalibration(
- 0.0f, -dX/dY, dX,
- dY/dX, 0.0f, 0.0f);
- } else if(rotation == 180) {
- cal = new TouchCalibration(
- -1.0f, 0.0f, dX,
- 0.0f, -1.0f, dY);
- } else if(rotation == 270) {
- cal = new TouchCalibration(
- 0.0f, -dX/dY, dX,
- -dY/dX, 0.0f, dY);
- } else if(rotation == 271) {
- cal = new TouchCalibration(
- 0.0f, dX/dY, 0.0f,
- -dY/dX, 0.0f, dY);
- } else {
- cal = new TouchCalibration(
- 1.0f, 0.0f, 0.0f,
- 0.0f, 1.0f, 0.0f);
- }
-
- android.util.Log.d("PHH", "Setting touch calibration " + dY/dX + ":" + dX/dY);
- im.setTouchCalibration(descriptor, 0, cal);
- im.setTouchCalibration(descriptor, 1, cal);
- im.setTouchCalibration(descriptor, 2, cal);
- im.setTouchCalibration(descriptor, 3, cal);
- }
- }
- }
-}
diff --git a/overlay.mk b/overlay.mk
index d802561..b50e519 100644
--- a/overlay.mk
+++ b/overlay.mk
@@ -20,8 +20,7 @@
treble-overlay-xiaomi-mimix2s \
treble-overlay-xiaomi-redmi6pro \
HardwareOverlayPicker \
- QtiAudio \
- Touchscreen
+ QtiAudio
PRODUCT_PACKAGES += \