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

Commit bcf9b21b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "AutoOn: Update API constant for intent extra" into main

parents 2c633792 e2598636
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -109,8 +109,8 @@ package android.bluetooth {
    field public static final int ACTIVE_DEVICE_PHONE_CALL = 1; // 0x1
    field public static final String AUDIO_MODE_DUPLEX = "audio_mode_duplex";
    field public static final String AUDIO_MODE_OUTPUT_ONLY = "audio_mode_output_only";
    field @FlaggedApi("com.android.bluetooth.flags.auto_on_feature") public static final int AUTO_ON_STATE_OFF = 1; // 0x1
    field @FlaggedApi("com.android.bluetooth.flags.auto_on_feature") public static final int AUTO_ON_STATE_ON = 2; // 0x2
    field @FlaggedApi("com.android.bluetooth.flags.auto_on_feature") public static final int AUTO_ON_STATE_DISABLED = 1; // 0x1
    field @FlaggedApi("com.android.bluetooth.flags.auto_on_feature") public static final int AUTO_ON_STATE_ENABLED = 2; // 0x2
    field public static final int BT_SNOOP_LOG_MODE_DISABLED = 0; // 0x0
    field public static final int BT_SNOOP_LOG_MODE_FILTERED = 1; // 0x1
    field public static final int BT_SNOOP_LOG_MODE_FULL = 2; // 0x2
+3 −3
Original line number Diff line number Diff line
@@ -821,7 +821,7 @@ public final class BluetoothAdapter {
    /**
     * Used as an int extra field in {@link #ACTION_AUTO_ON_STATE_CHANGED} intents.
     *
     * <p>Possible values are: {@link #AUTO_ON_STATE_OFF}, {@link #AUTO_ON_STATE_ON}
     * <p>Possible values are: {@link #AUTO_ON_STATE_DISABLED}, {@link #AUTO_ON_STATE_ENABLED}
     *
     * @hide
     */
@@ -836,7 +836,7 @@ public final class BluetoothAdapter {
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_AUTO_ON_FEATURE)
    public static final int AUTO_ON_STATE_OFF = 1;
    public static final int AUTO_ON_STATE_DISABLED = 1;

    /**
     * Indicates the AutoOn feature is ON.
@@ -845,7 +845,7 @@ public final class BluetoothAdapter {
     */
    @SystemApi
    @FlaggedApi(Flags.FLAG_AUTO_ON_FEATURE)
    public static final int AUTO_ON_STATE_ON = 2;
    public static final int AUTO_ON_STATE_ENABLED = 2;

    /**
     * Audio mode representing output only.
+6 −3
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
package com.android.server.bluetooth

import android.bluetooth.BluetoothAdapter.ACTION_AUTO_ON_STATE_CHANGED
import android.bluetooth.BluetoothAdapter.AUTO_ON_STATE_OFF
import android.bluetooth.BluetoothAdapter.AUTO_ON_STATE_ON
import android.bluetooth.BluetoothAdapter.AUTO_ON_STATE_DISABLED
import android.bluetooth.BluetoothAdapter.AUTO_ON_STATE_ENABLED
import android.bluetooth.BluetoothAdapter.EXTRA_AUTO_ON_STATE
import android.bluetooth.BluetoothAdapter.STATE_ON
import android.content.BroadcastReceiver
@@ -283,7 +283,10 @@ private fun setFeatureEnabledForUserUnchecked(context: Context, status: Boolean)
        context.sendBroadcast(
            Intent(ACTION_AUTO_ON_STATE_CHANGED)
                .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY)
                .putExtra(EXTRA_AUTO_ON_STATE, if (status) AUTO_ON_STATE_ON else AUTO_ON_STATE_OFF),
                .putExtra(
                    EXTRA_AUTO_ON_STATE,
                    if (status) AUTO_ON_STATE_ENABLED else AUTO_ON_STATE_DISABLED
                ),
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
        )
    }
+2 −2
Original line number Diff line number Diff line
@@ -271,7 +271,7 @@ class AutoOnFeatureTest {
            hasFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY)
            extras()
                .integer(BluetoothAdapter.EXTRA_AUTO_ON_STATE)
                .isEqualTo(BluetoothAdapter.AUTO_ON_STATE_OFF)
                .isEqualTo(BluetoothAdapter.AUTO_ON_STATE_DISABLED)
        }
    }

@@ -285,7 +285,7 @@ class AutoOnFeatureTest {
            hasFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY)
            extras()
                .integer(BluetoothAdapter.EXTRA_AUTO_ON_STATE)
                .isEqualTo(BluetoothAdapter.AUTO_ON_STATE_ON)
                .isEqualTo(BluetoothAdapter.AUTO_ON_STATE_ENABLED)
        }
    }