|
21 | 21 | import android.view.View; |
22 | 22 | import android.view.ViewGroup; |
23 | 23 | import android.view.ViewTreeObserver; |
| 24 | +import android.view.WindowManager; |
24 | 25 | import android.widget.LinearLayout; |
25 | 26 |
|
26 | 27 | import androidx.activity.EdgeToEdge; |
@@ -331,18 +332,36 @@ public boolean onPreDraw() { |
331 | 332 | } else { |
332 | 333 | binding.content.imageview.setImageBitmap(createQrCode(data)); |
333 | 334 | } |
| 335 | + setMaxBrightness(); |
334 | 336 | return true; |
335 | 337 | } |
336 | 338 | }); |
337 | 339 | } |
338 | 340 |
|
| 341 | + private void setMaxBrightness() { |
| 342 | + setBrightness(WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_FULL); |
| 343 | + } |
| 344 | + |
| 345 | + private void resetToOriginalBrightness() { |
| 346 | + setBrightness(WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE); |
| 347 | + } |
| 348 | + |
| 349 | + private void setBrightness(float value) { |
| 350 | + WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); |
| 351 | + layoutParams.screenBrightness = value; |
| 352 | + getWindow().setAttributes(layoutParams); |
| 353 | + } |
| 354 | + |
339 | 355 | private void runAuditor() { |
340 | 356 | if (auditorChallenge == null) { |
341 | 357 | auditorChallenge = AttestationProtocol.getChallengeMessage(this); |
342 | 358 | } |
343 | 359 | binding.content.textview.setText(R.string.qr_code_scan_hint_auditor); |
344 | 360 | chooseBestLayout(auditorChallenge); |
345 | | - binding.content.imageview.setOnClickListener(view -> startQrScanner()); |
| 361 | + binding.content.imageview.setOnClickListener(view -> { |
| 362 | + startQrScanner(); |
| 363 | + resetToOriginalBrightness(); |
| 364 | + }); |
346 | 365 | } |
347 | 366 |
|
348 | 367 | private void handleAttestation(final byte[] serialized) { |
|
0 commit comments