Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve migrate structure for readability when pushing PIF to device #237

Closed
V0latyle opened this issue Aug 17, 2024 · 3 comments
Closed
Labels
enhancement New feature or request

Comments

@V0latyle
Copy link

V0latyle commented Aug 17, 2024

After processing a print with osm0sis migrate script, structure is:

{
  // Build Fields
    "MANUFACTURER": "",
    "MODEL": "",
    "FINGERPRINT": "",
    "BRAND": "",
    "PRODUCT": "",
    "DEVICE": "",
    "RELEASE": "",
    "ID": "",
    "INCREMENTAL": "",
    "TYPE": "",
    "TAGS": "",
    "SECURITY_PATCH": "",
    "DEVICE_INITIAL_SDK_INT": "",

  // System Properties
    "*.build.id": "",
    "*.security_patch": "",
    "*api_level": "",

  // Advanced Settings
    "spoofBuild": "1",
    "spoofProps": "1",
    "spoofProvider": "1",
    "spoofSignature": "0",
    "verboseLogs": "0"
}

But Pixel Flasher modifies it when pushed to the device:

{
    "MANUFACTURER": "",
    "MODEL": "",
    "FINGERPRINT": "",
    "BRAND": "",
    "PRODUCT": "",
    "DEVICE": "",
    "RELEASE": "",
    "ID": "",
    "INCREMENTAL": "",
    "TYPE": "",
    "TAGS": "",
    "SECURITY_PATCH": "",
    "DEVICE_INITIAL_SDK_INT": "",
    "*.build.id": "",
    "*.security_patch": "",
    "*api_level": "",
    "spoofBuild": "1",
    "spoofProps": "1",
    "spoofProvider": "1",
    "spoofSignature": "0",
    "verboseLogs": "0"
}

Suggestion: Either update the way PF handles prints so they are always in the osm0sis strucure, or preserve formatting and structure when pushing to device

@badabing2005
Copy link
Owner

The differences are empty lines and comments.
Comments in json are not supported, they are only supported in json5

Pifork happens to handle comments, but does not support full json5 specification, which goes beyond just comments.
Last I chhecked PIF by chiteroman, does not handle comments.

PixelFlasher to be most compatible, loads the file in json5 format, and then saves it in json format, this is why you see the comments and empty lines stripped, which is done by the json library.

Although it is possible to do some code changes to retain the format that PiFork migrate script produces, I can't use the json5 library to produce the output, because like I said, other features of json5 are not supported by the module (example: no quotes around key / value pairs, missing commas or extra commas ...) which means that I have to do some hacky coding and not use json / json 5 libraries and code parsing / producing the content.

I'm not sure if I want to take that path, as it makes the code less maintainable, and prone to bugs / regressions.

I'll keep this ticket open in case I can find a robust approach without making the code harder to maintain.

In an ideal world, PIF and PiFork would support json5 specs and use json5 libraries (which is easy in java but not sh), but I understand why that is not done, because in shell scripting it complicates the parsing of the payload without using tools like jq.

@badabing2005 badabing2005 added Feature Request enhancement New feature or request and removed Feature Request labels Aug 19, 2024
@V0latyle
Copy link
Author

V0latyle commented Aug 20, 2024 via email

badabing2005 added a commit that referenced this issue Aug 23, 2024
…to respond, making PixelFlasher appear frozen. Added an option in settings to bypass module update checks.

- **Module Updates**: Explicitly report which modules encounter update issues.
- **Device Recognition**: Added Pixel 9 series and Pixel Watch series to the recognized Google devices list for enhanced device details.
- **UI Enhancements**: Added widgets to control PiFork's advanced granular spoofing settings, making it easier to change print contents.
- **Model Detection**: When extracting PIF print from an image, if the model is not in the Google device list, it is now picked up from `vendor.prop`.
- **Bugfix #235**: Fixed utf-8 encoding issues in application names when exporting from App Manager.
- **Bugfix #236**: Enabled the `Push keybox.xml` button even when using TrickyStore forks.
- **Error Reporting**: Now reports an error when the device state is not one of the recognized states ['device', 'recovery', 'sideload', 'rescue']. This addresses issues with custom platform tools.
- **Permissions Check**: Detects misconfigured permissions of platform tools and guides the user to [Google documentation](http://developer.android.com/tools/device.html).
- **Help Menu Update**: Added a link to the TrickyStore GitHub repo under the Help menu (thanks @VisionR1).
- **PI Analysis**: Added a check in PI analysis reports for visible overlays without root.
- **Keybox Testing**: Added multi-select capability when testing keyboxes.
- **New Feature #237**: Added a `Push print, no validation` button, allowing users to push prints without validation, preserving comments in the `pif.json`.
- **Default Settings**: With spoof functionality removed from TrickyStore, PIF Manager now prioritizes default selection to PIF/PiFork module instead of TrickyStore.
- **Miscellaneous**: Various small improvements.
@badabing2005
Copy link
Owner

Added in 7.4.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants