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

Commit be234330 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12235414 from ac18f132 to 24Q4-release

Change-Id: I15513ad6c34eef43cc3549a8fe28f7e1e3e2e88a
parents 50e9c10a ac18f132
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -52,8 +52,8 @@ interface IBluetooth

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    oneway void offToBleOn(boolean quietMode, in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)")
    oneway void disable(in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    oneway void onToBleOn(in AttributionSource attributionSource);

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.LOCAL_MAC_ADDRESS})")
    String getAddress(in AttributionSource attributionSource);
@@ -227,8 +227,8 @@ interface IBluetooth

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void startBrEdr(in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void stopBle(in AttributionSource attributionSource);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED)")
    oneway void bleOnToOff(in AttributionSource attributionSource);

    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED,android.Manifest.permission.MODIFY_PHONE_STATE})")
    int connectAllEnabledProfiles(in BluetoothDevice device, in AttributionSource attributionSource);
+11 −12
Original line number Diff line number Diff line
@@ -2317,16 +2317,16 @@ public class AdapterService extends Service {
        }

        @Override
        public void disable(AttributionSource source) {
        public void onToBleOn(AttributionSource source) {
            AdapterService service = getService();
            if (service == null
                    || !callerIsSystemOrActiveOrManagedUser(service, TAG, "disable")
                    || !Utils.checkConnectPermissionForDataDelivery(
                            service, source, "AdapterService disable")) {
                    || !callerIsSystemOrActiveOrManagedUser(service, TAG, "onToBleOn")) {
                return;
            }

            service.disable();
            service.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null);

            service.onToBleOn();
        }

        @Override
@@ -3814,17 +3814,16 @@ public class AdapterService extends Service {
        }

        @Override
        public void stopBle(AttributionSource source) {
        public void bleOnToOff(AttributionSource source) {
            AdapterService service = getService();
            if (service == null
                    || !callerIsSystemOrActiveOrManagedUser(service, TAG, "stopBle")
                    || !Utils.checkConnectPermissionForDataDelivery(service, source, TAG)) {
                    || !callerIsSystemOrActiveOrManagedUser(service, TAG, "bleOnToOff")) {
                return;
            }

            service.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null);

            service.stopBle();
            service.bleOnToOff();
        }

        @Override
@@ -4628,8 +4627,8 @@ public class AdapterService extends Service {
        mAdapterStateMachine.sendMessage(AdapterState.BLE_TURN_ON);
    }

    void disable() {
        Log.d(TAG, "disable() called with mRunningProfiles.size() = " + mRunningProfiles.size());
    void onToBleOn() {
        Log.d(TAG, "onToBleOn() called with mRunningProfiles.size() = " + mRunningProfiles.size());
        mAdapterStateMachine.sendMessage(AdapterState.USER_TURN_OFF);
    }

@@ -5767,7 +5766,7 @@ public class AdapterService extends Service {
    }

    @VisibleForTesting
    void stopBle() {
    void bleOnToOff() {
        mAdapterStateMachine.sendMessage(AdapterState.BLE_TURN_OFF);
    }

+15 −0
Original line number Diff line number Diff line
@@ -546,6 +546,21 @@ public class MetricsLogger {
                BluetoothStatsLog.BLUETOOTH_HASHED_DEVICE_NAME_REPORTED, metricId, sha256);
    }

    public void logBluetoothEvent(BluetoothDevice device, int eventType, int state, int uid) {

        if (mAdapterService.getMetricId(device) == 0 || !mInitialized) {
            return;
        }

        BluetoothStatsLog.write(
                BluetoothStatsLog.BLUETOOTH_CROSS_LAYER_EVENT_REPORTED,
                eventType,
                state,
                uid,
                mAdapterService.getMetricId(device),
                getRemoteDeviceInfoProto(device));
    }

    protected static String getSha256String(String name) {
        if (name.isEmpty()) {
            return "";
+7 −7
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ public class AdapterServiceTest {
            IBluetoothCallback callback,
            boolean onlyGatt,
            List<ProfileService> services) {
        adapter.disable();
        adapter.onToBleOn();
        TestUtils.syncHandler(looper, AdapterState.USER_TURN_OFF);
        verifyStateChange(callback, STATE_ON, STATE_TURNING_OFF);

@@ -540,7 +540,7 @@ public class AdapterServiceTest {

        onToBleOn(looper, adapter, ctx, callback, onlyGatt, services);

        adapter.stopBle();
        adapter.bleOnToOff();
        TestUtils.syncHandler(looper, AdapterState.BLE_TURN_OFF);
        verifyStateChange(callback, STATE_BLE_ON, STATE_BLE_TURNING_OFF);

@@ -661,7 +661,7 @@ public class AdapterServiceTest {
                false,
                listOfMockServices());

        mAdapterService.stopBle();
        mAdapterService.bleOnToOff();
        syncHandler(AdapterState.BLE_TURN_OFF);
        verifyStateChange(STATE_BLE_ON, STATE_BLE_TURNING_OFF, CONTEXT_SWITCH_MS);
        assertThat(mAdapterService.getBluetoothGatt()).isNull();
@@ -723,7 +723,7 @@ public class AdapterServiceTest {
        assertThat(mAdapterService.getBluetoothScan()).isNotNull();
        assertThat(mAdapterService.getBluetoothGatt()).isNull();

        mAdapterService.stopBle();
        mAdapterService.bleOnToOff();
        syncHandler(AdapterState.BLE_TURN_OFF);
        verifyStateChange(callback, STATE_BLE_ON, STATE_BLE_TURNING_OFF);

@@ -789,7 +789,7 @@ public class AdapterServiceTest {

        assertThat(mAdapterService.getState()).isEqualTo(STATE_ON);

        mAdapterService.disable();
        mAdapterService.onToBleOn();
        TestUtils.syncHandler(mLooper, AdapterState.USER_TURN_OFF);
        verifyStateChange(callback, STATE_ON, STATE_TURNING_OFF);

@@ -858,7 +858,7 @@ public class AdapterServiceTest {
    public void testProfileStopTimeout() {
        doEnable(false);

        mAdapterService.disable();
        mAdapterService.onToBleOn();
        syncHandler(AdapterState.USER_TURN_OFF);
        verifyStateChange(STATE_ON, STATE_TURNING_OFF);
        assertThat(mAdapterService.mSetProfileServiceStateCounter).isEqualTo(4);
@@ -910,7 +910,7 @@ public class AdapterServiceTest {
                false,
                listOfMockServices());

        // Do not call stopBle().  The Adapter should turn itself off.
        // Do not call bleOnToOff().  The Adapter should turn itself off.
        syncHandler(AdapterState.BLE_TURN_OFF);
        verifyStateChange(STATE_BLE_ON, STATE_BLE_TURNING_OFF, CONTEXT_SWITCH_MS);

+18 −28
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ mod parser;

use crate::engine::RuleEngine;
use crate::groups::{collisions, connections, controllers, informational};
use crate::parser::{LinuxSnoopOpcodes, LogParser, LogType, Packet};
use crate::parser::{LogParser, Packet, SnoopOpcodes};

fn main() {
    let matches = Command::new("hcidoc")
@@ -63,7 +63,7 @@ fn main() {
        report_signals = true;
    }

    let mut parser = match LogParser::new(filename) {
    let parser = match LogParser::new(filename) {
        Ok(p) => p,
        Err(e) => {
            println!(
@@ -75,14 +75,6 @@ fn main() {
        }
    };

    let log_type = match parser.read_log_type() {
        Ok(v) => v,
        Err(e) => {
            println!("Parsing {} failed: {}", filename, e);
            return;
        }
    };

    // Create engine with default rule groups.
    let mut engine = RuleEngine::new();
    engine.add_rule_group("Collisions".into(), collisions::get_collisions_group());
@@ -93,14 +85,13 @@ fn main() {
    // Decide where to write output.
    let mut writer: Box<dyn Write> = Box::new(std::io::stdout());

    if let LogType::LinuxSnoop(_header) = log_type {
        for (pos, v) in parser.get_snoop_iterator().expect("Not a linux snoop file").enumerate() {
            match Packet::try_from((pos, &v)) {
    for (pos, v) in parser.get_snoop_iterator().enumerate() {
        match Packet::try_from((pos, &*v)) {
            Ok(p) => engine.process(p),
            Err(e) => {
                if !ignore_unknown_opcode {
                    match v.opcode() {
                            LinuxSnoopOpcodes::Command | LinuxSnoopOpcodes::Event => {
                        SnoopOpcodes::Command | SnoopOpcodes::Event => {
                            eprintln!("#{}: {}", pos, e);
                        }
                        _ => (),
@@ -118,4 +109,3 @@ fn main() {
        engine.report_signals(&mut writer);
    }
}
}
Loading