Turning the screen on does not work on Android 14 anymore

This commit is contained in:
M66B
2023-04-19 16:56:31 +02:00
parent 0449011951
commit 7e7cf9a3e9
3 changed files with 16 additions and 0 deletions

View File

@@ -5219,6 +5219,10 @@ class Core {
boolean redacted = ((biometrics || !TextUtils.isEmpty(pin)) && !biometric_notify);
if (redacted)
notify_summary = true;
if (notify_screen_on &&
!(Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU ||
Helper.hasPermission(context, "android.permission.TURN_SCREEN_ON")))
notify_screen_on = false;
Log.i("Notify messages=" + messages.size() +
" biometrics=" + biometrics + "/" + biometric_notify +

View File

@@ -126,6 +126,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
private Group grpChannel;
private Group grpProperties;
private Group grpScreenOn;
private Group grpBackground;
private Group grpTiles;
@@ -214,6 +215,7 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
grpChannel = view.findViewById(R.id.grpChannel);
grpProperties = view.findViewById(R.id.grpProperties);
grpScreenOn = view.findViewById(R.id.grpScreenOn);
grpBackground = view.findViewById(R.id.grpBackground);
grpTiles = view.findViewById(R.id.grpTiles);
@@ -499,6 +501,10 @@ public class FragmentOptionsNotifications extends FragmentBase implements Shared
}
});
grpScreenOn.setVisibility(
Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU ||
hasPermission("android.permission.TURN_SCREEN_ON")
? View.VISIBLE : View.GONE);
swNotifyScreenOn.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {

View File

@@ -441,6 +441,12 @@
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swLight,btnSound" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpScreenOn"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="swNotifyScreenOn,tvNotifyScreenOnHint" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>