Cherish: Allow toggling netflix spoofing

Signed-off-by: minaripenguin <minaripenguin@users.noreply.github.com>
Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
minaripenguin
2022-11-18 16:18:25 +08:00
committed by Hưng Phan
parent c175bd76ea
commit b2fe86fb80
3 changed files with 26 additions and 1 deletions

View File

@@ -491,6 +491,10 @@
<!-- Unlock FPS for specific games --> <!-- Unlock FPS for specific games -->
<string name="use_games_spoof_title">Unlock higher FPS in games</string> <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> <string name="use_games_spoof_summary">Spoof your device as a different model for specific games to unlock higher FPS</string>
<!-- Netflix Spooft -->
<string name="netflix_spoof_title">Netflix spoof</string>
<string name="netflix_spoof_summary">Spoof your device as different model for Netflix</string>
<!-- Unlimited google photos storage --> <!-- Unlimited google photos storage -->
<string name="use_photos_spoof_title">Unlimited Photos storage</string> <string name="use_photos_spoof_title">Unlimited Photos storage</string>

View File

@@ -64,6 +64,12 @@
android:key="use_games_spoof" android:key="use_games_spoof"
android:title="@string/use_games_spoof_title" android:title="@string/use_games_spoof_title"
android:summary="@string/use_games_spoof_summary" /> android:summary="@string/use_games_spoof_summary" />
<!--Netflix -->
<SwitchPreference
android:key="use_netflix_spoof"
android:title="@string/netflix_spoof_title"
android:summary="@string/netflix_spoof_summary"/>
<!-- Unlimited Photos storage --> <!-- Unlimited Photos storage -->
<SwitchPreference <SwitchPreference

View File

@@ -38,6 +38,7 @@ import com.cherish.settings.preferences.SystemSettingMasterSwitchPreference;
import com.cherish.settings.preferences.SystemSettingListPreference; import com.cherish.settings.preferences.SystemSettingListPreference;
import com.cherish.settings.preferences.SecureSettingSwitchPreference; import com.cherish.settings.preferences.SecureSettingSwitchPreference;
import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.development.SystemPropPoker;
import com.android.settingslib.search.SearchIndexable; import com.android.settingslib.search.SearchIndexable;
import android.provider.SearchIndexableResource; import android.provider.SearchIndexableResource;
@@ -50,15 +51,18 @@ public class MiscSettings extends SettingsPreferenceFragment implements
OnPreferenceChangeListener { OnPreferenceChangeListener {
private static final String KEY_GAMES_SPOOF = "use_games_spoof"; 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_PHOTOS_SPOOF = "use_photos_spoof";
private static final String KEY_NETFLIX_SPOOF = "use_netflix_spoof";
private static final String SYS_GAMES_SPOOF = "persist.sys.pixelprops.games"; 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_PHOTOS_SPOOF = "persist.sys.pixelprops.gphotos";
private static final String SYS_NETFLIX_SPOOF = "persist.sys.spoof_netflix";
private static final String SMART_CHARGING = "smart_charging"; private static final String SMART_CHARGING = "smart_charging";
private SwitchPreference mGamesSpoof; private SwitchPreference mGamesSpoof;
private SwitchPreference mPhotosSpoof; private SwitchPreference mPhotosSpoof;
private Preference mSmartCharging; private Preference mSmartCharging;
private SwitchPreference mNetFlixSpoof;
@Override @Override
public void onCreate(Bundle icicle) { public void onCreate(Bundle icicle) {
@@ -77,6 +81,10 @@ public class MiscSettings extends SettingsPreferenceFragment implements
mPhotosSpoof = (SwitchPreference) findPreference(KEY_PHOTOS_SPOOF); mPhotosSpoof = (SwitchPreference) findPreference(KEY_PHOTOS_SPOOF);
mPhotosSpoof.setChecked(SystemProperties.getBoolean(SYS_PHOTOS_SPOOF, true)); mPhotosSpoof.setChecked(SystemProperties.getBoolean(SYS_PHOTOS_SPOOF, true));
mPhotosSpoof.setOnPreferenceChangeListener(this); mPhotosSpoof.setOnPreferenceChangeListener(this);
mNetFlixSpoof = (SwitchPreference) findPreference(KEY_NETFLIX_SPOOF);
mNetFlixSpoof.setChecked(SystemProperties.getBoolean(SYS_NETFLIX_SPOOF, false));
mNetFlixSpoof.setOnPreferenceChangeListener(this);
mSmartCharging = (Preference) prefScreen.findPreference(SMART_CHARGING); mSmartCharging = (Preference) prefScreen.findPreference(SMART_CHARGING);
boolean mSmartChargingSupported = res.getBoolean( boolean mSmartChargingSupported = res.getBoolean(
@@ -91,10 +99,17 @@ public class MiscSettings extends SettingsPreferenceFragment implements
if (preference == mGamesSpoof) { if (preference == mGamesSpoof) {
boolean value = (Boolean) newValue; boolean value = (Boolean) newValue;
SystemProperties.set(SYS_GAMES_SPOOF, value ? "true" : "false"); SystemProperties.set(SYS_GAMES_SPOOF, value ? "true" : "false");
SystemPropPoker.getInstance().poke();
return true; return true;
} else if (preference == mPhotosSpoof) { } else if (preference == mPhotosSpoof) {
boolean value = (Boolean) newValue; boolean value = (Boolean) newValue;
SystemProperties.set(SYS_PHOTOS_SPOOF, value ? "true" : "false"); SystemProperties.set(SYS_PHOTOS_SPOOF, value ? "true" : "false");
SystemPropPoker.getInstance().poke();
return true;
} else if (preference == mNetFlixSpoof) {
boolean value = (Boolean) newValue;
SystemProperties.set(SYS_NETFLIX_SPOOF, value ? "true" : "false");
SystemPropPoker.getInstance().poke();
return true; return true;
} }
return false; return false;