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

Commit 61e9297f authored by LuK1337's avatar LuK1337 Committed by Nolen Johnson
Browse files

Squash of SystemUI: Show bluetooth battery level

Author: LuK1337 <priv.luk@gmail.com>
Date:   2018-10-31 16:31:19 +0100
    SystemUI: Show bluetooth battery level when available

    * Somewhat inspired by change committed by Gavin Ni <gisngy@gmail.com>
      back in cm-13.0 days (see commit 88e7a6c7). Since then completely
      rewritten using BluetoothDevice API introduced in Oreo, with new
      drawables meant to be used with 0-9 battery level range.

    Change-Id: I6179bfd41e033591534e8cf3c6adc98ce715a13d

Author: Luca Stefani <luca.stefani.ge1@gmail.com>
Date:   2021-08-23 10:11:54 +0200
    fixup! SystemUI: Show bluetooth battery level when available

    The current update method is triggered in 2 cases:
      the SystemUI bluetooth controller changes device state
      the battery level changed intent is sent

    Sadly the current SysUI controller doesn't handle battery level
    changes, and is instead triggered in a few other cases ( ex audio
    state changed ).
    And since we use the data from SysUI controller for battery level
    from changes in the global bt controller we may have 2 different
    set of devices to work on. This could ( and does ) trigger
    race conditions.

    Instead add support battery level state changes within the SystemUI
    controller to work on the same data set.

    Change-Id: Ib57096fc2ebe151ac3860277a4db2319f230b514

Change-Id: I34344907711b7b9fc4c1d15d4516bd53bf30ebb2
parent 40725b2f
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="20dp"
        android:height="17dp"
        android:viewportWidth="21.0"
        android:viewportHeight="18.0">
    <group
        android:scaleX="0.75"
        android:scaleY="0.75">
        <path
            android:fillColor="@android:color/white"
            android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
    </group>
    <group
        android:translateY="0.5"
        android:translateX="0.5" >
        <path
            android:pathData="M15.77,1.064V15.94h3V1.064Z"
            android:fillColor="#4DFFFFFF"/>
        <path
            android:pathData="M15.77,15.3V15.94h3V15.3Z"
            android:fillColor="#FFFFFF"/>
    </group>
</vector>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="20dp"
        android:height="17dp"
        android:viewportWidth="21.0"
        android:viewportHeight="18.0">
    <group
        android:scaleX="0.75"
        android:scaleY="0.75">
        <path
            android:fillColor="@android:color/white"
            android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
    </group>
    <group
        android:translateY="0.5"
        android:translateX="0.5" >
        <path
            android:pathData="M15.77,1.064V15.94h3V1.064Z"
            android:fillColor="#4DFFFFFF"/>
        <path
            android:pathData="M15.77,13.6V15.94h3V13.6Z"
            android:fillColor="#FFFFFF"/>
    </group>
</vector>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="20dp"
        android:height="17dp"
        android:viewportWidth="21.0"
        android:viewportHeight="18.0">
    <group
        android:scaleX="0.75"
        android:scaleY="0.75">
        <path
            android:fillColor="@android:color/white"
            android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
    </group>
    <group
        android:translateY="0.5"
        android:translateX="0.5" >
        <path
            android:pathData="M15.77,1.064V15.94h3V1.064Z"
            android:fillColor="#4DFFFFFF"/>
        <path
            android:pathData="M15.77,11.9V15.94h3V11.9Z"
            android:fillColor="#FFFFFF"/>
    </group>
</vector>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="20dp"
        android:height="17dp"
        android:viewportWidth="21.0"
        android:viewportHeight="18.0">
    <group
        android:scaleX="0.75"
        android:scaleY="0.75">
        <path
            android:fillColor="@android:color/white"
            android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
    </group>
    <group
        android:translateY="0.5"
        android:translateX="0.5" >
        <path
            android:pathData="M15.77,1.064V15.94h3V1.064Z"
            android:fillColor="#4DFFFFFF"/>
        <path
            android:pathData="M15.77,10.2V15.94h3V10.2Z"
            android:fillColor="#FFFFFF"/>
    </group>
</vector>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
**
** Copyright 2017, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="20dp"
        android:height="17dp"
        android:viewportWidth="21.0"
        android:viewportHeight="18.0">
    <group
        android:scaleX="0.75"
        android:scaleY="0.75">
        <path
            android:fillColor="@android:color/white"
            android:pathData="M17.71,7.71L12,2h-1v7.59L6.41,5 5,6.41 10.59,12 5,17.59 6.41,19 11,14.41L11,22h1l5.71,-5.71 -4.3,-4.29 4.3,-4.29zM13,5.83l1.88,1.88L13,9.59L13,5.83zM14.88,16.29L13,18.17v-3.76l1.88,1.88z"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M5,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
        <path
            android:fillColor="@android:color/white"
            android:pathData="M19,12m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0"/>
    </group>
    <group
        android:translateY="0.5"
        android:translateX="0.5" >
        <path
            android:pathData="M15.77,1.064V15.94h3V1.064Z"
            android:fillColor="#4DFFFFFF"/>
        <path
            android:pathData="M15.77,8.5V15.94h3V8.5Z"
            android:fillColor="#FFFFFF"/>
    </group>
</vector>
Loading