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:
Joey Huab
2022-05-16 10:06:43 +07:00
committed by Hưng Phan
parent c9f88c53d1
commit 2642d0d517
3 changed files with 79 additions and 1 deletions

View File

@@ -843,4 +843,17 @@
<string name="qs_datausage_disabled">Disabled</string> <string name="qs_datausage_disabled">Disabled</string>
<string name="qs_datausage_daily">Daily usage</string> <string name="qs_datausage_daily">Daily usage</string>
<string name="qs_datausage_monthly">Monthly usage</string> <string name="qs_datausage_monthly">Monthly usage</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> </resources>

View File

@@ -48,4 +48,30 @@
android:targetClass="org.exthmui.game.ui.MainActivity" /> android:targetClass="org.exthmui.game.ui.MainActivity" />
</Preference> </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> </PreferenceScreen>

View File

@@ -7,6 +7,7 @@ import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.os.UserHandle; import android.os.UserHandle;
import android.os.SystemProperties;
import android.content.Context; import android.content.Context;
import android.content.ContentResolver; import android.content.ContentResolver;
import android.content.res.Resources; import android.content.res.Resources;
@@ -45,10 +46,23 @@ import java.util.List;
public class MiscSettings extends SettingsPreferenceFragment implements public class MiscSettings extends SettingsPreferenceFragment implements
OnPreferenceChangeListener { 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 @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
super.onCreate(icicle); super.onCreate(icicle);
ContentResolver resolver = getActivity().getContentResolver(); ContentResolver resolver = getActivity().getContentResolver();
PreferenceScreen prefSet = getPreferenceScreen();
addPreferencesFromResource(R.xml.cherish_settings_misc); addPreferencesFromResource(R.xml.cherish_settings_misc);
@@ -62,10 +76,35 @@ public class MiscSettings extends SettingsPreferenceFragment implements
e.printStackTrace(); 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 @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; return false;
} }