Skip to content

Commit

Permalink
添加打开原生”正在运行的服务“,需要hook设置。
Browse files Browse the repository at this point in the history
  • Loading branch information
HChenX committed Feb 14, 2024
1 parent 7626d07 commit 3c75bce
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
/*
* This file is part of HyperCeiler.
* This file is part of HyperCeiler.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.
* HyperCeiler is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/
package com.sevtinge.hyperceiler.module.app;

import static com.sevtinge.hyperceiler.utils.devicesdk.SystemSDKKt.isAndroidVersion;
Expand All @@ -39,6 +39,7 @@
import com.sevtinge.hyperceiler.module.hook.systemsettings.QuickManageOverlayPermission;
import com.sevtinge.hyperceiler.module.hook.systemsettings.QuickManageUnknownAppSources;
import com.sevtinge.hyperceiler.module.hook.systemsettings.QuickManagerAccessibilityPermission;
import com.sevtinge.hyperceiler.module.hook.systemsettings.RunningServices;
import com.sevtinge.hyperceiler.module.hook.systemsettings.UnLockAreaScreenshot;
import com.sevtinge.hyperceiler.module.hook.systemsettings.UnlockNeverSleepScreen;
import com.sevtinge.hyperceiler.module.hook.systemsettings.UnlockTaplusForSettings;
Expand All @@ -57,6 +58,7 @@ public void handleLoadPackage() {
initHook(new HyperCeilerSettings(), mPrefsMap.getStringAsInt("settings_icon", 0) != 0);

initHook(new LinkTurbo(), mPrefsMap.getBoolean("system_settings_linkturbo"));
initHook(new RunningServices(), true); // 显示原生内存信息
initHook(new UsbModeChoose(), mPrefsMap.getStringAsInt("system_settings_usb_mode_choose", 0) != 0
|| mPrefsMap.getBoolean("system_settings_usb_mode"));
initHook(new ViewWifiPasswordHook(), mPrefsMap.getBoolean("system_settings_safe_wifi"));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.sevtinge.hyperceiler.module.hook.systemsettings;

import android.content.ComponentName;
import android.content.Intent;

import com.sevtinge.hyperceiler.module.base.BaseHook;

public class RunningServices extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.android.settings.SettingsActivity",
"getStartingFragmentClass", Intent.class,
new MethodHook() {
@Override
protected void before(MethodHookParam param) {
Intent intent = (Intent) param.args[0];
ComponentName componentName = intent.getComponent();
if (componentName != null) {
String className = componentName.getClassName();
if ("com.android.settings.RunningServices".equals(className)) {
param.setResult("com.android.settings.applications.RunningServices");
}
}
}
}
);
}
}
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@
<string name="various_super_clipboard_picture_share_desc">允许复制和粘贴图片至剪贴板</string>

<string name="various_open_aosp_battery_title">电池优化</string>
<string name="various_open_aosp_running_services">正在运行的服务</string>
<string name="various_open_aosp_notification_title">通知设置</string>
<string name="various_open_aosp_app_manage_title">应用管理</string>
<string name="various_open_aosp_language_title">语言设置</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,7 @@
<string name="various_super_clipboard_files_desc">Allow copy files to clipboard</string>
<string name="various_super_clipboard_picture_share_desc">Allow copying and pasting images to the clipboard</string>
<string name="various_open_aosp_battery_title">Battery Optimization</string>
<string name="various_open_aosp_running_services">Running services</string>
<string name="various_open_aosp_notification_title">Notification Settings</string>
<string name="various_open_aosp_app_manage_title">App Management</string>
<string name="various_open_aosp_language_title">Language Settings</string>
Expand Down
51 changes: 26 additions & 25 deletions app/src/main/res/xml/various_aosp.xml
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory>
<Preference
android:title="@string/various_open_aosp_extremely_dark_title">
<Preference android:title="@string/various_open_aosp_extremely_dark_title">
<intent
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.Settings$ReduceBrightColorsSettingsActivity" />
android:targetClass="com.android.settings.Settings$ReduceBrightColorsSettingsActivity"
android:targetPackage="com.android.settings" />
</Preference>

<Preference
android:title="@string/various_open_aosp_battery_title">

<Preference android:title="@string/various_open_aosp_battery_title">
<intent
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.Settings$HighPowerApplicationsActivity" />
android:targetClass="com.android.settings.Settings$HighPowerApplicationsActivity"
android:targetPackage="com.android.settings" />
</Preference>

<Preference
android:title="@string/various_open_aosp_notification_title">

<Preference android:title="@string/various_open_aosp_running_services">
<intent
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.Settings$ConfigureNotificationSettingsActivity" />
android:targetClass="com.android.settings.RunningServices"
android:targetPackage="com.android.settings" />
</Preference>

<Preference
android:title="@string/various_open_aosp_app_manage_title">

<Preference android:title="@string/various_open_aosp_notification_title">
<intent
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.applications.ManageApplications" />
android:targetClass="com.android.settings.Settings$ConfigureNotificationSettingsActivity"
android:targetPackage="com.android.settings" />
</Preference>

<Preference
android:title="@string/various_open_aosp_language_title">

<Preference android:title="@string/various_open_aosp_app_manage_title">
<intent
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.LanguageSettings" />
android:targetClass="com.android.settings.applications.ManageApplications"
android:targetPackage="com.android.settings" />
</Preference>


<Preference android:title="@string/various_open_aosp_language_title">
<intent
android:targetClass="com.android.settings.LanguageSettings"
android:targetPackage="com.android.settings" />
</Preference>

</PreferenceCategory>
<Preference android:enabled="false" />
</PreferenceScreen>

0 comments on commit 3c75bce

Please sign in to comment.