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

GSI ROM Support #61

Open
rabaimorp opened this issue Mar 7, 2024 · 12 comments
Open

GSI ROM Support #61

rabaimorp opened this issue Mar 7, 2024 · 12 comments
Labels
enhancement New feature or request

Comments

@rabaimorp
Copy link

rabaimorp commented Mar 7, 2024

The problem:

On my samsung galaxy a53 on stock rom this app was working without problem with 5 dim levels. Than I decided to flash a GSI (specifically Lineage OS 21). This obviously changed my device's properties, causing the app to not recognise my device. If I change back the device identifiers using a root shell, or editing the build.prop this isnt the case, but that causes a bunch of other issues on my device, since I'm not using stock rom, but still having the same values.

My idea for a possible solution:

If it was possible to manually define the device within the app. (or loading a stock build.prop file from internal storage)

Or an even simpler solution: an option in the app that would automatically identify the device, even on gsi roms by looking at /vendor/build.prop (since almost all people on custom gsi roms have root anyway).

@cyb3rko cyb3rko added the enhancement New feature or request label Mar 13, 2024
@cyb3rko
Copy link
Owner

cyb3rko commented Mar 13, 2024

Thanks for the input.
Sounds interesting, but to develop something like your proposed solution I would need to have a rooted device.

Maybe I will root one of my older Samsung phones at some point

@rabaimorp
Copy link
Author

Thanks for the input. Sounds interesting, but to develop something like your proposed solution I would need to have a rooted device.

Maybe I will root one of my older Samsung phones at some point

Not necessarly. But not just for my rootless soulution idea. For testing I can recommend emulating android using Waydroid (that you can root by super easily), since testing the flashlight might not be neceassry if we only talk about custom device detection

@rabaimorp rabaimorp reopened this Apr 22, 2024
@rabaimorp
Copy link
Author

Thanks for the input. Sounds interesting, but to develop something like your proposed solution I would need to have a rooted device.

Maybe I will root one of my older Samsung phones at some point

Not necessarly. But not just for my rootless soulution idea. For testing I can recommend emulating android using Waydroid (that you can root by super easily), since testing the flashlight might not be neceassry if we only talk about custom device detection

@cyb3rko
Copy link
Owner

cyb3rko commented Apr 22, 2024

I've read something about Waydroid a few days ago, I will try that out when I find time for this :)

@cyb3rko
Copy link
Owner

cyb3rko commented Nov 7, 2024

@rabaimorp I am playing around with a different solution as proposed in #74, as the reporter seems to already have a working POC on his physical device.

Now I am curious if that solution would also work for your case, so please try out the POC at https://github.com/EmilEmilchen/simpleFlashDimmer.

@rabaimorp
Copy link
Author

I don't have "/sys/class/leds/torch-light0/brightness". "logcat | grep CitUtils" also returns nothing

@rabaimorp
Copy link
Author

This method would also not only require root but an rw system partition, which is not the default since Android 10

@rabaimorp
Copy link
Author

rabaimorp commented Nov 7, 2024

For my device I can do:
Level 1: echo 1001 > /sys/class/camera/flash/rear_flash
Level 2: echo 1002 > /sys/class/camera/flash/rear_flash
Level 3: echo 1004 > /sys/class/camera/flash/rear_flash
Level 4: echo 1006 > /sys/class/camera/flash/rear_flash
Level 5: echo 1009 > /sys/class/camera/flash/rear_flash

Off (disable light): echo 0 > /sys/class/camera/flash/rear_flash

This solution is geat, its just device specific. But an option to set a custom profile would solve the issue. Than you could just find out the trigger, and your levels, and just make a profile for your device in the app.

Verified profiles could also be integrated into the app, so not everyone would have to create one manually. Since this method requires root anyways the app could look in /vendor/build.prop to find out the harware regardless of the custom rom installed. And than it could auto detect if there is a profile preset is available for that device already and auto apply it if so.

@cyb3rko
Copy link
Owner

cyb3rko commented Nov 7, 2024

I don't have "/sys/class/leds/torch-light0/brightness". "logcat | grep CitUtils" also returns nothing

There may be be something at /sys/class/leds/, for me the folders have a different name than "light0".

This method would also not only require root but an rw system partition, which is not the default since Android 10

I'm not really into rooted OSs, but in my case I can write to that file on rooted Android 15 without any problem.

For my device I can do: Level 1: echo 1001 > /sys/class/camera/flash/rear_flash Level 2: echo 1002 > /sys/class/camera/flash/rear_flash Level 3: echo 1004 > /sys/class/camera/flash/rear_flash Level 4: echo 1006 > /sys/class/camera/flash/rear_flash Level 5: echo 1009 > /sys/class/camera/flash/rear_flash

Off (disable light): echo 0 > /sys/class/camera/flash/rear_flash

This solution is geat, its just device specific. But an option to set a custom profile would solve the issue. Than you could just find out the trigger, and your levels, and just make a profile for your device in the app.

Verified profiles could also be integrated into the app, so not everyone would have to create one manually. Since this method requires root anyways the app could look in /vendor/build.prop to find out the harware regardless of the custom rom installed. And than it could auto detect if there is a profile preset is available for that device already and auto apply it if so.

The idea with the profiles sounds promising, I can then only hope that people are collaborating and contributing their specific device setups.

@rabaimorp
Copy link
Author

Well, I alreaded shared the profile for my device (Samsung Galaxy a53)

@cyb3rko
Copy link
Owner

cyb3rko commented Nov 17, 2024

For my device I can do:
Level 1: echo 1001 > /sys/class/camera/flash/rear_flash
Level 2: echo 1002 > /sys/class/camera/flash/rear_flash
Level 3: echo 1004 > /sys/class/camera/flash/rear_flash
Level 4: echo 1006 > /sys/class/camera/flash/rear_flash
Level 5: echo 1009 > /sys/class/camera/flash/rear_flash

Off (disable light): echo 0 > /sys/class/camera/flash/rear_flash

How did you find these values (1001, 1002, 1004, ...)?
That would be interesting for supporting other phones.

@rabaimorp
Copy link
Author

How did you find these values (1001, 1002, 1004, ...)? That would be interesting for supporting other phones.

By using and adb, or local root shell (termux for example).
First. Ran "logcat | grep flash" and turned my flashlight on and off. Got the file path. And since I'm on a gsi, I used phh treble to set my flashlight to every level and used "cat /sys/class/camera/flash/rear_flash" to get every value. (Setting the flashlight with phh is really inconvenient that why I want a better solution). If other people don't have access to set flashlight values at all, they could quickly dsu back to their stock rom (or any other rom that does) and find out there. All recent gsi's have this in phh, and most device specific roms also allow some way to change brightness if the hardware is capable.

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