Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 26320ba6 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Bluetooth: Add edge-to-edge enforcement

Android 15 enables edge-to-edge by default. Apps should do the
adaptation, or some UIs may be obscured by system bars.

Bug: 378813445
Bug: 371498570
Test: m -j;
Test: Open received/sent file from opp notification history
Change-Id: I9bf51a81945dbd49eb69cbe46d0ac302a5c3fc0c
parent f276b177
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
@@ -88,8 +92,22 @@ public class BluetoothOppTransferHistory extends Activity
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);

        if (Flags.oppSetInsetsForEdgeToEdge()) {
            ViewCompat.setOnApplyWindowInsetsListener(
                    findViewById(android.R.id.content),
                    (v, windowInsets) -> {
                        Insets insets =
                                windowInsets.getInsets(
                                        WindowInsetsCompat.Type.systemBars()
                                                | WindowInsetsCompat.Type.ime()
                                                | WindowInsetsCompat.Type.displayCutout());
                        v.setPadding(insets.left, insets.top, insets.right, insets.bottom);
                        return WindowInsetsCompat.CONSUMED;
                    });
        } else {
            // TODO(b/309578419): Make this activity handle insets properly and then remove this.
            getTheme().applyStyle(R.style.OptOutEdgeToEdgeEnforcement, /* force */ false);
        }

        setContentView(R.layout.bluetooth_transfers_page);
        mListView = (ListView) findViewById(R.id.list);