[Treble-Enabled Device Guides, News, & Discussion] dmitrypershin2015:
prehistory: on many recent assemblies, GSI does not work on many vendors, the backlight slider and previous fixes and the presence of overlay.device do not help.

I found a solution :laugh: to return everything as it was :

instruction :

We decompile framework / service.jar and in

\services\smali\com\android\server\lights\LightsService$LightImpl.smali

Replace the whole method

.method public setBrightness(II)V

to

.method public setBrightness(II)V
.registers 12

monitor-enter p0

const/4 v0, 0x2

if-ne p2, v0, :cond_2e

:try_start_4
const-string p2, "LightsService"

new-instance v0, Ljava/lang/StringBuilder;

invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

const-string/jumbo v1, "setBrightness with LOW_PERSISTENCE unexpected #"

invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

iget v1, p0, Lcom/android/server/lights/LightsService$LightImpl;->mId:I

invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

const-string v1, ": brightness=0x"

invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-static {p1}, Ljava/lang/Integer;->toHexString(I)Ljava/lang/String;

move-result-object p1

invoke-virtual {v0, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

move-result-object p1

invoke-static {p2, p1}, Landroid/util/Slog;->w(Ljava/lang/String;Ljava/lang/String;)I

monitor-exit p0

return-void

:catchall_2b
move-exception p1

goto/16 :goto_10a

:cond_2e
const/16 v0, 0xff

if-nez p2, :cond_48

invoke-direct {p0}, Lcom/android/server/lights/LightsService$LightImpl;->shouldBeInLowPersistenceMode()Z

move-result v1

if-nez v1, :cond_48

iget v1, p0, Lcom/android/server/lights/LightsService$LightImpl;->mSurfaceControlMaximumBrightness:I

if-ne v1, v0, :cond_48

iget-object p2, p0, Lcom/android/server/lights/LightsService$LightImpl;->mDisplayToken:Landroid/os/IBinder;

int-to-float p1, p1

iget v0, p0, Lcom/android/server/lights/LightsService$LightImpl;->mSurfaceControlMaximumBrightness:I

int-to-float v0, v0

div-float/2addr p1, v0

invoke-static {p2, p1}, Landroid/view/SurfaceControl;->setDisplayBrightness(Landroid/os/IBinder;F)Z

monitor-exit p0

return-void

:cond_48
iget v1, p0, Lcom/android/server/lights/LightsService$LightImpl;->mId:I

if-nez v1, :cond_f5

const-string/jumbo v1, "ro.vendor.build.fingerprint"

const-string v2, "hello"

invoke-static {v1, v2}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

move-result-object v1

const-string v2, ".*astarqlte.*"

invoke-virtual {v1, v2}, Ljava/lang/String;->matches(Ljava/lang/String;)Z

move-result v2

const-wide v3, 0x406fe00000000000L # 255.0

const/4 v5, 0x0

if-eqz v2, :cond_83

nop

const-string/jumbo v0, "persist.sys.samsung.full_brightness"

invoke-static {v0, v5}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z

move-result v0

if-eqz v0, :cond_78

int-to-double v0, p1

const-wide v5, 0x4076d00000000000L # 365.0

mul-double/2addr v0, v5

div-double/2addr v0, v3

double-to-int p1, v0

move v1, p1

goto :goto_79

:cond_78
move v1, p1

:goto_79
const/4 v2, 0x2

const/4 v3, 0x0

const/4 v4, 0x0

move-object v0, p0

move v5, p2

invoke-direct/range {v0 .. v5}, Lcom/android/server/lights/LightsService$LightImpl;->setLightLocked(IIIII)V

monitor-exit p0

return-void

:cond_83
const-string/jumbo v2, "persist.sys.phh.samsung_backlight"

const/4 v6, -0x1

invoke-static {v2, v6}, Landroid/os/SystemProperties;->getInt(Ljava/lang/String;I)I

move-result v2

const/4 v7, 0x1

if-eqz v2, :cond_ca

if-gtz v2, :cond_a8

const-string v8, ".*beyond.*lte.*"

invoke-virtual {v1, v8}, Ljava/lang/String;->matches(Ljava/lang/String;)Z

move-result v8

if-nez v8, :cond_a8

const-string v8, ".*(crown|star)[q2]*lte.*"

invoke-virtual {v1, v8}, Ljava/lang/String;->matches(Ljava/lang/String;)Z

move-result v8

if-nez v8, :cond_a8

const-string v8, ".*(SC-0[23]K|SCV3[89]).*"

invoke-virtual {v1, v8}, Ljava/lang/String;->matches(Ljava/lang/String;)Z

move-result v1

if-eqz v1, :cond_ca

:cond_a8
const/16 v0, 0x64

if-le v2, v7, :cond_ad

move v0, v2

:cond_ad
mul-int/2addr v0, p1

const-string/jumbo v1, "persist.sys.samsung.full_brightness"

invoke-static {v1, v5}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z

move-result v1

if-eqz v1, :cond_bf

int-to-double v0, p1

const-wide/high16 v5, 0x40e4000000000000L # 40960.0

mul-double/2addr v0, v5

div-double/2addr v0, v3

double-to-int v0, v0

move v2, v0

goto :goto_c0

:cond_bf
move v2, v0

:goto_c0
const/4 v3, 0x2

const/4 v4, 0x0

const/4 v5, 0x0

move-object v1, p0

move v6, p2

invoke-direct/range {v1 .. v6}, Lcom/android/server/lights/LightsService$LightImpl;->setLightLocked(IIIII)V

monitor-exit p0

return-void

:cond_ca
const-string/jumbo v1, "persist.extend.brightness"

invoke-static {v1, v5}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z

move-result v1

const-string/jumbo v2, "persist.display.max_brightness"

const/16 v3, 0x3ff

invoke-static {v2, v3}, Landroid/os/SystemProperties;->getInt(Ljava/lang/String;I)I

move-result v2

const-string/jumbo v3, "persist.sys.qcom-brightness"

invoke-static {v3, v6}, Landroid/os/SystemProperties;->getInt(Ljava/lang/String;I)I

move-result v3

if-eq v3, v6, :cond_e6

nop

move v2, v3

move v1, v7

:cond_e6
if-eqz v1, :cond_f5

mul-int/2addr p1, v2

div-int/lit16 v2, p1, 0xff

const/4 v3, 0x0

const/4 v4, 0x0

const/4 v5, 0x0

move-object v1, p0

move v6, p2

invoke-direct/range {v1 .. v6}, Lcom/android/server/lights/LightsService$LightImpl;->setLightLocked(IIIII)V

monitor-exit p0

return-void

:cond_f5
and-int/2addr p1, v0

const/high16 v0, -0x1000000

shl-int/lit8 v1, p1, 0x10

or-int/2addr v0, v1

shl-int/lit8 v1, p1, 0x8

or-int/2addr v0, v1

or-int v2, v0, p1

const/4 v3, 0x0

const/4 v4, 0x0

const/4 v5, 0x0

move-object v1, p0

move v6, p2

invoke-direct/range {v1 .. v6}, Lcom/android/server/lights/LightsService$LightImpl;->setLightLocked(IIIII)V

monitor-exit p0

return-void

:goto_10a
monitor-exit p0
:try_end_10b
.catchall {:try_start_4 .. :try_end_10b} :catchall_2b

throw p1
.end method

compile service.jar ,

backup in twrp system , and replace service.jar.

if you do not have overlay on your device, then you have to do this:

adb console :

adb shell su -c setprop persist.sys.qcom-brightness $(cat /sys/class/leds/lcd-backlight/max_brightness)

or from the phone in the terminal emulator :

su
setprop persist.sys.qcom-brightness $(cat /sys/class/leds/lcd-backlight/max_brightness)

reboot .

it works on many rom, but I can not say that at all)