Cherish:User toggle for unlimited photos storage [2/2]

User toggle for StreamProp [2/2]
User toggle for GamesProp [2/2]

Co-authored-by: Pranav Vashi <neobuddy89@gmail.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
Stallix
2022-05-16 18:51:04 +07:00
committed by Hưng Phan
parent ec836d4606
commit 6d47b7ee00
3 changed files with 79 additions and 1 deletions

View File

@@ -823,4 +823,17 @@
<string name="settings_home_style_summary">Use stock aosp layout for homepage</string>
<string name="disable_usercard_title">Settings UserCard</string>
<string name="disable_usercard_summary">Toggle in order not to show the usercard on main settings page</string>
<string name="spoof_title">Spoofing</string>
<!-- Unlimited g00gle ph0t0s st0rage -->
<string name="use_photos_spoof_title">Unlimited Photos storage</string>
<string name="use_photos_spoof_summary">Spoof your device as Pixel XL for Google Photos app only to provide unlimited storage for backup</string>
<!-- Unlock FPS for specific games -->
<string name="use_games_spoof_title">Unlock higher FPS in games</string>
<string name="use_games_spoof_summary">Spoof your device as a different model for specific games to unlock higher FPS</string>
<!-- Unlock higher quality streams for specific apps -->
<string name="use_stream_spoof_title">Unlock higher quality streams</string>
<string name="use_stream_spoof_summary">Spoof your device as Pixel 6 Pro to unlock higher quality streams on Amazon Prime, Disney+, Hotstar, and Netflix</string>
</resources>

View File

@@ -47,5 +47,31 @@
android:targetPackage="org.exthmui.game"
android:targetClass="org.exthmui.game.ui.MainActivity" />
</Preference>
<PreferenceCategory
android:key="spoof_category"
android:title="@string/spoof_title">
<!-- Unlimited Photos storage -->
<SwitchPreference
android:key="use_photos_spoof"
android:title="@string/use_photos_spoof_title"
android:summary="@string/use_photos_spoof_summary"
android:defaultValue="true" />
<!-- Unlock FPS for specific games -->
<SwitchPreference
android:key="use_games_spoof"
android:title="@string/use_games_spoof_title"
android:summary="@string/use_games_spoof_summary" />
<!-- Unlock higher quality streams for specific apps -->
<SwitchPreference
android:key="use_stream_spoof"
android:title="@string/use_stream_spoof_title"
android:summary="@string/use_stream_spoof_summary"
android:defaultValue="true" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.UserHandle;
import android.os.SystemProperties;
import android.content.Context;
import android.content.ContentResolver;
import android.content.res.Resources;
@@ -44,11 +45,24 @@ import java.util.List;
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class MiscSettings extends SettingsPreferenceFragment implements
OnPreferenceChangeListener {
private static final String KEY_GAMES_SPOOF = "use_games_spoof";
private static final String KEY_PHOTOS_SPOOF = "use_photos_spoof";
private static final String KEY_STREAM_SPOOF = "use_stream_spoof";
private static final String SYS_GAMES_SPOOF = "persist.sys.pixelprops.games";
private static final String SYS_PHOTOS_SPOOF = "persist.sys.pixelprops.gphotos";
private static final String SYS_STREAM_SPOOF = "persist.sys.pixelprops.streaming";
private SwitchPreference mGamesSpoof;
private SwitchPreference mPhotosSpoof;
private SwitchPreference mStreamSpoof;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefSet = getPreferenceScreen();
addPreferencesFromResource(R.xml.cherish_settings_misc);
@@ -61,11 +75,36 @@ public class MiscSettings extends SettingsPreferenceFragment implements
} catch (NameNotFoundException e) {
e.printStackTrace();
}
mGamesSpoof = (SwitchPreference) findPreference(KEY_GAMES_SPOOF);
mGamesSpoof.setChecked(SystemProperties.getBoolean(SYS_GAMES_SPOOF, false));
mGamesSpoof.setOnPreferenceChangeListener(this);
mPhotosSpoof = (SwitchPreference) findPreference(KEY_PHOTOS_SPOOF);
mPhotosSpoof.setChecked(SystemProperties.getBoolean(SYS_PHOTOS_SPOOF, true));
mPhotosSpoof.setOnPreferenceChangeListener(this);
mStreamSpoof = (SwitchPreference) findPreference(KEY_STREAM_SPOOF);
mStreamSpoof.setChecked(SystemProperties.getBoolean(SYS_STREAM_SPOOF, true));
mStreamSpoof.setOnPreferenceChangeListener(this);
}
@Override
public boolean onPreferenceChange(Preference preference, Object objValue) {
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (preference == mGamesSpoof) {
boolean value = (Boolean) newValue;
SystemProperties.set(SYS_GAMES_SPOOF, value ? "true" : "false");
return true;
} else if (preference == mPhotosSpoof) {
boolean value = (Boolean) newValue;
SystemProperties.set(SYS_PHOTOS_SPOOF, value ? "true" : "false");
return true;
} else if (preference == mStreamSpoof) {
boolean value = (Boolean) newValue;
SystemProperties.set(SYS_STREAM_SPOOF, value ? "true" : "false");
return true;
}
return false;
}