Skip to content

Commit

Permalink
[SQUASH] daisy: parts: Some changes for XiaomiParts
Browse files Browse the repository at this point in the history
daisy: Convert XiaomiDoze into XiaomiParts

 * This is the preparation for turning the package into
   an unified device-settings app.

Change-Id: I425ad525edcc63c2dcccd1e2fb8459f442744970
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Add AOD support to Ambient Display

 * This makes the always on display mode feature visible for those
   devices that explicitly set it as available via AOSP overlay.
   Should only be enabled on devices where the display has been tuned
   to be power efficient in DOZE and/or DOZE_SUSPEND states.

Change-Id: If543936f9421dd7a6c0be594f7cb76afb227e34b
Signed-off-by: LinkBoi00 <[email protected]>

daisy: doze: Make AOD preference not persistent

Change-Id: I9d80e94de02d35c85765302a01b53020824dd0ff
Signed-off-by: LinkBoi00 <[email protected]>

daisy: doze: Move DozeUtils.checkDozeService in an handler

* There's no need to manually write to the gestures prefs
  as long we are sure the handler is run after we return true
  in the onPreferenceChangeListner

Change-Id: I090c0c6c91267aff69c45365b95b5f5e26d07b07
Signed-off-by: LinkBoi00 <[email protected]>

daisy: doze: Check if AOD is enabled after boot

* The service should not start if AOD has been turned on by the user.

Change-Id: I79307adbcda57e663287714ef15830da4f285131
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: doze: Fix AoD default pref

* Fixes non-working pulse notifications from sensors until user toggles
  the main switch and also sets the proper initial status of the
  AoD preference for the devices that have the feature available.

Change-Id: I8e554decca3734b165fdc722d904d90713666db9
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Fix dark theme issues

This brings SwitchBar widget inline with 10 and fixes the
theme issues when the dark mode is enabled.

Change-Id: I6909b77bc649eb9eb760bf01b46f66570363e9d9
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Introduce Dirac preferences

Add a frontend for Dirac sound optimization settings.
Inject into sound preferences through settings IA.

Change-Id: I37f6e64fa440c43dbe238cc65af5f9b0bbd60d83
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Add DiracSound backend

Special thanks to vasishath for his base work on mi3

Change-Id: Id81e60a18dc34c991b82a5a2685c9041222a6ea7
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Add summary for dirac

Change-Id: If69633e2e65dfeb95991fd5063949c828f1c7683
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Refactor dirac strings

* From MIUI

Change-Id: I8b6826d98dc7fd75be2423532cf4167d75ff0ed5
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Dirac fixes

* Pause/play music stream to get effects applied
* Rename setMusic to setEnabled
* Increase "BOOT_COMPLETED" broadcast priority

Change-Id: Ib0717b35ca04511543078df9b9b4003a848aef3b
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Refactor Dirac setup

- Convert DiracUtils to be an instantiable class.

- Stop tracking initialization state with a boolean and just
  fallback to checking the instance's nullity.

Change-Id: I0b58c9093878a510b3c1cbca9e03e9faa64d053c
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: dirac: Only call setEnabled on boot completed

Change-Id: I0b13cc9d7d6b75453ecb28ca3236c70821638c6f
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: dirac: Prevent failures when toggling

Change-Id: I31ff6faff3a2e3b3639aeb0e48ddf230b2155999
Signed-off-by: LinkBoi00 <[email protected]>

daisy: Declare STATE_DOZE support

 * This is required for Ambient Display to work properly.

Change-Id: Ibad86be4e1c43a221fc2224d0a8f8ca2c938a6c7
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts: Apply Q changes on AmbientDisplayConfiguration

Change-Id: I5336ef2dd86a1ee5067760f9e60672b9d7b9f794
Signed-off-by: Erfan Abdi <[email protected]>
Signed-off-by: LinkBoi00 <[email protected]>

daisy: parts:  Add vector icons to parts

* from https://materialdesignicons.com/ with small changes

Change-Id: Ieeeba1c91bc984e7aaa1d397b59fe7e7ed189f4b
Signed-off-by: LinkBoi00 <[email protected]>

Co-authored-by: Luca Stefani <[email protected]>
Co-authored-by: Joey <[email protected]>
Co-authored-by: TheScarastic <[email protected]>
Co-authored-by: Harsh Shandilya <[email protected]>
Co-authored-by: Erfan Abdi <[email protected]>
Co-authored-by: arian <[email protected]>
  • Loading branch information
7 people authored and proxer05 committed Sep 25, 2021
1 parent fbaa76d commit 6b5d0cf
Show file tree
Hide file tree
Showing 37 changed files with 907 additions and 113 deletions.
8 changes: 4 additions & 4 deletions device.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ PRODUCT_PACKAGES += \
AntHalService \
com.dsi.ant.antradio_library

# Device-specific Settings
PRODUCT_PACKAGES += \
XiaomiParts

# Audio
PRODUCT_PACKAGES += \
[email protected] \
Expand Down Expand Up @@ -225,10 +229,6 @@ PRODUCT_PACKAGES += \
# Dex
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY := true

# Doze mode
PRODUCT_PACKAGES += \
XiaomiDoze

# DRM
PRODUCT_PACKAGES += \
[email protected] \
Expand Down
3 changes: 0 additions & 3 deletions doze/proguard.flags

This file was deleted.

20 changes: 0 additions & 20 deletions doze/res/color/switchbar_switch_thumb_tint.xml

This file was deleted.

21 changes: 0 additions & 21 deletions doze/res/color/switchbar_switch_track_tint.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- These resources are around just to allow their values to be customized
for different hardware and product builds. -->
<resources>
<!-- Doze: does this device support STATE_DOZE and STATE_DOZE_SUSPEND? -->
<!-- Doze: does this device support STATE_DOZE? -->
<bool name="doze_display_state_supported">true</bool>

<!-- Smart replies in notifications: Whether we disable the feature unless the app targets P -->
Expand Down
13 changes: 11 additions & 2 deletions doze/Android.mk → parts/Android.mk
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
LOCAL_PATH:= $(call my-dir)
#
# Copyright (C) 2017-2020 The LineageOS Project
#
# SPDX-License-Identifier: Apache-2.0
#

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := optional

LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := XiaomiDoze
LOCAL_PACKAGE_NAME := XiaomiParts
LOCAL_CERTIFICATE := platform
LOCAL_PRIVATE_PLATFORM_APIS := true
LOCAL_PRIVILEGED_MODULE := true
Expand All @@ -22,4 +29,6 @@ LOCAL_RESOURCE_DIR := \

LOCAL_PROGUARD_FLAG_FILES := proguard.flags

include frameworks/base/packages/SettingsLib/common.mk

include $(BUILD_PACKAGE)
23 changes: 18 additions & 5 deletions doze/AndroidManifest.xml → parts/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 The CyanogenMod Project
2017 The LineageOS Project
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.
Expand All @@ -16,7 +16,7 @@
limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.settings.doze"
package="org.lineageos.settings"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
Expand All @@ -35,18 +35,31 @@
android:persistent="true">

<receiver android:name=".BootCompletedReceiver">
<intent-filter>
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>

<service android:name=".DozeService"
<activity
android:name=".dirac.DiracActivity"
android:label="@string/dirac_title"
android:theme="@style/Theme.Main">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.sound" />
<meta-data android:name="com.android.settings.summary"
android:resource="@string/dirac_summary" />
</activity>

<service android:name=".doze.DozeService"
android:permission="XiaomiDozeService">
</service>

<activity
android:name=".DozeSettingsActivity"
android:name=".doze.DozeSettingsActivity"
android:label="@string/ambient_display_title"
android:theme="@style/Theme.Main">
<intent-filter>
Expand Down
7 changes: 7 additions & 0 deletions parts/proguard.flags
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
-keep class org.lineageos.settings.dirac.* {
*;
}

-keep class org.lineageos.settings.doze.* {
*;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2019 The LineageOS Project
<!-- Copyright (C) 2019-2020 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.
Expand All @@ -15,6 +15,6 @@
-->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="#ff80868B" android:state_activated="false" />
<item android:color="@color/switchbar_background_color" android:state_activated="false" />
<item android:color="?android:attr/colorAccent" android:state_activated="true" />
</selector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_display.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/phone_text.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M17,19V5H7V19H17M17,1A2,2 0 0,1 19,3V21A2,2 0 0,1 17,23H7C5.89,23 5,22.1 5,21V3C5,1.89 5.89,1 7,1H17M9,7H15V9H9V7M9,11H13V13H9V11Z" />
</vector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_hand.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/hand.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
<path android:fillColor="#000" android:pathData="M6.58,19H14.58V22H6.58V19M19.74,11.6C19.55,11.4 19.29,11.28 19,11.28L18.78,11.31L15.58,13V11.83L16.09,2.9C16.12,2.35 15.7,1.87 15.15,1.84C14.6,1.81 14.12,2.23 14.09,2.78L13.82,7.47H13.58L12.54,7.58V2A1,1 0 0,0 11.54,1C11,1 10.54,1.45 10.54,2V8.41L9.72,8.78L9.03,3.32C8.96,2.77 8.46,2.38 7.91,2.45C7.36,2.5 6.97,3 7.04,3.57L7.81,9.63L7.43,9.8C7.3,9.85 7.18,9.93 7.07,10L5.97,6.11C5.81,5.54 5.25,5.2 4.71,5.34C4.18,5.5 3.88,6.08 4.04,6.65L6.61,15.77C6.61,15.8 6.63,15.84 6.64,15.87L6.67,16H6.68C6.9,16.57 7.47,17 8.08,17H14.58C14.97,17 15.32,16.84 15.58,16.57L20.5,12.37L19.74,11.6Z" />
</vector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_headphone.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/headphone-settings.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M12,1A9,9 0 0,1 21,10V17A3,3 0 0,1 18,20H15V12H19V10A7,7 0 0,0 12,3A7,7 0 0,0 5,10V12H9V20H6A3,3 0 0,1 3,17V10A9,9 0 0,1 12,1M15,24V22H17V24H15M11,24V22H13V24H11M7,24V22H9V24H7Z" />
</vector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_pickup.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/arrow_decision_outline.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
<path android:fillColor="#000" android:pathData="M9.64,13.4C8.63,12.5 7.34,12.03 6,12V15L2,11L6,7V10C7.67,10 9.3,10.57 10.63,11.59C10.22,12.15 9.89,12.76 9.64,13.4M18,15V12C17.5,12 13.5,12.16 13.05,16.2C14.61,16.75 15.43,18.47 14.88,20.03C14.33,21.59 12.61,22.41 11.05,21.86C9.5,21.3 8.67,19.59 9.22,18.03C9.5,17.17 10.2,16.5 11.05,16.2C11.34,12.61 14.4,9.88 18,10V7L22,11L18,15M13,19A1,1 0 0,0 12,18A1,1 0 0,0 11,19A1,1 0 0,0 12,20A1,1 0 0,0 13,19M11,11.12C11.58,10.46 12.25,9.89 13,9.43V5H16L12,1L8,5H11V11.12Z" />
</vector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_pocket.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/pocket.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal" >
<path android:fillColor="#000" android:pathData="M21.9,4.26C21.64,3.55 20.96,3.07 20.2,3.07H20.19L18.46,3.07H3.81C3.07,3.07 2.39,3.54 2.12,4.24C2.04,4.45 2,4.66 2,4.88V10.92L2.07,12.12C2.36,14.85 3.78,17.23 5.97,18.9C6,18.93 6.05,18.96 6.09,19H6.11C7.29,19.86 8.6,20.44 10,20.73C10.68,20.86 11.35,20.93 12,20.93C12.63,20.93 13.25,20.87 13.85,20.76C13.93,20.75 14,20.73 14.07,20.72C14.09,20.71 14.11,20.7 14.14,20.69C15.5,20.4 16.76,19.83 17.89,19H17.91C17.95,18.96 18,18.93 18.03,18.9C20.22,17.23 21.64,14.85 21.93,12.12L22,10.92V4.88C22,4.68 21.97,4.47 21.9,4.26M17.67,10.55L12.96,15.06C12.7,15.32 12.35,15.44 12,15.44C11.67,15.44 11.33,15.32 11.06,15.06L6.36,10.55C5.81,10.03 5.79,9.16 6.32,8.61C6.84,8.06 7.71,8.05 8.26,8.57L12,12.17L15.77,8.57C16.31,8.05 17.18,8.07 17.71,8.61C18.23,9.16 18.21,10.03 17.67,10.55Z" />
</vector>
9 changes: 9 additions & 0 deletions parts/res/drawable/ic_preset.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!-- drawable/equalizer.xml -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:height="24dp"
android:width="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000" android:pathData="M10,20H14V4H10V20M4,20H8V12H4V20M16,9V20H20V9H16Z" />
</vector>
File renamed without changes.
27 changes: 27 additions & 0 deletions parts/res/layout/dirac.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2014, 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.
*/
-->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="match_parent"
android:layout_width="match_parent">

<include layout="@layout/switch_bar" />

</LinearLayout>
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:clickable="true"
android:gravity="center">
android:gravity="center"
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent">

<TextView android:id="@+id/switch_text"
android:layout_height="wrap_content"
Expand All @@ -33,7 +34,7 @@
android:maxLines="2"
android:ellipsize="end"
android:textAppearance="@android:style/TextAppearance.Material.Title"
android:textColor="@android:color/white"
android:textColor="?android:attr/textColorPrimaryInverse"
android:textSize="18sp"
android:textAlignment="viewStart" />

Expand Down
21 changes: 21 additions & 0 deletions parts/res/values-night/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->

<resources>
<color name="switchbar_switch_track_tint">#82000000</color>
<color name="switchbar_switch_thumb_tint">@android:color/black</color>
</resources>

Loading

0 comments on commit 6b5d0cf

Please sign in to comment.