mirror of
https://github.com/Anything-at-25-00/android_device_tecno_LG8n.git
synced 2024-10-06 19:56:26 -07:00
[Squash] Remove DT2W service and helper
* I'm fixing powerhint instead, shirayuki-dt2w doesn't start on boot Revert "LG8n: rootdir: Start shirayuki-dt2w on late_start" This reverts commitf2c2c98f24
. Revert "LG8n: fixup!: Fix Android.bp" This reverts commit75f87d9602
. Revert "LG8n: Introduce shirayuki-dt2w service as a helper for DT2W service app" This reverts commit9407fb90fb
. Revert "LG8n: remove xiaomi-touch from dt2w Android.bp" This reverts commitf5d0d8ae8f
. Revert "LG8n: Import DT2w service from HOAMSI's rom" This reverts commit64ff4cb6e8
.
This commit is contained in:
parent
f2c2c98f24
commit
d4836bac37
|
@ -151,10 +151,6 @@ PRODUCT_PACKAGES += \
|
|||
PRODUCT_PACKAGES += \
|
||||
android.hardware.drm@1.4.vendor
|
||||
|
||||
# DT2W
|
||||
PRODUCT_PACKAGES += \
|
||||
DT2W-Service-MT6789
|
||||
|
||||
# Dynamic partitions
|
||||
PRODUCT_USE_DYNAMIC_PARTITIONS := true
|
||||
|
||||
|
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2020 The Potato Open Sauce 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.
|
||||
*/
|
||||
|
||||
|
||||
android_app {
|
||||
name: "DT2W-Service-MT6789",
|
||||
|
||||
srcs: ["src/**/*.java"],
|
||||
resource_dirs: ["res"],
|
||||
|
||||
certificate: "platform",
|
||||
platform_apis: true,
|
||||
privileged: true,
|
||||
|
||||
optimize: {
|
||||
enabled: false,
|
||||
},
|
||||
|
||||
required: [
|
||||
"privapp-permissions_co.potatoproject.dt2w.MT6789",
|
||||
"shirayuki-dt2w"
|
||||
]
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "privapp-permissions_co.potatoproject.dt2w.MT6789",
|
||||
sub_dir: "permissions",
|
||||
src: "privapp-permissions_co.potatoproject.dt2w.MT6789.xml",
|
||||
filename_from_src: true,
|
||||
}
|
||||
|
||||
cc_binary {
|
||||
name: "shirayuki-dt2w",
|
||||
srcs: [
|
||||
"shirayuki-dt2w.c",
|
||||
],
|
||||
vendor: true
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="co.potatoproject.dt2w.MT6789"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||
|
||||
<application android:label="@string/app_name">
|
||||
|
||||
<receiver android:name=".OnBootCompleteReceiver" android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service android:enabled="true" android:name=".DT2WServiceMT6789" />
|
||||
</application>
|
||||
</manifest>
|
|
@ -1,18 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 The LineageOS 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.
|
||||
-->
|
||||
<permissions>
|
||||
<privapp-permissions package="co.potatoproject.dt2w.MT6789">
|
||||
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
|
||||
</privapp-permissions>
|
||||
</permissions>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">双击唤醒服务</string>
|
||||
</resources>
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">DT2W Service</string>
|
||||
</resources>
|
|
@ -1,70 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
|
||||
#define GESTURE_FUNCTION_PATH "/proc/gesture_function"
|
||||
#define GESTURE_STATE_PATH "/proc/gesture_state"
|
||||
#define DT2W_STATE_PROP "persist.sys.MT6789.dt2w"
|
||||
|
||||
// me noob sar
|
||||
|
||||
// sounds like a great idea, with the best of intentions
|
||||
|
||||
int main() {
|
||||
FILE *fp, *fpState;
|
||||
char cmd[100];
|
||||
char buffer[20];
|
||||
char stateBuffer[20];
|
||||
|
||||
// Wait until we finish boot
|
||||
sprintf(cmd, "getprop sys.boot_completed");
|
||||
while (system(cmd) != 0); // Assuming 'getprop' returns 0 when boot is completed
|
||||
|
||||
// Main loop to continuously monitor and adjust gesture function
|
||||
while (1) {
|
||||
sprintf(cmd, "getprop %s", DT2W_STATE_PROP);
|
||||
fp = popen(cmd, "r");
|
||||
if (fp == NULL) {
|
||||
printf("prop not found\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
fgets(buffer, sizeof(buffer)-1, fp);
|
||||
pclose(fp);
|
||||
|
||||
// Remove trailing newline character, just so it's clean
|
||||
buffer[strcspn(buffer, "\n")] = 0;
|
||||
|
||||
// see if gesture_state nude already has the value we want
|
||||
sprintf(cmd, "awk '/cc:/ {print $2}' %s", GESTURE_STATE_PATH);
|
||||
fpState = popen(cmd, "r");
|
||||
if (fpState != NULL) {
|
||||
fgets(stateBuffer, sizeof(stateBuffer)-1, fpState);
|
||||
pclose(fpState);
|
||||
|
||||
// Remove trailing newline character
|
||||
stateBuffer[strcspn(stateBuffer, "\n")] = 0;
|
||||
|
||||
if ((strcmp(buffer, "0") == 0 && strcmp(stateBuffer, "cc:0") != 0) ||
|
||||
(strcmp(buffer, "1") == 0 && strcmp(stateBuffer, "cc:1") != 0)) {
|
||||
// it doesn't have the value we want, go write
|
||||
fp = fopen(GESTURE_FUNCTION_PATH, "w");
|
||||
if (fp != NULL) {
|
||||
if (strcmp(buffer, "0") == 0) {
|
||||
fputs("cc2", fp);
|
||||
} else if (strcmp(buffer, "1") == 0) {
|
||||
fputs("cc1", fp);
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("Failed to read gesture state\n");
|
||||
}
|
||||
|
||||
sleep(1); // Sleep for 1 second before checking again
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
package co.potatoproject.dt2w.MT6789;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.provider.Settings.Secure;
|
||||
|
||||
public class DT2WServiceMT6789 extends Service {
|
||||
private static final String TAG = "DT2WServiceMT6789";
|
||||
private Context mContext;
|
||||
private Handler mHandler;
|
||||
private CustomSettingsObserver mCustomSettingsObserver;
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startid) {
|
||||
mContext = this;
|
||||
mHandler = new Handler(Looper.getMainLooper());
|
||||
mCustomSettingsObserver = new CustomSettingsObserver(mHandler);
|
||||
mCustomSettingsObserver.observe();
|
||||
mCustomSettingsObserver.update();
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
private class CustomSettingsObserver extends ContentObserver {
|
||||
CustomSettingsObserver(Handler handler) {
|
||||
super(handler);
|
||||
}
|
||||
|
||||
void observe() {
|
||||
ContentResolver resolver = mContext.getContentResolver();
|
||||
resolver.registerContentObserver(Secure.getUriFor(Secure.DOUBLE_TAP_TO_WAKE),
|
||||
false, this, UserHandle.USER_CURRENT);
|
||||
}
|
||||
|
||||
void update() {
|
||||
int dt2wValue = Secure.getInt(mContext.getContentResolver(), Secure.DOUBLE_TAP_TO_WAKE, 0);
|
||||
boolean dt2wEnabled = dt2wValue == 1;
|
||||
SystemProperties.set("persist.sys.MT6789.dt2w", dt2wEnabled ? "1" : "0");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChange(boolean selfChange, Uri uri) {
|
||||
if (uri.equals(Secure.getUriFor(Secure.DOUBLE_TAP_TO_WAKE))) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package co.potatoproject.dt2w.MT6789;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.UserHandle;
|
||||
|
||||
public class OnBootCompleteReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
Intent sIntent = new Intent(context, DT2WServiceMT6789.class);
|
||||
context.startServiceAsUser(sIntent, UserHandle.CURRENT);
|
||||
}
|
||||
}
|
|
@ -102,9 +102,3 @@ on property:sys.boot_completed=1
|
|||
write /sys/kernel/tracing/instances/mmstat/events/mmstat/enable 1
|
||||
write /sys/kernel/tracing/instances/mmstat/tracing_on 1
|
||||
|
||||
# Shirayuki-DT2W Helper Service
|
||||
service shirayuki_dt2w /vendor/bin/shirayuki-dt2w
|
||||
class late_start
|
||||
user root
|
||||
group root
|
||||
oneshot
|
||||
|
|
Loading…
Reference in a new issue