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

Commit d8245660 authored by Roman Birg's avatar Roman Birg Committed by Bruno Martins
Browse files

SystemUI: Add Profiles tile



Author: Roman Birg <roman@cyngn.com>
Date:   Thu Jan 22 11:21:56 2015 -0800

    System Profiles in QS Tiles

    Change-Id: I2a438af301212241533b969bf2c6c8390ef09cbc

Author: Joey Rizzoli <joey@lineageos.org>
Date:   Fri Oct 13 20:18:03 2017 +0200

    SystemUI: Profiles tile should require authentication

    A profile with the option to disable secure lockscreen could be
    used to bypass the lockscreen security.
    Require the user to unlock their device when tapping on the profile
    quick tile.

    BUGBASH-1095

    Change-Id: I9d63fcd9b1e3f47c9ca3374806d5ef05fe9ff32b
    Signed-off-by: default avatarJoey Rizzoli <joey@lineageos.org>

Author: Michael W <baddaemon87@gmail.com>
Date:   Sat Aug 4 18:00:34 2018 +0200

    Tiles: SystemProfiles: Adapt behaviour

    * Opening the detail view should enable profiles
    * Disabling the switch should also close the details
    * The tile's title should just be "System profiles"
      when disabled, we also don't say "Wifi off" on wifi tile
    * Set dualTarget to true so the tile indicates expandability

    Change-Id: I4eb463bc84ad78fcabb8acef1829c990ab04f19b

Author: Bruno Martins <bgcngm@gmail.com>
Date:   Mon Sep 10 11:21:58 2018 +0100
Edit:   Port and revamp to match P style

Author: LuK1337 <priv.luk@gmail.com>
Date:   Tue Jul 23 22:26:19 2019 +0200

    ProfilesTile: Enable authentication for handleClick()

    * This disallows enabling profile on secure lockscreen which
      could allow enabling last profile that could potentially
      have a disabled lockscreen.
    * Fixes : https://gitlab.com/LineageOS/issues/android/issues/965

    Change-Id: Ic9a845f1b6e4a408134c4a9ad31810d88375a99b

Author: Bruno Martins <bgcngm@gmail.com>
Date:   Thu Oct 8 00:13:34 2020 +0100
Edit:   Update to Android 11 APIs

Change-Id: I2dd93cd93b5a99d3d5fda9c3d937009f792bdc2e
parent 8b02dc6c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
    <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
    <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
    <uses-permission android:name="lineageos.permission.HARDWARE_ABSTRACTION_ACCESS" />
    <uses-permission android:name="lineageos.permission.WRITE_SETTINGS"/>

    <!-- SystemUI Tuner -->
    <application>
+32 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (c) 2015 The CyanogenMod Project
    Copyright (C) 2017-2018 The LineageOS 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="48dp"
    android:height="48dp"
    android:viewportWidth="24"
    android:viewportHeight="24">

    <path
        android:fillColor="#FFFFFFFF"
        android:pathData="M19,5v14H5V5H19
M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3L19,3z
M17,8 c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1C16.6,9,17,8.6,17,8z
M13,8c0-0.6-0.4-1-1-1c-0.6,0-1,0.4-1,1s0.4,1,1,1 C12.6,9,13,8.6,13,8z
M9,8c0-0.6-0.4-1-1-1S7,7.4,7,8s0.4,1,1,1S9,8.6,9,8z
M17,13h-6v-2H9v2H7v2h2v2h2v-2h6V13z" />
</vector>
+146 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright (C) 2022 The LineageOS 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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:layout_width="@dimen/large_dialog_width"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <androidx.core.widget.NestedScrollView
        android:id="@+id/scroll_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout
            android:id="@+id/scroll_layout"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">

                <LinearLayout
                    style="@style/InternetDialog.Network"
                    android:layout_height="@dimen/internet_dialog_wifi_network_height"
                    android:clickable="false"
                    android:focusable="false"
                    android:gravity="center">

                    <FrameLayout
                        android:layout_width="wrap_content"
                        android:layout_height="match_parent"
                        android:layout_weight="1"
                        android:clickable="false"
                        android:orientation="vertical">

                        <TextView
                            android:id="@+id/toggle_title"
                            android:layout_width="wrap_content"
                            android:layout_height="match_parent"
                            android:gravity="start|center_vertical"
                            android:text="@string/quick_settings_profiles_label"
                            android:textAppearance="@style/TextAppearance.InternetDialog" />
                    </FrameLayout>

                    <FrameLayout
                        android:layout_width="@dimen/settingslib_switch_track_width"
                        android:layout_height="48dp"
                        android:layout_marginBottom="10dp"
                        android:layout_marginTop="10dp">

                        <Switch
                            android:id="@+id/toggle"
                            android:layout_width="@dimen/settingslib_switch_track_width"
                            android:layout_height="match_parent"
                            android:layout_gravity="center"
                            android:switchMinWidth="@dimen/settingslib_switch_track_width"
                            android:theme="@style/MainSwitch.Settingslib"
                            android:thumb="@drawable/settingslib_thumb_selector"
                            android:track="@drawable/settingslib_track_selector" />
                    </FrameLayout>

                </LinearLayout>

                <LinearLayout
                    android:layout_width="@dimen/internet_dialog_progress_bar_width"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center_horizontal"
                    android:layout_marginBottom="@dimen/internet_dialog_network_layout_margin"
                    android:orientation="vertical">

                    <View
                        android:id="@+id/divider"
                        android:layout_width="match_parent"
                        android:layout_height="4dp"
                        android:layout_gravity="center_vertical|center_horizontal"
                        android:background="?androidprv:attr/colorSurfaceVariant" />
                </LinearLayout>

                <androidx.recyclerview.widget.RecyclerView
                    android:id="@+id/list_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/dialog_side_padding"
                    android:layout_marginStart="@dimen/dialog_side_padding"
                    android:nestedScrollingEnabled="false"
                    android:overScrollMode="never"
                    android:scrollbars="vertical" />

                <LinearLayout
                    android:id="@+id/button_layout"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginBottom="@dimen/dialog_bottom_padding"
                    android:layout_marginEnd="@dimen/dialog_side_padding"
                    android:layout_marginStart="@dimen/dialog_side_padding"
                    android:layout_marginTop="8dp"
                    android:clickable="false"
                    android:focusable="false"
                    android:orientation="horizontal">

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="start|center_vertical"
                        android:layout_weight="1"
                        android:orientation="vertical" />

                    <LinearLayout
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="end|center_vertical"
                        android:layout_marginStart="16dp">

                        <Button
                            android:id="@+id/done_button"
                            style="@style/Widget.Dialog.Button"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:clickable="true"
                            android:ellipsize="end"
                            android:focusable="true"
                            android:maxLines="1"
                            android:text="@string/inline_done_button" />
                    </LinearLayout>
                </LinearLayout>
            </LinearLayout>
        </LinearLayout>
    </androidx.core.widget.NestedScrollView>
</LinearLayout>
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,11 @@
    <string name="accessibility_quick_settings_sync_off">Sync off.</string>
    <string name="accessibility_quick_settings_sync_on">Sync on.</string>

    <!-- System Profiles QS tile -->
    <string name="quick_settings_profiles_label">System profiles</string>
    <string name="accessibility_quick_settings_profiles_off">Profiles off.</string>
    <string name="accessibility_quick_settings_profiles">Profile: <xliff:g id="profile" example="Default">%s</xliff:g>.</string>

    <!-- USB tethering QS tile -->
    <string name="quick_settings_usb_tether_label">USB tethering</string>
</resources>
+1 −1
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@

    <!-- Tiles native to System UI. Order should match "quick_settings_tiles_default" -->
    <string name="quick_settings_tiles_stock" translatable="false">
        internet,wifi,cell,bt,flashlight,dnd,alarm,airplane,nfc,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,ambient_display,aod,caffeine,heads_up,reading_mode,sync,powershare,usb_tether
        internet,wifi,cell,bt,flashlight,dnd,alarm,airplane,nfc,controls,wallet,rotation,battery,cast,screenrecord,mictoggle,cameratoggle,location,hotspot,inversion,saver,dark,work,night,reverse,reduce_brightness,qr_code_scanner,onehanded,color_correction,ambient_display,aod,caffeine,heads_up,reading_mode,sync,powershare,profiles,usb_tether
    </string>

    <!-- The tiles to display in QuickSettings -->
Loading