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

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

Snap for 8730838 from 8b301a94 to tm-release

Change-Id: I2f3053c7e63f6b6c0672d6ab28989106979883dc
parents e1a15205 8b301a94
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -212,9 +212,11 @@
    <string name="outbound_noti_title">Bluetooth share: Sent files</string>
    <string name="inbound_noti_title">Bluetooth share: Received files</string>
    <string name="noti_caption_unsuccessful"> {count, plural,
        =1    {# unsuccessful.}
        other {# unsuccessful.}
    }</string>
    <string name="noti_caption_success"> {count, plural,
        =1    {# successful, %1$s}
        other {# successful, %1$s}
    }</string>

+9 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -53,6 +52,8 @@ import android.os.Binder;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.sysprop.BluetoothProperties;
import android.util.Log;

@@ -251,9 +252,15 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
            Log.v(TAG, "start()");
        }

        //Check for user restrictions before enabling component
        UserManager mUserManager = getSystemService(UserManager.class);
        if (!mUserManager.hasUserRestrictionForUser(
                UserManager.DISALLOW_BLUETOOTH_SHARING, UserHandle.CURRENT)) {
            setComponentAvailable(LAUNCHER_ACTIVITY, true);
        }

        setComponentAvailable(OPP_PROVIDER, true);
        setComponentAvailable(OPP_FILE_PROVIDER, true);
        setComponentAvailable(LAUNCHER_ACTIVITY, true);
        setComponentAvailable(BT_ENABLE_ACTIVITY, true);
        setComponentAvailable(BT_ERROR_ACTIVITY, true);
        setComponentAvailable(BT_ENABLING_ACTIVITY, true);
+17 −6
Original line number Diff line number Diff line
@@ -115,6 +115,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
    private static final int ACTIVE_LOG_MAX_SIZE = 20;
    private static final int CRASH_LOG_MAX_SIZE = 100;

    private static final int DEFAULT_REBIND_COUNT = 3;
    private static final int TIMEOUT_BIND_MS = 3000; //Maximum msec to wait for a bind

    /**
@@ -1461,7 +1462,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
                }

                psc = new ProfileServiceConnections(intent);
                if (!psc.bindService()) {
                if (!psc.bindService(DEFAULT_REBIND_COUNT)) {
                    return false;
                }

@@ -1590,7 +1591,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
            mIntent = intent;
        }

        private boolean bindService() {
        private boolean bindService(int rebindCount) {
            int state = BluetoothAdapter.STATE_OFF;
            try {
                mBluetoothLock.readLock().lock();
@@ -1613,6 +1614,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
                    && doBind(mIntent, this, 0, USER_HANDLE_CURRENT_OR_SELF)) {
                Message msg = mHandler.obtainMessage(MESSAGE_BIND_PROFILE_SERVICE);
                msg.obj = this;
                msg.arg1 = rebindCount;
                mHandler.sendMessageDelayed(msg, TIMEOUT_BIND_MS);
                return true;
            }
@@ -1632,6 +1634,7 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
                if (!mHandler.hasMessages(MESSAGE_BIND_PROFILE_SERVICE, this)) {
                    Message msg = mHandler.obtainMessage(MESSAGE_BIND_PROFILE_SERVICE);
                    msg.obj = this;
                    msg.arg1 = DEFAULT_REBIND_COUNT;
                    mHandler.sendMessage(msg);
                }
            }
@@ -2185,7 +2188,10 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
                    if (psc == null) {
                        break;
                    }
                    psc.bindService();
                    if (msg.arg1 > 0) {
                        mContext.unbindService(psc);
                        psc.bindService(msg.arg1 - 1);
                    }
                    break;
                }
                case MESSAGE_BLUETOOTH_SERVICE_CONNECTED: {
@@ -2885,9 +2891,14 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
        final ComponentName oppLauncherComponent = new ComponentName(
                mContext.getPackageManager().getPackagesForUid(Process.BLUETOOTH_UID)[0],
                "com.android.bluetooth.opp.BluetoothOppLauncherActivity");
        final int newState =
                bluetoothSharingDisallowed ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
                        : PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
        int newState;
        if (bluetoothSharingDisallowed) {
            newState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
        } else if (BluetoothProperties.isProfileOppEnabled().orElse(false)) {
            newState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
        } else {
            newState = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
        }
        try {
            mContext.createContextAsUser(userHandle, 0)
                .getPackageManager()
+20 −9
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ typedef struct {
  uint8_t fail_reason;
  Uuid::UUID128Bit eir_uuids[32];
  uint8_t num_eir_uuids;
  std::set<Uuid::UUID128Bit> uuids;
} btif_dm_pairing_cb_t;

// TODO(jpawlowski): unify ?
@@ -1370,6 +1371,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      bt_property_t prop;
      uint32_t i = 0;
      bt_status_t ret;
      std::vector<uint8_t> property_value;

      RawAddress& bd_addr = p_data->disc_res.bd_addr;

@@ -1391,12 +1393,18 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      prop.len = 0;
      if ((p_data->disc_res.result == BTA_SUCCESS) &&
          (p_data->disc_res.num_uuids > 0)) {
        prop.val = p_data->disc_res.p_uuid_list;
        prop.len = p_data->disc_res.num_uuids * Uuid::kNumBytes128;
        LOG_INFO("New UUIDs:");
        for (i = 0; i < p_data->disc_res.num_uuids; i++) {
          std::string temp = ((p_data->disc_res.p_uuid_list + i))->ToString();
          LOG_INFO("index:%d uuid:%s", i, temp.c_str());
          auto uuid = p_data->disc_res.p_uuid_list + i;
          LOG_INFO("index:%d uuid:%s", i, uuid->ToString().c_str());
          auto valAsBe = uuid->To128BitBE();
          pairing_cb.uuids.insert(valAsBe);
        }
        for (auto uuid : pairing_cb.uuids) {
          property_value.insert(property_value.end(), uuid.begin(), uuid.end());
        }
        prop.val = (void*)property_value.data();
        prop.len = Uuid::kNumBytes128 * pairing_cb.uuids.size();
      }

      /* onUuidChanged requires getBondedDevices to be populated.
@@ -1463,15 +1471,18 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      std::vector<uint8_t> property_value;
      int num_uuids = 0;

      LOG_INFO("New BLE UUIDs:");
      for (Uuid uuid : *p_data->disc_ble_res.services) {
        LOG_VERBOSE("service %s", uuid.ToString().c_str());
        LOG_INFO("index:%d uuid:%s", num_uuids, uuid.ToString().c_str());
        if (btif_is_interesting_le_service(uuid)) {
          num_uuids++;
          auto valAsBe = uuid.To128BitBE();
          property_value.insert(property_value.end(), valAsBe.begin(),
                                valAsBe.end());
          pairing_cb.uuids.insert(valAsBe);
        }
      }
      for (auto uuid : pairing_cb.uuids) {
        property_value.insert(property_value.end(), uuid.begin(), uuid.end());
      }

      if (num_uuids == 0) {
        LOG_INFO("No well known BLE services discovered");
@@ -1481,7 +1492,7 @@ static void btif_dm_search_services_evt(tBTA_DM_SEARCH_EVT event,
      RawAddress& bd_addr = p_data->disc_ble_res.bd_addr;
      prop[0].type = BT_PROPERTY_UUIDS;
      prop[0].val = (void*)property_value.data();
      prop[0].len = Uuid::kNumBytes128 * num_uuids;
      prop[0].len = Uuid::kNumBytes128 * pairing_cb.uuids.size();

      /* Also write this to the NVRAM */
      bt_status_t ret =
@@ -1576,7 +1587,7 @@ void BTIF_dm_enable() {
    }
  }
  /* clear control blocks */
  memset(&pairing_cb, 0, sizeof(btif_dm_pairing_cb_t));
  pairing_cb = {};
  pairing_cb.bond_type = tBTM_SEC_DEV_REC::BOND_TYPE_PERSISTENT;
  if (enable_address_consolidate) {
    LOG_INFO("enable address consolidate");
+1 −1
Original line number Diff line number Diff line
@@ -435,7 +435,7 @@ size_t SnoopLogger::GetMaxPacketsPerBuffer() {
  // and 512 KB memory for userdebug/eng builds
  auto is_debuggable = os::GetSystemProperty(kIsDebuggableProperty);
  size_t btsnooz_max_memory_usage_bytes =
      ((is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") ? 512 : 256) * 1024;
      ((is_debuggable.has_value() && common::StringTrim(is_debuggable.value()) == "1") ? 1024 : 256) * 1024;
  // Calculate max number of packets based on max memory usage and max packet size
  return btsnooz_max_memory_usage_bytes / kDefaultBtSnoozMaxBytesPerPacket;
}
Loading