mirror of
https://github.com/Evolution-X-Devices/device_oplus_mt6893-common
synced 2026-02-01 10:53:39 +00:00
@@ -132,6 +132,10 @@ PRODUCT_PACKAGES += \
|
||||
android.hardware.graphics.common-V2-ndk.vendor \
|
||||
disable_configstore
|
||||
|
||||
# DT2W
|
||||
PRODUCT_PACKAGES += \
|
||||
DT2W-Service-RMX3031
|
||||
|
||||
# DRM
|
||||
PRODUCT_PACKAGES += \
|
||||
android.hardware.drm-service.clearkey \
|
||||
|
||||
42
dt2w/Android.bp
Normal file
42
dt2w/Android.bp
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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,
|
||||
}
|
||||
23
dt2w/AndroidManifest.xml
Normal file
23
dt2w/AndroidManifest.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?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>
|
||||
4
dt2w/res/values/strings.xml
Normal file
4
dt2w/res/values/strings.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">DT2W Service for RMX3031</string>
|
||||
</resources>
|
||||
@@ -0,0 +1,66 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user