Skip to content

Commit

Permalink
feat: sound recorder - disable ai watermark
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevtinge committed Dec 4, 2024
1 parent 56939c3 commit 1958f37
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*
* 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/>.
*
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/

package com.sevtinge.hyperceiler.module.app;

import com.hchen.database.HookBase;
import com.sevtinge.hyperceiler.module.base.BaseModule;
import com.sevtinge.hyperceiler.module.hook.soundrecorder.DisableAiWatermark;

@HookBase(targetPackage = "com.android.soundrecorder", isPad = false)
public class SoundRecorder extends BaseModule {

@Override
public void handleLoadPackage() {
initHook(new DisableAiWatermark(), mPrefsMap.getBoolean("sound_recorder_disable_ai_watermark"));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
*
* 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/>.
*
* Copyright (C) 2023-2024 HyperCeiler Contributions
*/

package com.sevtinge.hyperceiler.module.hook.soundrecorder;

import android.graphics.Canvas;

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

public class DisableAiWatermark extends BaseHook {
@Override
public void init() throws NoSuchMethodException {
findAndHookMethod("com.android.soundrecorder.view.WaterMarkView", "onDraw", Canvas.class, new MethodHook() {
@Override
protected void before(MethodHookParam param) throws Throwable {
param.setResult(null);
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ public static void getAllMods(Context context, boolean force) {
parsePrefXmlForSecurityCenter(context, com.sevtinge.hyperceiler.ui.fragment.app.securitycenter.OtherSettings.class, R.xml.security_center_other);

parsePrefXmlForDashboardFragment(context, R.xml.tsmclient);
parsePrefXmlForDashboardFragment(context, R.xml.soundrecorder);
parsePrefXmlForDashboardFragment(context, R.xml.html_viewer);
parsePrefXml(context, WeatherFragment.class, R.xml.weather);
parsePrefXmlForDashboardFragment(context, R.xml.aiasst);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1191,6 +1191,9 @@
<!--笔记-->
<string name="notes">笔记</string>
<string name="notes_disable_ai_watermark">禁用水印</string>
<!--录音机-->
<string name="sound_recorder">录音机</string>
<string name="sound_recorder_disable_ai_watermark">禁用水印</string>
<!--万象息屏-->
<string name="aod">万象息屏</string>
<string name="aod_hyperos">息屏与锁屏编辑</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<item>com.android.providers.downloads.ui</item> <!--下载管理-->
<item>com.android.server.telecom</item> <!--通话管理-->
<item>com.android.settings</item> <!--设置-->
<item>com.android.soundrecorder</item> <!--录音机-->
<item>com.android.systemui</item> <!--系统界面-->
<item>com.android.thememanager</item> <!--主题壁纸-->
<item>com.android.updater</item> <!--系统更新-->
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1971,6 +1971,9 @@
<string name="notes">Notes</string>
<string name="notes_disable_ai_watermark">Disable AI watermark</string>

<string name="sound_recorder">Sound Recorder</string>
<string name="sound_recorder_disable_ai_watermark">Disable AI watermark</string>

<string name="lpa">LPA</string>
<string name="lpa_custom_imei">Custom IMEI</string>
<string name="lpa_custom_imei_desc">Make sure you\'ve entered the IMEI correctly. An incorrect IMEI may cause the eSIM to be unavailable or abnormal. We\'re not responsible for any consequences arising therefrom.</string>
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/prefs_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@
android:summary="com.android.settings"
android:title="@string/system_settings" />

<com.sevtinge.hyperceiler.prefs.PreferenceHeader
android:icon="@drawable/ic_default"
android:key="prefs_key_soundrecorder"
android:summary="com.android.soundrecorder"
android:title="@string/sound_recorder"
app:inflatedXml="@xml/soundrecorder"/>

<com.sevtinge.hyperceiler.prefs.PreferenceHeader
android:icon="@drawable/ic_default"
android:key="prefs_key_system_ui"
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/prefs_set_homepage_entrance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,14 @@
android:summary="com.android.settings"
android:title="@string/system_settings" />

<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_default"
android:key="prefs_key_soundrecorder_state"
android:layout="@layout/preference_header"
android:summary="com.android.soundrecorder"
android:title="@string/sound_recorder" />

<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_default"
Expand Down
28 changes: 28 additions & 0 deletions app/src/main/res/xml/soundrecorder.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ 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.
~
~ 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/>.
~
~ Copyright (C) 2023-2024 HyperCeiler Contributions
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:myLocation="@string/sound_recorder"
app:quick_restart="com.android.soundrecorder">
<SwitchPreference
android:title="@string/sound_recorder_disable_ai_watermark"
android:key="prefs_key_sound_recorder_disable_ai_watermark"
android:defaultValue="false" />

</PreferenceScreen>

0 comments on commit 1958f37

Please sign in to comment.