RMX3031: Implement DT2W hint

Change-Id: Icaac26e4d5c3423490ac5589334fe6de34012e19
Signed-off-by: Nishant Kumar <www.rajsonu13@gmail.com>
This commit is contained in:
SamarV-121
2023-09-08 15:41:30 +05:30
committed by Nishant Kumar
parent d47bb70656
commit 4748d4d611
9 changed files with 14 additions and 177 deletions

View File

@@ -252,6 +252,14 @@
"Path": "vendor.powerhal.rendering",
"Values": ["EXPENSIVE_RENDERING", ""],
"Type": "Property"
},
{
"Name": "DoubleTapToWakeEnable",
"Path": "/proc/touchpanel/double_tap_enable",
"Values": [
"1",
"0"
]
}
],
"Actions": [
@@ -386,6 +394,12 @@
"Node": "GPUSchedMode",
"Duration": 0,
"Value": "1"
},
{
"PowerHint": "DOUBLE_TAP_TO_WAKE",
"Node": "DoubleTapToWakeEnable",
"Duration": 0,
"Value": "1"
}
]
}

View File

@@ -134,10 +134,6 @@ PRODUCT_PACKAGES += \
android.hardware.graphics.common-V2-ndk.vendor \
disable_configstore
# DT2W
PRODUCT_PACKAGES += \
DT2W-Service-RMX3031
# DRM
PRODUCT_PACKAGES += \
android.hardware.drm@1.4-service.clearkey \

View File

@@ -1,42 +0,0 @@
/*
* Copyright (C) 2020 The Potato Open Sauce Project
* Copyright (C) 2020 The pixelexperience 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-RMX3031",
srcs: ["src/**/*.java"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,
privileged: true,
optimize: {
enabled: false,
},
required: [
"privapp-permissions_org.pixelexperience.dt2w.RMX3031",
],
}
prebuilt_etc {
name: "privapp-permissions_org.pixelexperience.dt2w.RMX3031",
sub_dir: "permissions",
src: "privapp-permissions_org.pixelexperience.dt2w.RMX3031.xml",
filename_from_src: true,
}

View File

@@ -1,23 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.pixelexperience.dt2w.RMX3031"
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=".DT2WServiceRMX3031" />
</application>
</manifest>

View File

@@ -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="org.pixelexperience.dt2w.RMX3031">
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
</privapp-permissions>
</permissions>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">DT2W Service for RMX3031</string>
</resources>

View File

@@ -1,66 +0,0 @@
package org.pixelexperience.dt2w.RMX3031;
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 DT2WServiceRMX3031 extends Service {
private static final String TAG = "DT2WServiceRMX3031";
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.dt2w", dt2wEnabled ? "1" : "0");
}
@Override
public void onChange(boolean selfChange, Uri uri) {
if (uri.equals(Secure.getUriFor(Secure.DOUBLE_TAP_TO_WAKE))) {
update();
}
}
}
}

View File

@@ -1,14 +0,0 @@
package org.pixelexperience.dt2w.RMX3031;
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, DT2WServiceRMX3031.class);
context.startServiceAsUser(sIntent, UserHandle.CURRENT);
}
}

View File

@@ -1013,12 +1013,6 @@ service fuelgauged_nvram /vendor/bin/fuelgauged_nvram
group system
oneshot
on property:persist.sys.dt2w=0
write /proc/touchpanel/double_tap_enable 0
on property:persist.sys.dt2w=1
write /proc/touchpanel/double_tap_enable 1
on property:ro.boot.product.hardware.sku=dsds
start vendor.nfc_hal_service
start mtk_secure_element_hal_service