mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-02-02 10:25:22 -05:00
Cleanup
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
8abf9a0031
commit
b1da856762
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 18 Dec 2018 08:48:14 -0500
|
||||
Subject: [PATCH] allow SystemUI to directly manage Bluetooth/WiFi
|
||||
|
||||
---
|
||||
packages/SystemUI/AndroidManifest.xml | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
|
||||
index 6755e6bee975..e63121fafd31 100644
|
||||
--- a/packages/SystemUI/AndroidManifest.xml
|
||||
+++ b/packages/SystemUI/AndroidManifest.xml
|
||||
@@ -85,6 +85,8 @@
|
||||
<uses-permission android:name="android.permission.CONTROL_VPN" />
|
||||
<uses-permission android:name="android.permission.PEERS_MAC_ADDRESS"/>
|
||||
<uses-permission android:name="android.permission.READ_WIFI_CREDENTIAL"/>
|
||||
+ <uses-permission android:name="android.permission.MANAGE_BLUETOOTH_WHEN_PERMISSION_REVIEW_REQUIRED" />
|
||||
+ <uses-permission android:name="android.permission.MANAGE_WIFI_WHEN_PERMISSION_REVIEW_REQUIRED" />
|
||||
<!-- Physical hardware -->
|
||||
<uses-permission android:name="android.permission.MANAGE_USB" />
|
||||
<uses-permission android:name="android.permission.CONTROL_DISPLAY_BRIGHTNESS" />
|
@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Wed, 6 Apr 2022 01:10:00 -0400
|
||||
Subject: [PATCH] Use basic boot animation
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I0c87ddd9aec21fc610f3d17701192c04150308d7
|
||||
---
|
||||
cmds/bootanimation/BootAnimation.cpp | 11 ++---------
|
||||
1 file changed, 2 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
|
||||
index 50c8e933d25f..9f4e6a158cc4 100644
|
||||
--- a/cmds/bootanimation/BootAnimation.cpp
|
||||
+++ b/cmds/bootanimation/BootAnimation.cpp
|
||||
@@ -726,7 +726,7 @@ GLuint linkShader(GLuint vertexShader, GLuint fragmentShader) {
|
||||
}
|
||||
|
||||
void BootAnimation::initShaders() {
|
||||
- bool dynamicColoringEnabled = mAnimation != nullptr && mAnimation->dynamicColoringEnabled;
|
||||
+ bool dynamicColoringEnabled = false;
|
||||
GLuint vertexShader = compileShader(GL_VERTEX_SHADER, (const GLchar *)VERTEX_SHADER_SOURCE);
|
||||
GLuint imageFragmentShader =
|
||||
compileShader(GL_FRAGMENT_SHADER, dynamicColoringEnabled
|
||||
@@ -762,14 +762,7 @@ bool BootAnimation::threadLoop() {
|
||||
bool result;
|
||||
initShaders();
|
||||
|
||||
- // We have no bootanimation file, so we use the stock android logo
|
||||
- // animation.
|
||||
- if (mZipFileName.isEmpty()) {
|
||||
- ALOGD("No animation file");
|
||||
- result = android();
|
||||
- } else {
|
||||
- result = movie();
|
||||
- }
|
||||
+ result = android();
|
||||
|
||||
mCallbacks->shutdown();
|
||||
eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
@ -1,219 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: empratyush <codelab@pratyush.dev>
|
||||
Date: Thu, 24 Mar 2022 11:55:21 +0530
|
||||
Subject: [PATCH] make monet based theming user configurable
|
||||
|
||||
---
|
||||
core/java/android/provider/Settings.java | 21 +++++
|
||||
.../theme/ThemeOverlayController.java | 86 +++++++++++--------
|
||||
2 files changed, 70 insertions(+), 37 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
|
||||
index a60ec93697a6..29a26dcd5d4b 100644
|
||||
--- a/core/java/android/provider/Settings.java
|
||||
+++ b/core/java/android/provider/Settings.java
|
||||
@@ -6600,6 +6600,27 @@ public final class Settings {
|
||||
return putStringForUser(cr, name, Float.toString(value), userHandle);
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Control whether to enable dynamic monet based theming mode.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final String MONET_MODE = "monet_mode";
|
||||
+
|
||||
+ /**
|
||||
+ * MONET_MODE value for enabled mode.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int MONET_MODE_ENABLED = 1;
|
||||
+
|
||||
+ /**
|
||||
+ * MONET_MODE value for disabled mode.
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @UnsupportedAppUsage
|
||||
+ public static final int MONET_MODE_DISABLED = 0;
|
||||
+
|
||||
/**
|
||||
* Control whether to enable adaptive sleep mode.
|
||||
* @hide
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
|
||||
index 48e05575b8bb..9ed599e0a722 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/theme/ThemeOverlayController.java
|
||||
@@ -122,7 +122,6 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
private final SystemSettings mSystemSettings;
|
||||
private final Executor mMainExecutor;
|
||||
private final Handler mBgHandler;
|
||||
- private final boolean mIsMonetEnabled;
|
||||
private final UserTracker mUserTracker;
|
||||
private final ConfigurationController mConfigurationController;
|
||||
private final DeviceProvisionedController mDeviceProvisionedController;
|
||||
@@ -268,7 +267,11 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
final boolean hadWallpaperColors = mCurrentColors.get(userId) != null;
|
||||
int latestWallpaperType = getLatestWallpaperType(userId);
|
||||
if ((flags & latestWallpaperType) != 0) {
|
||||
- mCurrentColors.put(userId, wallpaperColors);
|
||||
+ if (isMonetEnabled(userId)) {
|
||||
+ mCurrentColors.put(userId, wallpaperColors);
|
||||
+ } else {
|
||||
+ mCurrentColors.put(userId, null);
|
||||
+ }
|
||||
if (DEBUG) Log.d(TAG, "got new colors: " + wallpaperColors + " where: " + flags);
|
||||
}
|
||||
|
||||
@@ -366,6 +369,15 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
}
|
||||
};
|
||||
|
||||
+ private boolean isMonetEnabled(int user) {
|
||||
+ return Settings.Secure.getIntForUser(
|
||||
+ mContext.getContentResolver(),
|
||||
+ Settings.Secure.MONET_MODE,
|
||||
+ Settings.Secure.MONET_MODE_DISABLED,
|
||||
+ user
|
||||
+ ) == Settings.Secure.MONET_MODE_ENABLED;
|
||||
+ }
|
||||
+
|
||||
@Inject
|
||||
public ThemeOverlayController(Context context, BroadcastDispatcher broadcastDispatcher,
|
||||
@Background Handler bgHandler, @Main Executor mainExecutor,
|
||||
@@ -377,7 +389,6 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
SystemSettings systemSettings, ConfigurationController configurationController) {
|
||||
super(context);
|
||||
|
||||
- mIsMonetEnabled = featureFlags.isEnabled(Flags.MONET);
|
||||
mConfigurationController = configurationController;
|
||||
mDeviceProvisionedController = deviceProvisionedController;
|
||||
mBroadcastDispatcher = broadcastDispatcher;
|
||||
@@ -477,24 +488,17 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
},
|
||||
UserHandle.USER_ALL);
|
||||
|
||||
- if (!mIsMonetEnabled) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
mUserTracker.addCallback(mUserTrackerCallback, mMainExecutor);
|
||||
|
||||
mConfigurationController.addCallback(mConfigurationListener);
|
||||
mDeviceProvisionedController.addCallback(mDeviceProvisionedListener);
|
||||
|
||||
- // All wallpaper color and keyguard logic only applies when Monet is enabled.
|
||||
- if (!mIsMonetEnabled) {
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
// Upon boot, make sure we have the most up to date colors
|
||||
Runnable updateColors = () -> {
|
||||
- WallpaperColors systemColor = mWallpaperManager.getWallpaperColors(
|
||||
- getLatestWallpaperType(mUserTracker.getUserId()));
|
||||
+ WallpaperColors systemColor = isMonetEnabled(
|
||||
+ mUserTracker.getUserId()) ? mWallpaperManager.getWallpaperColors(
|
||||
+ getLatestWallpaperType(mUserTracker.getUserId()))
|
||||
+ : null;
|
||||
Runnable applyColors = () -> {
|
||||
if (DEBUG) Log.d(TAG, "Boot colors: " + systemColor);
|
||||
mCurrentColors.put(mUserTracker.getUserId(), systemColor);
|
||||
@@ -520,7 +524,8 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
@Override
|
||||
public void onFinishedGoingToSleep() {
|
||||
final int userId = mUserTracker.getUserId();
|
||||
- final WallpaperColors colors = mDeferredWallpaperColors.get(userId);
|
||||
+ final WallpaperColors colors = isMonetEnabled(userId)
|
||||
+ ? mDeferredWallpaperColors.get(userId) : null;
|
||||
if (colors != null) {
|
||||
int flags = mDeferredWallpaperColorsFlags.get(userId);
|
||||
|
||||
@@ -531,10 +536,30 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
}
|
||||
}
|
||||
});
|
||||
+
|
||||
+ mSecureSettings.registerContentObserverForUser(
|
||||
+ Settings.Secure.getUriFor(Settings.Secure.MONET_MODE),
|
||||
+ false,
|
||||
+ new ContentObserver(mBgHandler) {
|
||||
+ @Override
|
||||
+ public void onChange(boolean selfChange) {
|
||||
+ super.onChange(selfChange);
|
||||
+ WallpaperColors color = isMonetEnabled(mUserTracker.getUserId())
|
||||
+ ? mWallpaperManager.getWallpaperColors(WallpaperManager.FLAG_SYSTEM, mUserTracker.getUserId())
|
||||
+
|
||||
+ : null;
|
||||
+ handleWallpaperColors(color, WallpaperManager.FLAG_SYSTEM, mUserTracker.getUserId());
|
||||
+ reevaluateSystemTheme(true);
|
||||
+ }
|
||||
+ },
|
||||
+ UserHandle.USER_ALL
|
||||
+ );
|
||||
}
|
||||
|
||||
private void reevaluateSystemTheme(boolean forceReload) {
|
||||
- final WallpaperColors currentColors = mCurrentColors.get(mUserTracker.getUserId());
|
||||
+ final WallpaperColors currentColors = isMonetEnabled(
|
||||
+ mUserTracker.getUserId()) ? mCurrentColors.get(mUserTracker.getUserId())
|
||||
+ : null;
|
||||
final int mainColor;
|
||||
if (currentColors == null) {
|
||||
mainColor = Color.TRANSPARENT;
|
||||
@@ -547,15 +572,13 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
}
|
||||
mMainWallpaperColor = mainColor;
|
||||
|
||||
- if (mIsMonetEnabled) {
|
||||
- mThemeStyle = fetchThemeStyleFromSetting();
|
||||
- mSecondaryOverlay = getOverlay(mMainWallpaperColor, ACCENT, mThemeStyle);
|
||||
- mNeutralOverlay = getOverlay(mMainWallpaperColor, NEUTRAL, mThemeStyle);
|
||||
- mNeedsOverlayCreation = true;
|
||||
- if (DEBUG) {
|
||||
- Log.d(TAG, "fetched overlays. accent: " + mSecondaryOverlay
|
||||
- + " neutral: " + mNeutralOverlay);
|
||||
- }
|
||||
+ mThemeStyle = fetchThemeStyleFromSetting();
|
||||
+ mSecondaryOverlay = getOverlay(mMainWallpaperColor, ACCENT, mThemeStyle);
|
||||
+ mNeutralOverlay = getOverlay(mMainWallpaperColor, NEUTRAL, mThemeStyle);
|
||||
+ mNeedsOverlayCreation = true;
|
||||
+ if (DEBUG) {
|
||||
+ Log.d(TAG, "fetched overlays. accent: " + mSecondaryOverlay
|
||||
+ + " neutral: " + mNeutralOverlay);
|
||||
}
|
||||
|
||||
updateThemeOverlays();
|
||||
@@ -655,7 +678,7 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
|
||||
// Let's generate system overlay if the style picker decided to override it.
|
||||
OverlayIdentifier systemPalette = categoryToPackage.get(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
- if (mIsMonetEnabled && systemPalette != null && systemPalette.getPackageName() != null) {
|
||||
+ if (systemPalette != null && systemPalette.getPackageName() != null) {
|
||||
try {
|
||||
String colorString = systemPalette.getPackageName().toLowerCase();
|
||||
if (!colorString.startsWith("#")) {
|
||||
@@ -671,16 +694,6 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
// Color.parseColor doesn't catch any exceptions from the calls it makes
|
||||
Log.w(TAG, "Invalid color definition: " + systemPalette.getPackageName(), e);
|
||||
}
|
||||
- } else if (!mIsMonetEnabled && systemPalette != null) {
|
||||
- try {
|
||||
- // It's possible that we flipped the flag off and still have a @ColorInt in the
|
||||
- // setting. We need to sanitize the input, otherwise the overlay transaction will
|
||||
- // fail.
|
||||
- categoryToPackage.remove(OVERLAY_CATEGORY_SYSTEM_PALETTE);
|
||||
- categoryToPackage.remove(OVERLAY_CATEGORY_ACCENT_COLOR);
|
||||
- } catch (NumberFormatException e) {
|
||||
- // This is a package name. All good, let's continue
|
||||
- }
|
||||
}
|
||||
|
||||
// Compatibility with legacy themes, where full packages were defined, instead of just
|
||||
@@ -758,7 +771,6 @@ public class ThemeOverlayController extends CoreStartable implements Dumpable {
|
||||
pw.println("mMainWallpaperColor=" + Integer.toHexString(mMainWallpaperColor));
|
||||
pw.println("mSecondaryOverlay=" + mSecondaryOverlay);
|
||||
pw.println("mNeutralOverlay=" + mNeutralOverlay);
|
||||
- pw.println("mIsMonetEnabled=" + mIsMonetEnabled);
|
||||
pw.println("mColorScheme=" + mColorScheme);
|
||||
pw.println("mNeedsOverlayCreation=" + mNeedsOverlayCreation);
|
||||
pw.println("mAcceptColorEvents=" + mAcceptColorEvents);
|
@ -1,279 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: empratyush <codelab@pratyush.dev>
|
||||
Date: Sun, 27 Mar 2022 11:56:58 +0530
|
||||
Subject: [PATCH] add a UI for enabling Material You
|
||||
|
||||
---
|
||||
res/layout/monet_mode_section_view.xml | 30 +++++
|
||||
res/values/strings.xml | 2 +
|
||||
.../monet/MonetModeSectionController.java | 126 ++++++++++++++++++
|
||||
.../module/DefaultCustomizationSections.java | 5 +
|
||||
.../picker/monet/MonetModeSectionView.java | 53 ++++++++
|
||||
5 files changed, 216 insertions(+)
|
||||
create mode 100644 res/layout/monet_mode_section_view.xml
|
||||
create mode 100644 src/com/android/customization/model/monet/MonetModeSectionController.java
|
||||
create mode 100644 src/com/android/customization/picker/monet/MonetModeSectionView.java
|
||||
|
||||
diff --git a/res/layout/monet_mode_section_view.xml b/res/layout/monet_mode_section_view.xml
|
||||
new file mode 100644
|
||||
index 0000000..2cfed92
|
||||
--- /dev/null
|
||||
+++ b/res/layout/monet_mode_section_view.xml
|
||||
@@ -0,0 +1,30 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<com.android.customization.picker.monet.MonetModeSectionView
|
||||
+ xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
+ android:layout_width="match_parent"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:background="?selectableItemBackground"
|
||||
+ android:clickable="true"
|
||||
+ android:gravity="center_vertical"
|
||||
+ android:orientation="horizontal"
|
||||
+ android:paddingVertical="@dimen/section_vertical_padding"
|
||||
+ android:paddingHorizontal="@dimen/section_horizontal_padding">
|
||||
+
|
||||
+ <TextView
|
||||
+ android:id="@+id/monet_mode_toggle_title"
|
||||
+ android:layout_width="0dp"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:layout_weight="1"
|
||||
+ android:text="@string/monet_title"
|
||||
+ style="@style/SectionTitleTextStyle"/>
|
||||
+
|
||||
+ <Switch
|
||||
+ android:id="@+id/monet_mode_toggle"
|
||||
+ android:layout_width="wrap_content"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:background="@null"
|
||||
+ android:clickable="false"
|
||||
+ android:focusable="false"
|
||||
+ style="@style/Switch.SettingsLib"/>
|
||||
+
|
||||
+</com.android.customization.picker.monet.MonetModeSectionView>
|
||||
diff --git a/res/values/strings.xml b/res/values/strings.xml
|
||||
index 1a15fd0..7d81de1 100755
|
||||
--- a/res/values/strings.xml
|
||||
+++ b/res/values/strings.xml
|
||||
@@ -236,6 +236,8 @@
|
||||
<!-- The title of mode section view. [CHAR_LIMIT=20] -->
|
||||
<string name="mode_title" msgid="1000319159005403986">Dark theme</string>
|
||||
<string name="mode_disabled_msg" msgid="1926077857799715086">Temporarily disabled due to Battery Saver</string>
|
||||
+
|
||||
+ <string name="monet_title">Use wallpaper colors</string>
|
||||
<!-- The text for A11y announcement when theme changes. -->
|
||||
<string name="mode_changed">Theme changed</string>
|
||||
|
||||
diff --git a/src/com/android/customization/model/monet/MonetModeSectionController.java b/src/com/android/customization/model/monet/MonetModeSectionController.java
|
||||
new file mode 100644
|
||||
index 0000000..214d6b1
|
||||
--- /dev/null
|
||||
+++ b/src/com/android/customization/model/monet/MonetModeSectionController.java
|
||||
@@ -0,0 +1,126 @@
|
||||
+package com.android.customization.model.monet;
|
||||
+
|
||||
+import static android.provider.Settings.Secure.MONET_MODE_DISABLED;
|
||||
+import static android.provider.Settings.Secure.MONET_MODE_ENABLED;
|
||||
+
|
||||
+import android.content.Context;
|
||||
+import android.database.ContentObserver;
|
||||
+import android.os.Handler;
|
||||
+import android.os.Looper;
|
||||
+import android.provider.Settings;
|
||||
+import android.view.LayoutInflater;
|
||||
+import android.widget.Switch;
|
||||
+
|
||||
+import androidx.annotation.MainThread;
|
||||
+import androidx.lifecycle.Lifecycle;
|
||||
+import androidx.lifecycle.LifecycleObserver;
|
||||
+import androidx.lifecycle.OnLifecycleEvent;
|
||||
+
|
||||
+import com.android.customization.picker.monet.MonetModeSectionView;
|
||||
+import com.android.wallpaper.R;
|
||||
+import com.android.wallpaper.model.CustomizationSectionController;
|
||||
+
|
||||
+import java.util.concurrent.ExecutorService;
|
||||
+import java.util.concurrent.Executors;
|
||||
+
|
||||
+public class MonetModeSectionController implements
|
||||
+ CustomizationSectionController<MonetModeSectionView>, LifecycleObserver {
|
||||
+
|
||||
+ private static final ExecutorService sExecutorService = Executors.newSingleThreadExecutor();
|
||||
+ private final Lifecycle mLifecycle;
|
||||
+ private Context mContext;
|
||||
+ private MonetModeSectionView mMonetModeSectionView;
|
||||
+
|
||||
+ private final ContentObserver mContentObserver = new ContentObserver(
|
||||
+ new Handler(Looper.getMainLooper())) {
|
||||
+ @Override
|
||||
+ public void onChange(boolean selfChange) {
|
||||
+ super.onChange(selfChange);
|
||||
+ sExecutorService.execute(() -> {
|
||||
+ //set is checked ??
|
||||
+ });
|
||||
+ }
|
||||
+ };
|
||||
+
|
||||
+ public MonetModeSectionController(Context context, Lifecycle lifecycle) {
|
||||
+ mContext = context;
|
||||
+ mLifecycle = lifecycle;
|
||||
+ mLifecycle.addObserver(this);
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ @OnLifecycleEvent(Lifecycle.Event.ON_START)
|
||||
+ @MainThread
|
||||
+ public void onStart() {
|
||||
+ sExecutorService.submit(() -> {
|
||||
+ if (mContext != null && mLifecycle.getCurrentState().isAtLeast(
|
||||
+ Lifecycle.State.STARTED)) {
|
||||
+
|
||||
+ mContext.getContentResolver().registerContentObserver(
|
||||
+ Settings.Secure.getUriFor(Settings.Secure.MONET_MODE), false,
|
||||
+ mContentObserver);
|
||||
+ }
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
|
||||
+ @MainThread
|
||||
+ public void onStop() {
|
||||
+ sExecutorService.submit(() -> {
|
||||
+ mContext.getContentResolver().unregisterContentObserver(mContentObserver);
|
||||
+ });
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void release() {
|
||||
+ mLifecycle.removeObserver(this);
|
||||
+ mContext = null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isAvailable(Context context) {
|
||||
+ return context != null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public MonetModeSectionView createView(Context context) {
|
||||
+ mMonetModeSectionView = (MonetModeSectionView) LayoutInflater.from(context).inflate(
|
||||
+ R.layout.monet_mode_section_view, /* root= */ null);
|
||||
+ mMonetModeSectionView.setViewListener(this::onViewActivated);
|
||||
+ mMonetModeSectionView.setEnabled(isAvailable(context));
|
||||
+ return mMonetModeSectionView;
|
||||
+ }
|
||||
+
|
||||
+ private void onViewActivated(Context context, boolean viewActivated) {
|
||||
+ if (context == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+ Switch switchView = mMonetModeSectionView.findViewById(R.id.monet_mode_toggle);
|
||||
+ int shortDelay = context.getResources().getInteger(android.R.integer.config_shortAnimTime);
|
||||
+ new Handler(Looper.getMainLooper()).postDelayed(() -> {
|
||||
+ mMonetModeSectionView.announceForAccessibility(
|
||||
+ context.getString(R.string.mode_changed));
|
||||
+ setMonetEnabled(viewActivated, context);
|
||||
+ },
|
||||
+ /* delayMillis= */ shortDelay);
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isMonetEnabled(Context context) {
|
||||
+ return Settings.Secure.getIntForUser(
|
||||
+ context.getContentResolver(),
|
||||
+ Settings.Secure.MONET_MODE,
|
||||
+ MONET_MODE_DISABLED,
|
||||
+ context.getUserId()
|
||||
+ ) == MONET_MODE_ENABLED;
|
||||
+ }
|
||||
+
|
||||
+ public static void setMonetEnabled(boolean isEnabled, Context context) {
|
||||
+ Settings.Secure.putIntForUser(context.getContentResolver(),
|
||||
+ Settings.Secure.MONET_MODE,
|
||||
+ isEnabled ? MONET_MODE_ENABLED : MONET_MODE_DISABLED,
|
||||
+ context.getUserId()
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+}
|
||||
diff --git a/src/com/android/customization/module/DefaultCustomizationSections.java b/src/com/android/customization/module/DefaultCustomizationSections.java
|
||||
index 096552e..45a27a6 100644
|
||||
--- a/src/com/android/customization/module/DefaultCustomizationSections.java
|
||||
+++ b/src/com/android/customization/module/DefaultCustomizationSections.java
|
||||
@@ -10,6 +10,7 @@ import com.android.customization.model.color.ColorSectionController;
|
||||
import com.android.customization.model.grid.GridOptionsManager;
|
||||
import com.android.customization.model.grid.GridSectionController;
|
||||
import com.android.customization.model.mode.DarkModeSectionController;
|
||||
+import com.android.customization.model.monet.MonetModeSectionController;
|
||||
import com.android.customization.model.themedicon.ThemedIconSectionController;
|
||||
import com.android.customization.model.themedicon.ThemedIconSwitchProvider;
|
||||
import com.android.wallpaper.model.CustomizationSectionController;
|
||||
@@ -50,6 +51,10 @@ public final class DefaultCustomizationSections implements CustomizationSections
|
||||
sectionControllers.add(new DarkModeSectionController(activity,
|
||||
lifecycleOwner.getLifecycle()));
|
||||
|
||||
+ // Monet enable/disable section.
|
||||
+ sectionControllers.add(new MonetModeSectionController(activity,
|
||||
+ lifecycleOwner.getLifecycle()));
|
||||
+
|
||||
// Themed app icon section.
|
||||
sectionControllers.add(new ThemedIconSectionController(
|
||||
ThemedIconSwitchProvider.getInstance(activity), workspaceViewModel,
|
||||
diff --git a/src/com/android/customization/picker/monet/MonetModeSectionView.java b/src/com/android/customization/picker/monet/MonetModeSectionView.java
|
||||
new file mode 100644
|
||||
index 0000000..90d6e43
|
||||
--- /dev/null
|
||||
+++ b/src/com/android/customization/picker/monet/MonetModeSectionView.java
|
||||
@@ -0,0 +1,53 @@
|
||||
+package com.android.customization.picker.monet;
|
||||
+
|
||||
+import android.content.Context;
|
||||
+import android.util.AttributeSet;
|
||||
+import android.widget.Switch;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+
|
||||
+import com.android.customization.model.monet.MonetModeSectionController;
|
||||
+import com.android.wallpaper.R;
|
||||
+import com.android.wallpaper.picker.SectionView;
|
||||
+
|
||||
+public final class MonetModeSectionView extends SectionView {
|
||||
+
|
||||
+ private boolean mIsMonetEnabled;
|
||||
+ private Switch switchView;
|
||||
+
|
||||
+ public MonetModeSectionView(Context context, @Nullable AttributeSet attrs) {
|
||||
+ super(context, attrs);
|
||||
+ setTitle(context.getString(R.string.mode_title));
|
||||
+ mIsMonetEnabled = MonetModeSectionController.isMonetEnabled(context);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ protected void onFinishInflate() {
|
||||
+ super.onFinishInflate();
|
||||
+ switchView = findViewById(R.id.monet_mode_toggle);
|
||||
+ switchView.setChecked(mIsMonetEnabled);
|
||||
+ switchView.setOnCheckedChangeListener((buttonView, isChecked) ->
|
||||
+ switchView.setChecked(mIsMonetEnabled)
|
||||
+ );
|
||||
+ setOnClickListener(view -> modeToggleClicked());
|
||||
+ }
|
||||
+
|
||||
+ private void modeToggleClicked() {
|
||||
+ mIsMonetEnabled = !mIsMonetEnabled;
|
||||
+ viewActivated(mIsMonetEnabled);
|
||||
+ }
|
||||
+
|
||||
+ private void viewActivated(boolean isChecked) {
|
||||
+ if (mSectionViewListener != null) {
|
||||
+ mSectionViewListener.onViewActivated(getContext(), isChecked);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setEnabled(boolean enabled) {
|
||||
+ final int numOfChildViews = getChildCount();
|
||||
+ for (int i = 0; i < numOfChildViews; i++) {
|
||||
+ getChildAt(i).setEnabled(enabled);
|
||||
+ }
|
||||
+ }
|
||||
+}
|
@ -130,7 +130,6 @@ fi;
|
||||
if enterAndClear "frameworks/base"; then
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0007-Always_Restict_Serial.patch"; #Always restrict access to Build.SERIAL (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0008-Browser_No_Location.patch"; #Don't grant location permission to system browsers (GrapheneOS)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/0009-SystemUI_No_Permission_Review.patch"; #Allow SystemUI to directly manage Bluetooth/WiFi (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0003-SUPL_No_IMSI.patch"; #Don't send IMSI to SUPL (MSe1969)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0004-Fingerprint_Lockout.patch"; #Enable fingerprint lockout after three failed attempts (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0005-User_Logout.patch"; #Enable secondary user logout support by default (GrapheneOS)
|
||||
@ -168,12 +167,10 @@ applyPatch "$DOS_PATCHES/android_frameworks_base/0018-Exec_Based_Spawning-13.pat
|
||||
sed -i 's/sys.spawn.exec/persist.security.exec_spawn_new/' core/java/com/android/internal/os/ZygoteConnection.java;
|
||||
fi;
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0020-Location_Indicators.patch"; #SystemUI: Use new privacy indicators for location (GrapheneOS)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/0021-Boot_Animation.patch"; #Use basic boot animation (DivestOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0022-Ignore_StatementService_ANR.patch"; #Don't report statementservice crashes (GrapheneOS)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/326692.patch"; #Skip screen on animation when wake and unlock via biometrics (jesec) #TODO: 20REBASE
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0023-Skip_Screen_Animation.patch"; #SystemUI: Skip screen-on animation in all scenarios (kdrag0n)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0024-Burnin_Protection.patch"; #SystemUI: add burnIn protection (arter97)
|
||||
#applyPatch "$DOS_PATCHES/android_frameworks_base/0025-Monet_Toggle.patch"; #Make monet based theming user configurable (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0026-Crash_Details.patch"; #Add an option to show the details of an application error to the user (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0027-Installer_Glitch.patch"; #Make sure PackageInstaller UI returns a result (GrapheneOS)
|
||||
applyPatch "$DOS_PATCHES/android_frameworks_base/0028-Remove_Legacy_Package_Query.patch"; #Don't leak device-wide package list to apps when work profile is present (GrapheneOS)
|
||||
@ -308,10 +305,6 @@ if enterAndClear "packages/apps/SetupWizard"; then
|
||||
applyPatch "$DOS_PATCHES/android_packages_apps_SetupWizard/0001-Remove_Analytics.patch"; #Remove analytics (DivestOS)
|
||||
fi;
|
||||
|
||||
#if enterAndClear "packages/apps/ThemePicker"; then
|
||||
#applyPatch "$DOS_PATCHES/android_packages_apps_ThemePicker/0001-Monet_Toggle.patch"; #Add a UI for enabling Material You (GrapheneOS)
|
||||
#fi;
|
||||
|
||||
if enterAndClear "packages/apps/Trebuchet"; then
|
||||
cp $DOS_BUILD_BASE/vendor/divested/overlay/common/packages/apps/Trebuchet/res/xml/default_workspace_*.xml res/xml/; #XXX: Likely no longer needed
|
||||
fi;
|
||||
|
Loading…
x
Reference in New Issue
Block a user