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

Commit eca12d24 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Add mic sensor privacy QS tile

- factor out generic code from CameraToggleTile and
- reuse this generic code for MicrophoneToggleTile

Bug: 162549680
Test: Toggled tiles and looked at `dumpsys sensor_privacy`
Change-Id: Ib45c54c686e271facb78f0f14861045cb97641bf
parent bde12fd4
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2021 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="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
    <path
        android:pathData="m17,12c-2.75,0 -5,2.25 -5,5 0,2.75 2.25,5 5,5 2.75,0 5,-2.25 5,-5 0,-2.75 -2.1667,-5 -5,-5zM14.5,17.8333h5v-1.6666h-5z"
        android:fillColor="#30302a"
        android:fillType="evenOdd"/>
    <path
        android:pathData="m12,12c0,1.66 -1.34,3 -3,3C7.34,15 6,13.66 6,12L6,6C6,4.34 7.34,3 9,3c1.66,0 3,1.34 3,3zM9,5C8.45,5 8,5.45 8,6v6c0,0.55 0.45,1 1,1 0.55,0 1,-0.45 1,-1L10,6C10,5.45 9.55,5 9,5ZM11.0147,16.577C10.3983,16.849 9.7167,17 9,17 6.24,17 4,14.76 4,12L2,12c0,3.53 2.61,6.43 6,6.92L8,22h2v-3.08c0.4212,-0.0609 0.8303,-0.1589 1.2238,-0.2908C11.078,18.1111 11,17.5647 11,17c0,-0.1422 0.0049,-0.2832 0.0147,-0.423z"
        android:fillColor="#30302a"
        android:fillType="evenOdd"/>
</vector>
+1 −1
Original line number Diff line number Diff line
@@ -107,7 +107,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,reduce_brightness,cameratoggle
        wifi,cell,battery,dnd,flashlight,rotation,bt,airplane,location,hotspot,inversion,saver,dark,work,cast,night,screenrecord,reverse,reduce_brightness,cameratoggle,mictoggle
    </string>

    <!-- The tiles to display in QuickSettings -->
+2 −0
Original line number Diff line number Diff line
@@ -823,6 +823,8 @@
    <string name="quick_settings_location_off_label">Location Off</string>
    <!-- QuickSettings: Camera [CHAR LIMIT=NONE] -->
    <string name="quick_settings_camera_label">Block Camera</string>
    <!-- QuickSettings: Microphone [CHAR LIMIT=NONE] -->
    <string name="quick_settings_mic_label">Mute Microphone</string>
    <!-- QuickSettings: Media device [CHAR LIMIT=NONE] -->
    <string name="quick_settings_media_device_label">Media device</string>
    <!-- QuickSettings: RSSI [CHAR LIMIT=NONE] -->
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@

        <com.android.systemui.tuner.StatusBarSwitch
            android:key="cameratoggle"
            android:title="Camera Toggle" />
            android:title="@string/quick_settings_camera_label" />

        <!-- nfc -->
        <!-- tty -->
+7 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import com.android.systemui.qs.tiles.FlashlightTile;
import com.android.systemui.qs.tiles.HotspotTile;
import com.android.systemui.qs.tiles.InternetTile;
import com.android.systemui.qs.tiles.LocationTile;
import com.android.systemui.qs.tiles.MicrophoneToggleTile;
import com.android.systemui.qs.tiles.NfcTile;
import com.android.systemui.qs.tiles.NightDisplayTile;
import com.android.systemui.qs.tiles.ReduceBrightColorsTile;
@@ -85,6 +86,7 @@ public class QSFactoryImpl implements QSFactory {
    private final Provider<ScreenRecordTile> mScreenRecordTileProvider;
    private final Provider<ReduceBrightColorsTile> mReduceBrightColorsTileProvider;
    private final Provider<CameraToggleTile> mCameraToggleTileProvider;
    private final Provider<MicrophoneToggleTile> mMicrophoneToggleTileProvider;

    private final Lazy<QSHost> mQsHostLazy;
    private final Provider<CustomTile.Builder> mCustomTileBuilderProvider;
@@ -118,7 +120,8 @@ public class QSFactoryImpl implements QSFactory {
            Provider<UiModeNightTile> uiModeNightTileProvider,
            Provider<ScreenRecordTile> screenRecordTileProvider,
            Provider<ReduceBrightColorsTile> reduceBrightColorsTileProvider,
            Provider<CameraToggleTile> cameraToggleTileProvider) {
            Provider<CameraToggleTile> cameraToggleTileProvider,
            Provider<MicrophoneToggleTile> microphoneToggleTileProvider) {
        mQsHostLazy = qsHostLazy;
        mCustomTileBuilderProvider = customTileBuilderProvider;

@@ -147,6 +150,7 @@ public class QSFactoryImpl implements QSFactory {
        mScreenRecordTileProvider = screenRecordTileProvider;
        mReduceBrightColorsTileProvider = reduceBrightColorsTileProvider;
        mCameraToggleTileProvider = cameraToggleTileProvider;
        mMicrophoneToggleTileProvider = microphoneToggleTileProvider;
    }

    public QSTile createTile(String tileSpec) {
@@ -204,6 +208,8 @@ public class QSFactoryImpl implements QSFactory {
                return mReduceBrightColorsTileProvider.get();
            case "cameratoggle":
                return mCameraToggleTileProvider.get();
            case "mictoggle":
                return mMicrophoneToggleTileProvider.get();
        }

        // Custom tiles
Loading