diff --git a/res/values/cherish_strings.xml b/res/values/cherish_strings.xml index e1f8c84..99dd458 100644 --- a/res/values/cherish_strings.xml +++ b/res/values/cherish_strings.xml @@ -486,4 +486,12 @@ Users Logout Emergency + + + Unlock higher FPS in games + Spoof your device as a different model for specific games to unlock higher FPS + + + Unlimited Photos storage + Spoof your device as Pixel XL for Google Photos app only to provide unlimited storage for backup diff --git a/res/xml/cherish_settings_misc.xml b/res/xml/cherish_settings_misc.xml index ee63653..000f524 100644 --- a/res/xml/cherish_settings_misc.xml +++ b/res/xml/cherish_settings_misc.xml @@ -37,4 +37,17 @@ android:summary="@string/click_partial_screenshot_summary" android:defaultValue="false" /> + + + + + + diff --git a/src/com/cherish/settings/fragments/MiscSettings.java b/src/com/cherish/settings/fragments/MiscSettings.java index f811e7f..35b3b22 100644 --- a/src/com/cherish/settings/fragments/MiscSettings.java +++ b/src/com/cherish/settings/fragments/MiscSettings.java @@ -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,6 +45,14 @@ 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 SYS_GAMES_SPOOF = "persist.sys.pixelprops.games"; + private static final String SYS_PHOTOS_SPOOF = "persist.sys.pixelprops.gphotos"; + + private SwitchPreference mGamesSpoof; + private SwitchPreference mPhotosSpoof; @Override public void onCreate(Bundle icicle) { @@ -61,11 +70,28 @@ 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); } - @Override - public boolean onPreferenceChange(Preference preference, Object objValue) { + @Override + 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; + } return false; }