28 | * Functionally speaking, it's actually a CheckBoxPreference. We only modified
29 | * the widget to RadioButton to make it "look like" a RadioButtonPreference.
30 | *
31 | * In other words, there's no "RadioButtonPreferenceGroup" in this
32 | * implementation. When you check one RadioButtonPreference, if you want to
33 | * uncheck all the other preferences, you should do that by code yourself.
34 | */
35 |
36 | public class RadioButtonPreference extends CheckBoxPreference {
37 |
38 | public RadioButtonPreference(Context context, AttributeSet attrs, int defStyle) {
39 | super(context, attrs, defStyle);
40 | setWidgetLayoutResource(R.layout.preference_widget_radiobutton);
41 | }
42 |
43 | public RadioButtonPreference(Context context, AttributeSet attrs) {
44 | this(context, attrs, TypedArrayUtils.getAttr(context,
45 | androidx.preference.R.attr.preferenceStyle,
46 | android.R.attr.preferenceStyle));
47 | }
48 |
49 | public RadioButtonPreference(Context context) {
50 | this(context, null);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/interfaces/biometrics/fingerprint/2.1/IBiometricsFingerprintClientCallback.hal:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package vendor.oppo.hardware.biometrics.fingerprint@2.1;
18 |
19 | /* This HAL interface communicates asynchronous results from the
20 | fingerprint driver in response to user actions on the fingerprint sensor
21 | */
22 | interface IBiometricsFingerprintClientCallback {
23 |
24 | oneway onEnrollResult(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, uint32_t remaining);
25 |
26 | oneway onAcquired(uint64_t deviceId, FingerprintAcquiredInfo acquiredInfo, int32_t vendorCode);
27 |
28 | oneway onAuthenticated(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, vec token);
29 |
30 | oneway onError(uint64_t deviceId, FingerprintError error, int32_t vendorCode);
31 |
32 | oneway onRemoved(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, uint32_t remaining);
33 |
34 | oneway onEnumerate(uint64_t deviceId, uint32_t fingerId, uint32_t groupId, uint32_t remaining);
35 |
36 | oneway onTouchUp(uint64_t deviceId);
37 | oneway onTouchDown(uint64_t deviceId);
38 | oneway onSyncTemplates(uint64_t deviceId, vec fingerId, uint32_t remaining);
39 | oneway onFingerprintCmd(int32_t deviceId, vec groupId, uint32_t remaining);
40 | oneway onImageInfoAcquired(uint32_t type, uint32_t quality, uint32_t match_score);
41 | oneway onMonitorEventTriggered(uint32_t type, string data);
42 | oneway onEngineeringInfoUpdated(uint32_t length, vec keys, vec values);
43 |
44 | };
45 |
--------------------------------------------------------------------------------
/app/RealmeParts/src/com/realmeparts/services/FPSTileService.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (C) 2020 DerpFest ROM
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.realmeparts;
18 |
19 | import android.app.ActivityManager;
20 | import android.content.Intent;
21 | import android.os.Handler;
22 | import android.service.quicksettings.Tile;
23 | import android.service.quicksettings.TileService;
24 |
25 | // TODO: Add FPS drawables
26 | public class FPSTileService extends TileService {
27 |
28 | private final String KEY_FPS_INFO = "fps_info";
29 |
30 | private boolean isShowing = false;
31 |
32 | public FPSTileService() { }
33 |
34 | @Override
35 | public void onStartListening() {
36 | super.onStartListening();
37 | ActivityManager manager =
38 | (ActivityManager) getSystemService(this.ACTIVITY_SERVICE);
39 | for (ActivityManager.RunningServiceInfo service :
40 | manager.getRunningServices(Integer.MAX_VALUE)) {
41 | if (FPSInfoService.class.getName().equals(
42 | service.service.getClassName())) {
43 | isShowing = true;
44 | }
45 | }
46 | updateTile();
47 | }
48 |
49 | @Override
50 | public void onClick() {
51 | Intent fpsinfo = new Intent(this, FPSInfoService.class);
52 | if (!isShowing)
53 | this.startService(fpsinfo);
54 | else
55 | this.stopService(fpsinfo);
56 | isShowing = !isShowing;
57 | updateTile();
58 | }
59 |
60 | private void updateTile() {
61 | final Tile tile = getQsTile();
62 | tile.setState(isShowing ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
63 | tile.updateTile();
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/hidl/fingerprint/android.hardware.biometrics.fingerprint@2.1-service.RMX2020.rc:
--------------------------------------------------------------------------------
1 | import /vendor/etc/init/vendor.silead.hardware.fingerprintext@1.0-service.rc
2 |
3 | on post-fs-data
4 |
5 | chmod 0660 /dev/esfp0
6 | chown system system /dev/esfp0
7 | chown system system /sys/devices/platform/egis_input/navigation_event
8 | chown system system /sys/devices/platform/egis_input/navigation_enable
9 | chmod 0666 /sys/devices/platform/egis_input/navigation_event
10 | chmod 0666 /sys/devices/platform/egis_input/navigation_enable
11 |
12 | mkdir /data/vendor/silead 0770 system system
13 | chmod 0660 /dev/silead_fp
14 | chown system system /dev/silead_fp
15 |
16 | mkdir /data/vendor/fingerprint 0770 system system
17 | mkdir /mnt/vendor/persist/fingerprint 0770 system system
18 | mkdir /data/vendor/egis 0770 system system
19 |
20 | service vendor.fps_hal.RMX2020 /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service.RMX2020
21 | # "class hal" causes a race condition on some devices due to files created
22 | # in /data. As a workaround, postpone startup until later in boot once
23 | # /data is mounted.
24 | class late_start
25 | user system
26 | group system input uhid
27 |
28 | service ets_hal /vendor/bin/hw/android.hardware.biometrics.fingerprint@2.1-service-rbs
29 | # "class hal" causes a race condition on some devices due to files created
30 | # in /data. As a workaround, postpone startup until later in boot once
31 | # /data is mounted.
32 | class late_start
33 | user system
34 | group system input
35 | disabled
36 |
37 | on property:persist.vendor.fingerprint.fp_id=E_520 && property:init.svc.fps_hal=running && property:init.svc.fpexts_hal=running && property:init.svc.vendor.fps_hal.RMX2020=running
38 | stop fps_hal
39 | stop fpexts_hal
40 | stop vendor.fps_hal.RMX2020
41 | start ets_hal
42 |
43 | on property:persist.vendor.fingerprint.available=false
44 | mount none /vendor/lost+found /vendor/etc/vintf/manifest/android.hardware.biometrics.fingerprint@2.1-service.RMX2020.xml bind
45 | mount none /vendor/lost+found /vendor/etc/permissions/android.hardware.fingerprint.xml bind
46 | stop fps_hal
47 | stop fpexts_hal
48 | stop vendor.fps_hal.RMX2020
49 | stop ets_hal
50 |
--------------------------------------------------------------------------------
/reorder-libs.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2021 The LineageOS Project
4 | #
5 | # SPDX-License-Identifier: Apache-2.0
6 | #
7 |
8 | from functools import cmp_to_key
9 | from locale import LC_ALL, setlocale, strcoll
10 | from pathlib import Path
11 |
12 | FILES = [Path(file) for file in [
13 | "proprietary-files.txt",
14 | ]]
15 |
16 | setlocale(LC_ALL, "C")
17 |
18 | def removeprefix(string: str, prefix: str) -> str:
19 | return string[len(prefix):] if string.startswith(prefix) else string
20 |
21 | def strcoll_extract_utils(string1: str, string2: str) -> int:
22 | # Skip logic if one of the string if empty
23 | if not string1 or not string2:
24 | return strcoll(string1, string2)
25 |
26 | # Remove '-' from strings if there,
27 | # it is used to indicate a build target
28 | string1 = removeprefix(string1, '-')
29 | string2 = removeprefix(string2, '-')
30 |
31 | # If no directories, compare normally
32 | if not "/" in string1 and not "/" in string2:
33 | return strcoll(string1, string2)
34 |
35 | string1_dir = string1.rsplit("/", 1)[0] + "/"
36 | string2_dir = string2.rsplit("/", 1)[0] + "/"
37 | if string1_dir == string2_dir:
38 | # Same directory, compare normally
39 | return strcoll(string1, string2)
40 |
41 | if string1_dir.startswith(string2_dir):
42 | # First string dir is a subdirectory of the second one,
43 | # return string1 > string2
44 | return -1
45 |
46 | if string2_dir.startswith(string1_dir):
47 | # Second string dir is a subdirectory of the first one,
48 | # return string2 > string1
49 | return 1
50 |
51 | # Compare normally
52 | return strcoll(string1, string2)
53 |
54 | for file in FILES:
55 | if not file.is_file():
56 | print(f"File {str(file)} not found")
57 | continue
58 |
59 | with open(file, 'r') as f:
60 | sections = f.read().split("\n\n")
61 |
62 | ordered_sections = []
63 | for section in sections:
64 | section_list = [line.strip() for line in section.splitlines()]
65 | section_list.sort(key=cmp_to_key(strcoll_extract_utils))
66 | ordered_sections.append("\n".join(section_list))
67 |
68 | with open(file, 'w') as f:
69 | f.write("\n\n".join(ordered_sections).strip() + "\n")
70 |
--------------------------------------------------------------------------------
/update-sha1sums.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #
3 | # Copyright (C) 2016 The CyanogenMod Project
4 | # Copyright (C) 2017-2020 The LineageOS Project
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | import os
20 | import sys
21 | from hashlib import sha1
22 |
23 | device='RMX2020'
24 | vendor='realme'
25 |
26 | with open('proprietary-files.txt', 'r') as f:
27 | lines = f.read().splitlines()
28 | vendorPath = '../../../vendor/' + vendor + '/' + device + '/proprietary'
29 | needSHA1 = False
30 |
31 |
32 | def cleanup():
33 | for index, line in enumerate(lines):
34 | # Skip empty or commented lines
35 | if len(line) == 0 or line[0] == '#' or '|' not in line:
36 | continue
37 |
38 | # Drop SHA1 hash, if existing
39 | lines[index] = line.split('|')[0]
40 |
41 |
42 | def update():
43 | for index, line in enumerate(lines):
44 | # Skip empty lines
45 | if len(line) == 0:
46 | continue
47 |
48 | # Check if we need to set SHA1 hash for the next files
49 | if line[0] == '#':
50 | needSHA1 = (' - from' in line)
51 | continue
52 |
53 | if needSHA1:
54 | # Remove existing SHA1 hash
55 | line = line.split('|')[0]
56 |
57 | filePath = line.split(';')[0].split(':')[-1]
58 | if filePath[0] == '-':
59 | filePath = filePath[1:]
60 |
61 | with open(os.path.join(vendorPath, filePath), 'rb') as f:
62 | hash = sha1(f.read()).hexdigest()
63 |
64 | lines[index] = '%s|%s' % (line, hash)
65 |
66 |
67 | if len(sys.argv) == 2 and sys.argv[1] == '-c':
68 | cleanup()
69 | else:
70 | update()
71 |
72 | with open('proprietary-files.txt', 'w') as file:
73 | file.write('\n'.join(lines) + '\n')
74 |
--------------------------------------------------------------------------------
/app/RealmeParts/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 | Device Settings
15 | Adjust device specific settings
16 | Display
17 | Misc settings
18 |
19 |
20 | Use ambient display
21 |
22 |
23 | CABC Mode
24 | CABC Profiles
25 | Off
26 | On
27 | Balanced Mode
28 | Super power saving mode
29 |
30 |
31 | Enable USB-OTG power supply for external headphones and flash drives
32 | Enable USB-OTG
33 | Enable USB-OTG
34 |
35 |
36 | Device Performance
37 | Performance Profile
38 | Balanced
39 | Power save
40 | Performance
41 |
42 |
43 | FPS overlay
44 | Show overlay with current frames per second
45 |
46 |
47 | Unsupported
48 |
49 |
--------------------------------------------------------------------------------
/app/dt2w/src/org/lineageos/dt2w/RMX2020/DT2WServiceRMX2020.java:
--------------------------------------------------------------------------------
1 | package org.lineageos.dt2w.RMX2020;
2 |
3 | import android.app.Service;
4 | import android.content.ContentResolver;
5 | import android.content.Context;
6 | import android.content.Intent;
7 | import android.database.ContentObserver;
8 | import android.net.Uri;
9 | import android.os.Handler;
10 | import android.os.IBinder;
11 | import android.os.Looper;
12 | import android.os.SystemProperties;
13 | import android.os.UserHandle;
14 | import android.provider.Settings.Secure;
15 |
16 | public class DT2WServiceRMX2020 extends Service {
17 | private static final String TAG = "DT2WServiceRMX2020";
18 | private Context mContext;
19 | private Handler mHandler;
20 | private CustomSettingsObserver mCustomSettingsObserver;
21 |
22 | @Override
23 | public IBinder onBind(Intent intent) {
24 | return null;
25 | }
26 |
27 | @Override
28 | public void onDestroy() {
29 | super.onDestroy();
30 | }
31 |
32 | @Override
33 | public int onStartCommand(Intent intent, int flags, int startid) {
34 | mContext = this;
35 | mHandler = new Handler(Looper.getMainLooper());
36 | mCustomSettingsObserver = new CustomSettingsObserver(mHandler);
37 | mCustomSettingsObserver.observe();
38 | mCustomSettingsObserver.update();
39 | return START_STICKY;
40 | }
41 |
42 | private class CustomSettingsObserver extends ContentObserver {
43 | CustomSettingsObserver(Handler handler) {
44 | super(handler);
45 | }
46 |
47 | void observe() {
48 | ContentResolver resolver = mContext.getContentResolver();
49 | resolver.registerContentObserver(Secure.getUriFor(Secure.DOUBLE_TAP_TO_WAKE),
50 | false, this, UserHandle.USER_CURRENT);
51 | }
52 |
53 | void update() {
54 | int dt2wValue = Secure.getInt(mContext.getContentResolver(), Secure.DOUBLE_TAP_TO_WAKE, 0);
55 | boolean dt2wEnabled = dt2wValue == 1;
56 | SystemProperties.set("persist.sys.dt2w", dt2wEnabled ? "1" : "0");
57 | }
58 |
59 | @Override
60 | public void onChange(boolean selfChange, Uri uri) {
61 | if (uri.equals(Secure.getUriFor(Secure.DOUBLE_TAP_TO_WAKE))) {
62 | update();
63 | }
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/rro_overlays/SettingsOverlayRMX2020/res/values/config.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
17 |
19 |
20 |
21 |
22 |
23 | false
24 |
25 |
39 | 3
40 |
41 |
42 |
--------------------------------------------------------------------------------
/hidl/fingerprint/service.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | #define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.RMX2020"
18 |
19 | #include
20 | #include
21 |
22 | #include "BiometricsFingerprint.h"
23 |
24 | using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
25 | using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
26 | using android::hardware::configureRpcThreadpool;
27 | using android::hardware::joinRpcThreadpool;
28 | using android::OK;
29 | using android::sp;
30 | using android::status_t;
31 |
32 | int main() {
33 | sp biometricsFingerprint;
34 | status_t status;
35 |
36 | LOG(INFO) << "Fingerprint HAL Adapter service is starting.";
37 |
38 | biometricsFingerprint = new BiometricsFingerprint();
39 | if (biometricsFingerprint == nullptr) {
40 | LOG(ERROR) << "Can not create an instance of Fingerprint HAL Adapter BiometricsFingerprint Iface, exiting.";
41 | goto shutdown;
42 | }
43 |
44 | configureRpcThreadpool(1, true /*callerWillJoin*/);
45 |
46 | status = biometricsFingerprint->registerAsService();
47 | if (status != OK) {
48 | LOG(ERROR) << "Could not register service for Fingerprint HAL Adapter BiometricsFingerprint Iface ("
49 | << status << ")";
50 | goto shutdown;
51 | }
52 |
53 | LOG(INFO) << "Fingerprint HAL Adapter service is ready.";
54 | joinRpcThreadpool();
55 | // Should not pass this line
56 |
57 | shutdown:
58 | // In normal operation, we don't expect the thread pool to shutdown
59 | LOG(ERROR) << "Fingerprint HAL Adapter service is shutting down.";
60 | return 1;
61 | }
62 |
--------------------------------------------------------------------------------
/libshims/libshim_showlogo.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | using namespace android;
5 |
6 | extern "C" {
7 |
8 | void _ZN7android21SurfaceComposerClient11Transaction20setDisplayProjectionERKNS_2spINS_7IBinderEEEjRKNS_4RectES9_(const sp& token,uint32_t orientation,const android::Rect& layerStackRect,const android::Rect& displayRect) {
9 | SurfaceComposerClient::Transaction *t = nullptr;
10 | t->setDisplayProjection(token, static_cast(orientation), layerStackRect, displayRect);
11 | }
12 |
13 | void _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8EjjijRKNS_2spINS_7IBinderEEENS_13LayerMetadataEPj(const String8& name, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, const sp& parentHandle, LayerMetadata metadata, uint32_t* outTransformHint);
14 |
15 | void _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8EjjijPNS_14SurfaceControlENS_13LayerMetadataE(const String8& name, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, SurfaceControl* parent, LayerMetadata metadata) {
16 | _ZN7android21SurfaceComposerClient13createSurfaceERKNS_7String8EjjijRKNS_2spINS_7IBinderEEENS_13LayerMetadataEPj(name, w, h, format, flags, nullptr, metadata, nullptr);
17 | }
18 |
19 | void _ZN7android14SurfaceControlD0Ev(void);
20 |
21 | void _ZN7android14SurfaceControl7releaseEv(void) {
22 | _ZN7android14SurfaceControlD0Ev();
23 | }
24 |
25 | void _ZN7android21SurfaceComposerClient20getStaticDisplayInfoERKNS_2spINS_7IBinderEEEPNS_2ui17StaticDisplayInfoE(void);
26 |
27 | void _ZN7android21SurfaceComposerClient14getDisplayInfoERKNS_2spINS_7IBinderEEEPNS_11DisplayInfoE(void) {
28 | _ZN7android21SurfaceComposerClient20getStaticDisplayInfoERKNS_2spINS_7IBinderEEEPNS_2ui17StaticDisplayInfoE();
29 | }
30 |
31 | void _ZN7android14SurfaceControl10getSurfaceEv(void);
32 |
33 | void _ZNK7android14SurfaceControl10getSurfaceEv(void) {
34 | _ZN7android14SurfaceControl10getSurfaceEv();
35 | }
36 |
37 | status_t _ZN7android21SurfaceComposerClient11Transaction5applyEbb(void* thisptr, bool synchronous, bool oneWay);
38 |
39 | status_t _ZN7android21SurfaceComposerClient11Transaction5applyEb(void* thisptr, bool synchronous) {
40 | return _ZN7android21SurfaceComposerClient11Transaction5applyEbb(thisptr, synchronous, false /* oneWay */);
41 | }
42 |
43 | ui::Size _ZN7android2ui4Size7INVALIDE;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/app/RealmeParts/src/com/realmeparts/services/CABCTileService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2021 The LineageOS Project
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | *
17 | */
18 | package com.realmeparts;
19 |
20 | import android.content.SharedPreferences;
21 | import android.service.quicksettings.Tile;
22 | import android.service.quicksettings.TileService;
23 |
24 | import androidx.preference.PreferenceManager;
25 |
26 | public class CABCTileService extends TileService {
27 |
28 | @Override
29 | public void onStartListening() {
30 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
31 |
32 | int currentState = Utils.getintProp(DeviceSettings.CABC_SYSTEM_PROPERTY, 0);
33 |
34 | Tile tile = getQsTile();
35 |
36 | if (!sharedPrefs.getBoolean("CABC_DeviceMatched", false)) {
37 | tile.setState(Tile.STATE_UNAVAILABLE);
38 | tile.setLabel(getResources().getString(R.string.unsupported));
39 | } else {
40 | tile.setState(Tile.STATE_ACTIVE);
41 | tile.setLabel(getResources().getStringArray(R.array.cabc_profiles)[currentState]);
42 | }
43 |
44 | tile.updateTile();
45 | super.onStartListening();
46 | }
47 |
48 | @Override
49 | public void onClick() {
50 | int currentState = Utils.getintProp(DeviceSettings.CABC_SYSTEM_PROPERTY, 0);
51 |
52 | int nextState;
53 | if (currentState == 3) {
54 | nextState = 0;
55 | } else {
56 | nextState = currentState + 1;
57 | }
58 |
59 | Tile tile = getQsTile();
60 | Utils.setintProp(DeviceSettings.CABC_SYSTEM_PROPERTY, nextState);
61 | tile.setLabel(getResources().getStringArray(R.array.cabc_profiles)[nextState]);
62 |
63 | tile.updateTile();
64 | super.onClick();
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/configs/props/system.prop:
--------------------------------------------------------------------------------
1 | # Audio
2 | ro.camera.sound.forced=0
3 | ro.audio.silent=0
4 | ro.config.vc_call_vol_steps=15
5 |
6 | # Brand
7 | Build.BRAND=MTK
8 |
9 | # Camera
10 | persist.vendor.camera.privapp.list=com.android.camera,com.google.camera,org.lineageos.aperture
11 | vendor.camera.aux.packagelist=com.android.camera,com.google.camera,net.sourceforge.opencamera,org.lineageos.aperture
12 | vendor.camera.aux.packageexcludelist=org.telegram.messenger,com.microsoft.teams,com.discord
13 |
14 | # Graphics
15 | ro.opengles.version=196610
16 |
17 | # Dex
18 | dalvik.vm.dex2oat64.enabled=true
19 | persist.bg.dexopt.enable=true
20 | dalvik.vm.dexopt.secondary=true
21 | pm.dexopt.install=speed-profile
22 | pm.dexopt.bg-dexopt=speed-profile
23 | pm.dexopt.boot=verify
24 | pm.dexopt.first-boot=quicken
25 | dalvik.vm.dex2oat-cpu-set=0,1,2,3,4,5
26 | dalvik.vm.dex2oat-threads=6
27 |
28 | # Display
29 | debug.sf.enable_hwc_vds=0
30 | persist.sys.brightness.low.gamma=true
31 |
32 | # FUSE passthrough
33 | persist.sys.fuse.passthrough.enable=true
34 |
35 | # IMS
36 | persist.dbg.volte_avail_ovr=1
37 | persist.dbg.vt_avail_ovr=1
38 | persist.dbg.wfc_avail_ovr=1
39 | persist.dbg.ims_volte_enable=1
40 | persist.radio.rat_on=combine
41 | persist.radio.data_ltd_sys_ind=1
42 | persist.radio.data_con_rprt=1
43 | persist.radio.calls.on.ims=1
44 |
45 | # RIL
46 | persist.sys.radio.force_lte_ca=true
47 | persist.sys.fflag.override.settings_provider_model=false
48 |
49 | # IPO
50 | sys.ipo.pwrdncap=2
51 | sys.ipo.disable=1
52 |
53 | # Kernel
54 | ro.kernel.zio=38,108,105,16
55 |
56 | # Low Memory Killer
57 | ro.config.low_ram=false
58 | ro.config.per_app_memcg=false
59 |
60 | # Order
61 | ro.product.property_source_order=odm,vendor,product,system
62 |
63 | # Performance
64 | ro.mtk_perf_simple_start_win=1
65 | ro.mtk_perf_fast_start_win=1
66 | ro.mtk_perf_response_time=1
67 |
68 | # Product
69 | ro.product.board=oppo6769
70 | ro.board.platform=mt6768
71 | ro.hardware.egl=mali
72 |
73 | # System
74 | persist.sys.binary_xml=false
75 |
76 | # USB
77 | ro.sys.usb.mtp.whql.enable=0
78 | ro.sys.usb.storage.type=mtp
79 | ro.sys.usb.bicr=no
80 | ro.sys.usb.charging.only=yes
81 |
82 | # Wifi
83 | wifi.interface=wlan0
84 | ro.mediatek.wlan.wsc=1
85 | ro.mediatek.wlan.p2p=1
86 | mediatek.wlan.ctia=0
87 | wifi.tethering.interface=ap0
88 | wifi.direct.interface=p2p0
89 |
90 | # ZRAM
91 | ro.zram.mark_idle_delay_mins=60
92 | ro.zram.first_wb_delay_mins=1440
93 | ro.zram.periodic_wb_delay_hours=24
94 |
95 | # Zygote
96 | ro.zygote.preload.enable=0
97 |
--------------------------------------------------------------------------------
/app/RealmeParts/src/com/realmeparts/services/OtgToggleService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 The OmniROM Project
3 | *
4 | * This program is free software: you can redistribute it and/or modify
5 | * it under the terms of the GNU General Public License as published by
6 | * the Free Software Foundation, either version 2 of the License, or
7 | * (at your option) any later version.
8 | *
9 | * This program is distributed in the hope that it will be useful,
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | * GNU General Public License for more details.
13 | *
14 | * You should have received a copy of the GNU General Public License
15 | * along with this program. If not, see .
16 | *
17 | */
18 |
19 | package com.realmeparts;
20 |
21 | import android.annotation.TargetApi;
22 | import android.content.SharedPreferences;
23 | import android.service.quicksettings.Tile;
24 | import android.service.quicksettings.TileService;
25 |
26 | import androidx.preference.PreferenceManager;
27 |
28 | @TargetApi(24)
29 | public class OtgToggleService extends TileService {
30 | private boolean enabled = false;
31 |
32 | @Override
33 | public void onDestroy() {
34 | super.onDestroy();
35 | }
36 |
37 | @Override
38 | public void onTileAdded() {
39 | super.onTileAdded();
40 | }
41 |
42 | @Override
43 | public void onTileRemoved() {
44 | super.onTileRemoved();
45 | }
46 |
47 | @Override
48 | public void onStartListening() {
49 | super.onStartListening();
50 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
51 | enabled = OTGModeSwitch.isCurrentlyEnabled(this);
52 | getQsTile().setState(enabled ? Tile.STATE_ACTIVE : Tile.STATE_INACTIVE);
53 | getQsTile().updateTile();
54 |
55 | }
56 |
57 | @Override
58 | public void onStopListening() {
59 | super.onStopListening();
60 | }
61 |
62 | @Override
63 | public void onClick() {
64 | super.onClick();
65 | SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
66 | enabled = OTGModeSwitch.isCurrentlyEnabled(this);
67 | Utils.writeValue(OTGModeSwitch.getFile(), enabled ? "0" : "1");
68 | sharedPrefs.edit().putBoolean(DeviceSettings.KEY_OTG_SWITCH, !enabled).apply();
69 | getQsTile().setState(enabled ? Tile.STATE_INACTIVE : Tile.STATE_ACTIVE);
70 | getQsTile().updateTile();
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/RealmeParts/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/configs/audio/audio_em.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/app/RealmeParts/src/com/realmeparts/preferences/SecureSettingsStore.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 AICP
3 | * Copyright (C) 2018 CarbonROM
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 |
18 | package com.realmeparts;
19 |
20 | import android.content.ContentResolver;
21 | import android.preference.PreferenceDataStore;
22 | import android.provider.Settings;
23 |
24 | public class SecureSettingsStore extends androidx.preference.PreferenceDataStore
25 | implements PreferenceDataStore {
26 |
27 | private final ContentResolver mContentResolver;
28 |
29 | public SecureSettingsStore(ContentResolver contentResolver) {
30 | mContentResolver = contentResolver;
31 | }
32 |
33 | public boolean getBoolean(String key, boolean defValue) {
34 | return getInt(key, defValue ? 1 : 0) != 0;
35 | }
36 |
37 | public float getFloat(String key, float defValue) {
38 | return Settings.Secure.getFloat(mContentResolver, key, defValue);
39 | }
40 |
41 | public int getInt(String key, int defValue) {
42 | return Settings.Secure.getInt(mContentResolver, key, defValue);
43 | }
44 |
45 | public long getLong(String key, long defValue) {
46 | return Settings.Secure.getLong(mContentResolver, key, defValue);
47 | }
48 |
49 | public String getString(String key, String defValue) {
50 | String result = Settings.Secure.getString(mContentResolver, key);
51 | return result == null ? defValue : result;
52 | }
53 |
54 | public void putBoolean(String key, boolean value) {
55 | putInt(key, value ? 1 : 0);
56 | }
57 |
58 | public void putFloat(String key, float value) {
59 | Settings.Secure.putFloat(mContentResolver, key, value);
60 | }
61 |
62 | public void putInt(String key, int value) {
63 | Settings.Secure.putInt(mContentResolver, key, value);
64 | }
65 |
66 | public void putLong(String key, long value) {
67 | Settings.Secure.putLong(mContentResolver, key, value);
68 | }
69 |
70 | public void putString(String key, String value) {
71 | Settings.Secure.putString(mContentResolver, key, value);
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/RealmeParts/src/com/realmeparts/preferences/SecureSettingListPreference.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 AICP
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.realmeparts;
18 |
19 | import android.content.Context;
20 | import android.text.TextUtils;
21 | import android.util.AttributeSet;
22 |
23 | import androidx.preference.ListPreference;
24 |
25 | public class SecureSettingListPreference extends ListPreference {
26 | private boolean mAutoSummary = false;
27 |
28 | public SecureSettingListPreference(Context context, AttributeSet attrs, int defStyle) {
29 | super(context, attrs, defStyle);
30 | setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
31 | }
32 |
33 | public SecureSettingListPreference(Context context, AttributeSet attrs) {
34 | super(context, attrs);
35 | setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
36 | }
37 |
38 | public SecureSettingListPreference(Context context) {
39 | super(context);
40 | setPreferenceDataStore(new SecureSettingsStore(context.getContentResolver()));
41 | }
42 |
43 | @Override
44 | public void setValue(String value) {
45 | super.setValue(value);
46 | if (mAutoSummary || TextUtils.isEmpty(getSummary())) {
47 | setSummary(getEntry(), true);
48 | }
49 | }
50 |
51 | @Override
52 | public void setSummary(CharSequence summary) {
53 | setSummary(summary, false);
54 | }
55 |
56 | private void setSummary(CharSequence summary, boolean autoSummary) {
57 | mAutoSummary = autoSummary;
58 | super.setSummary(summary);
59 | }
60 |
61 | @Override
62 | protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {
63 | // This is what default ListPreference implementation is doing without respecting
64 | // real default value:
65 | //setValue(restoreValue ? getPersistedString(mValue) : (String) defaultValue);
66 | // Instead, we better do
67 | setValue(restoreValue ? getPersistedString((String) defaultValue) : (String) defaultValue);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------