Cherish: [SQUASH] User toggle for unlimited photos storage and GamesProp [2/2][2/2]
Co-authored-by: spezi77 <spezi7713@gmx.net> Signed-off-by: Hưng Phan <phandinhhungvp2001@gmail.com>
This commit is contained in:
@@ -486,4 +486,12 @@
|
||||
<string name="powermenu_users">Users</string>
|
||||
<string name="powermenu_logout">Logout</string>
|
||||
<string name="powermenu_emergency">Emergency</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>
|
||||
|
||||
<!-- Unlimited google photos storage -->
|
||||
<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>
|
||||
</resources>
|
||||
|
||||
@@ -37,4 +37,17 @@
|
||||
android:summary="@string/click_partial_screenshot_summary"
|
||||
android:defaultValue="false" />
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
<!-- 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" />
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -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) {
|
||||
@@ -62,10 +71,27 @@ public class MiscSettings extends SettingsPreferenceFragment implements
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user