AlphaSettings: Add an option to show PIF values
Change-Id: I62c3e3be64aaf84e98a7b13a9ed680a2af950a51 Signed-off-by: Jis G Jacob <studiokeys@blissroms.org> Signed-off-by: Dmitrii <bankersenator@gmail.com>
This commit is contained in:
parent
4ce1b7cebd
commit
f70a7cefe8
3 changed files with 56 additions and 0 deletions
|
|
@ -113,5 +113,10 @@
|
|||
<string name="spoofing_snap_summary">Spoof Snapchat as a Pixel XL to fix possible chat issues</string>
|
||||
<string name="pif_spoofing_title">Select PIF JSON File</string>
|
||||
<string name="pif_spoofing_summary">Pick PIF JSON file to be used for spoofing play integrity</string>
|
||||
<string name="toast_spoofing_success">Successfully downloaded pif.json. Spoofing as %1$s for play integrity.</string>
|
||||
<string name="toast_spoofing_failure">Failed to spoof properties.</string>
|
||||
<string name="show_pif_properties_title">Play Integrity Fix properties</string>
|
||||
<string name="show_pif_properties_summary">Show all currently set PIF properties</string>
|
||||
<string name="error_loading_properties">Error loading PIF properties</string>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -25,6 +25,11 @@
|
|||
android:title="@string/pif_spoofing_title"
|
||||
android:summary="@string/pif_spoofing_summary"/>
|
||||
|
||||
<Preference
|
||||
android:key="show_pif_properties"
|
||||
android:title="@string/show_pif_properties_title"
|
||||
android:summary="@string/show_pif_properties_summary" />
|
||||
|
||||
<!-- Pixel props -->
|
||||
<com.scoop.settings.preferences.SystemPropertySwitchPreference
|
||||
android:key="persist.sys.pphooks.enable"
|
||||
|
|
|
|||
|
|
@ -5,12 +5,14 @@
|
|||
package com.scoop.settings.fragments.misc;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemProperties;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
|
@ -27,6 +29,8 @@ import com.android.settings.SettingsPreferenceFragment;
|
|||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONException;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -63,6 +67,14 @@ public class Spoofing extends SettingsPreferenceFragment implements
|
|||
if (mPixelPropsSwitch != null && !enablePixelProps) {
|
||||
mSystemWideCategory.removePreference(mPixelPropsSwitch);
|
||||
}
|
||||
|
||||
Preference showPropertiesPref = findPreference("show_pif_properties");
|
||||
if (showPropertiesPref != null) {
|
||||
showPropertiesPref.setOnPreferenceClickListener(preference -> {
|
||||
showPropertiesDialog();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -100,6 +112,40 @@ public class Spoofing extends SettingsPreferenceFragment implements
|
|||
}
|
||||
}
|
||||
|
||||
private void showPropertiesDialog() {
|
||||
StringBuilder properties = new StringBuilder();
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
String[] keys = {
|
||||
"persist.sys.pihooks_ID",
|
||||
"persist.sys.pihooks_BRAND",
|
||||
"persist.sys.pihooks_DEVICE",
|
||||
"persist.sys.pihooks_FINGERPRINT",
|
||||
"persist.sys.pihooks_MANUFACTURER",
|
||||
"persist.sys.pihooks_MODEL",
|
||||
"persist.sys.pihooks_PRODUCT",
|
||||
"persist.sys.pihooks_SECURITY_PATCH",
|
||||
"persist.sys.pihooks_DEVICE_INITIAL_SDK_INT"
|
||||
};
|
||||
for (String key : keys) {
|
||||
String value = SystemProperties.get(key, null);
|
||||
if (value != null) {
|
||||
String buildKey = key.replace("persist.sys.pihooks_", "");
|
||||
jsonObject.put(buildKey, value);
|
||||
}
|
||||
}
|
||||
properties.append(jsonObject.toString(4));
|
||||
} catch (JSONException e) {
|
||||
Log.e(TAG, "Error creating JSON from properties", e);
|
||||
properties.append(getString(R.string.error_loading_properties));
|
||||
}
|
||||
new AlertDialog.Builder(getContext())
|
||||
.setTitle(R.string.show_pif_properties_title)
|
||||
.setMessage(properties.toString())
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue