base: Add settings to change QS tile shape [1/2]
Change-Id: If6ad2f69ac1d8ab15c20be9dbe8531a2ecc13aae
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index 79b76e7..f11c7fc 100644
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -12218,6 +12218,12 @@
public static final String QS_SHOW_AUTO_BRIGHTNESS = "qs_show_auto_brightness";
/**
+ * Quicksettings tile shape
+ * @hide
+ */
+ public static final String QS_TILE_SHAPE = "qs_tile_shape";
+
+ /**
* These entries are considered common between the personal and the managed profile,
* since the managed profile doesn't get to change them.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
index e812e89..6b046be 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileViewImpl.kt
@@ -32,6 +32,7 @@
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.StateListDrawable
import android.os.Trace
+import android.provider.Settings
import android.service.quicksettings.Tile
import android.text.TextUtils
import android.util.Log
@@ -673,6 +674,13 @@
}
private fun getCornerRadiusForState(state: Int): Float {
+ var qsTileShape : Int = Settings.Secure.getInt(context.contentResolver, Settings.Secure.QS_TILE_SHAPE, 2)
+ if (qsTileShape == 0)
+ return radiusActive
+
+ if (qsTileShape == 1)
+ return radiusInactive
+
return when (state) {
Tile.STATE_ACTIVE -> radiusActive
Tile.STATE_INACTIVE -> radiusInactive
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
index 6aec013..44bf6d4 100644
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
@@ -514,6 +514,27 @@
UserHandle.USER_ALL);
mSecureSettings.registerContentObserverForUser(
+ Settings.Secure.getUriFor(Settings.Secure.QS_TILE_SHAPE),
+ false,
+ new ContentObserver(mBgHandler) {
+ @Override
+ public void onChange(boolean selfChange, Collection<Uri> collection, int flags,
+ int userId) {
+ if (DEBUG) Log.d(TAG, "Overlay changed for user: " + userId);
+ if (mUserTracker.getUserId() != userId) {
+ return;
+ }
+ if (!mDeviceProvisionedController.isUserSetup(userId)) {
+ Log.i(TAG, "Theme application deferred when setting changed.");
+ mDeferredThemeEvaluation = true;
+ return;
+ }
+ reevaluateSystemTheme(true /* forceReload */);
+ }
+ },
+ UserHandle.USER_ALL);
+
+ mSecureSettings.registerContentObserverForUser(
Settings.Secure.getUriFor(Settings.Secure.QS_BRIGHTNESS_SLIDER_POSITION),
false,
new ContentObserver(mBgHandler) {