Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,3 +365,4 @@ Since One UI updates may cause hooks to fail, if you find any invalid hook point

- [Firefds Kit](https://github.com/Firefds/FirefdsKit)
- [OneDesign](https://github.com/qlenlen/android_kernel_samsung_sm8550)
- [ColorMotion](https://github.com/juccul/ColorMotion)
14 changes: 14 additions & 0 deletions THIRD_PARTY_COLORMOTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ColorMotion

The panel animation feature (`hook/src/main/java/dev/colormotion`, `hook/src/main/java/de/robv/android/xposed`,
`cm-native-api`, `cm-native-bridge`) is derived from **ColorMotion** by juccul,
<https://github.com/juccul/ColorMotion>, licensed under the GNU General Public License v3.0
(see `licenses/ColorMotion-GPL-3.0.txt`).

GPL v3 section 13 allows combining it with this AGPL v3 project. The combined work is
distributed under AGPL v3; the ColorMotion parts remain under their original copyright.

Changes made for OneUIX:
- The module entry was replaced by `dev.colormotion.Entry.install`, called from OneUIX's SystemUI hook.
- A small compatibility layer in `de.robv.android.xposed` maps ColorMotion's legacy hook API onto libxposed.
- The Audio Eraser banner filter was dropped; OneUIX has its own.
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,17 @@ fun DetailPaneSystemUI(
onEvent(SystemUIEvent.QS.DisableHighBrightnessDialog(it))
}
)
if (ONE_UI_VERSION >= 80500) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.fast_forward),
title = stringResource(id = R.string.colorMotionAnimation_title),
summary = stringResource(id = R.string.colorMotionAnimation_summary),
checked = uiState.qs.colorMotionAnimation,
onCheckedChange = {
onEvent(SystemUIEvent.QS.ColorMotionAnimation(it))
}
)
}
if (ONE_UI_VERSION < 80500) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.light_mode),
Expand Down Expand Up @@ -1144,6 +1155,9 @@ sealed interface SystemUIEvent {
@JvmInline
value class DisableHighBrightnessDialog(val value: Boolean) : QS

@JvmInline
value class ColorMotionAnimation(val value: Boolean) : QS

@JvmInline
value class AddBrightnessProgressToQsBar(val value: Boolean) : QS

Expand Down Expand Up @@ -1674,6 +1688,16 @@ private fun SettingViewModel.onQSEvent(event: SystemUIEvent.QS) {
)
}

is SystemUIEvent.QS.ColorMotionAnimation -> {
preference.copy(
systemUI = preference.systemUI.copy(
qs = preference.systemUI.qs.copy(
colorMotionAnimation = event.value
)
)
)
}

is SystemUIEvent.QS.AddBrightnessProgressToQsBar -> {
preference.copy(
systemUI = preference.systemUI.copy(
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,6 @@
<string name="allowLowBatteryFlashlight_summary">Utilisable jusqu’à 1 % sans extinction automatique due à la batterie faible. La protection thermique est conservée</string>
<string name="fixMyFilesNetworkStorage_title">Corriger la redirection du stockage réseau dans Mes fichiers</string>
<string name="fixMyFilesNetworkStorage_summary">Pour la version internationale de Mes fichiers sur une ROM chinoise : empêche le stockage réseau de rediriger vers la page de mise à jour du Galaxy Store. La dernière version en cache est alignée sur la version installée</string>
<string name="colorMotionAnimation_title">Animation des notifications et réglages rapides</string>
<string name="colorMotionAnimation_summary">Animation à ressort plus fluide pour le volet de notifications et les Réglages rapides (One UI 8.5+). Nécessite des panneaux séparés : notifications à gauche, Réglages rapides à droite</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,6 @@
<string name="allowLowBatteryFlashlight_summary">배터리 부족으로 자동으로 꺼지지 않고 1%까지 사용합니다. 과열 보호는 유지됩니다</string>
<string name="fixMyFilesNetworkStorage_title">내 파일 네트워크 저장소 이동 문제 수정</string>
<string name="fixMyFilesNetworkStorage_summary">중국 ROM에서 국제판 내 파일을 사용할 때 네트워크 저장소를 누르면 Galaxy Store 업데이트 페이지로 이동하는 문제를 막습니다. 캐시된 최신 버전을 설치된 버전과 동일하게 유지합니다</string>
<string name="colorMotionAnimation_title">알림창 및 빠른 설정 애니메이션</string>
<string name="colorMotionAnimation_summary">알림창과 빠른 설정에 더 부드러운 스프링 애니메이션을 추가합니다(One UI 8.5 이상). 알림은 왼쪽, 빠른 설정은 오른쪽에서 내리는 분리형 패널이 필요합니다</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,6 @@
<string name="allowLowBatteryFlashlight_summary">Работа до 1 % без автоматического отключения из-за низкого заряда. Защита от перегрева сохраняется</string>
<string name="fixMyFilesNetworkStorage_title">Исправить переход «Сетевого хранилища» в «Моих файлах»</string>
<string name="fixMyFilesNetworkStorage_summary">Для международной версии «Моих файлов» на китайской прошивке: не даёт «Сетевому хранилищу» перенаправлять на страницу обновления в Galaxy Store. Кэшированная последняя версия приравнивается к установленной</string>
<string name="colorMotionAnimation_title">Анимация шторки и быстрых настроек</string>
<string name="colorMotionAnimation_summary">Более плавная пружинная анимация шторки уведомлений и быстрых настроек (One UI 8.5+). Нужны раздельные панели: уведомления слева, быстрые настройки справа</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,6 @@
<string name="allowLowBatteryFlashlight_summary">电量低至 1% 时仍可使用,不因低电量自动关闭;保留过热保护</string>
<string name="fixMyFilesNetworkStorage_title">修复我的文件网络存储跳转</string>
<string name="fixMyFilesNetworkStorage_summary">适用于国行系统上使用国际版“我的文件”:点击网络存储时不再跳转到应用商店更新页面。让缓存的最新版本与已安装版本保持一致</string>
<string name="colorMotionAnimation_title">快捷通知面板动画</string>
<string name="colorMotionAnimation_summary">为通知面板和快捷设置添加更流畅的弹簧动画(One UI 8.5 及以上)。需要使用分开式面板:左侧下拉通知,右侧下拉快捷设置</string>
</resources>
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,6 @@
<string name="allowLowBatteryFlashlight_summary">Allow use down to 1% without automatic shutoff due to low battery. Thermal protection is retained</string>
<string name="fixMyFilesNetworkStorage_title">Fix My Files network storage redirect</string>
<string name="fixMyFilesNetworkStorage_summary">For the international My Files on a China ROM: stop Network storage from jumping to the Galaxy Store update page. Keeps the cached latest version equal to the installed version</string>
<string name="colorMotionAnimation_title">Notification and Quick Settings animation</string>
<string name="colorMotionAnimation_summary">Smoother spring-based animation for the notification shade and Quick Settings (One UI 8.5+). Requires split panels: notifications from the left, Quick Settings from the right</string>
</resources>
33 changes: 33 additions & 0 deletions cm-native-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Compile-only stubs of the SystemUI / Compose members used by cm-native-bridge. Never packaged.
import java.io.File
import java.util.Properties

plugins { `java-library` }

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

fun androidSdkDir(): File {
val fromEnv = System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")
if (fromEnv != null && File(fromEnv).isDirectory) return File(fromEnv)
val local = rootProject.file("local.properties")
if (local.isFile) {
val dir = Properties().apply { local.inputStream().use { load(it) } }.getProperty("sdk.dir")
if (dir != null && File(dir).isDirectory) return File(dir)
}
error("Android SDK not found: set ANDROID_HOME or sdk.dir in local.properties")
}

// Newest installed platform that is at least API 35.
val androidJar: File = File(androidSdkDir(), "platforms").listFiles().orEmpty()
.mapNotNull { dir -> dir.name.removePrefix("android-").toDoubleOrNull()?.let { it to dir } }
.filter { it.first >= 35 && File(it.second, "android.jar").isFile }
.maxByOrNull { it.first }
?.let { File(it.second, "android.jar") }
?: error("No Android platform 35+ under ${androidSdkDir()}/platforms")

dependencies {
compileOnly(files(androidJar))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package androidx.compose.runtime;

/** Only the inherited/read and write contracts used by the bridge. Never packaged. */
public interface MutableState<T> extends State<T> { void setValue(T value); }
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package androidx.compose.runtime;

/** Compile-only ABI from the captured Samsung DEX. Never packaged or loaded. */
public interface State<T> { T getValue(); }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package androidx.compose.runtime.snapshots;

public class MutableSnapshot extends Snapshot {
public SnapshotApplyResult apply() { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package androidx.compose.runtime.snapshots;

/** Compile-only Samsung runtime ABI. The bridge resolves the real types from SystemUI. */
public abstract class Snapshot {
public static final Companion Companion = null;
public static final class Companion {
public static MutableSnapshot takeMutableSnapshot$default(Companion self) {
throw new UnsupportedOperationException("ABI stub");
}
}
public Snapshot makeCurrent() { throw new UnsupportedOperationException("ABI stub"); }
public static void restoreCurrent(Snapshot previous) { throw new UnsupportedOperationException("ABI stub"); }
public void dispose() { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package androidx.compose.runtime.snapshots;

public abstract class SnapshotApplyResult { public abstract void check(); }
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package androidx.compose.ui.graphics;

/** Compile-only public fields verified against the phone's SystemUI DEX. */
public final class ReusableGraphicsLayerScope {
public float alpha, scaleX, scaleY, translationY;
public int mutatedFields, compositingStrategy;
public ReusableGraphicsLayerScope() { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.android.systemui.statusbar.notification.row;
public class ExpandableNotificationRow extends ExpandableView {
public boolean mIsFaded;
public void updateBlurBackgroundGradient() { throw new UnsupportedOperationException("ABI stub"); }
public java.util.List<?> getAttachedChildren() { throw new UnsupportedOperationException("ABI stub"); }
public void setNotificationFaded(boolean faded) { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.android.systemui.statusbar.notification.row;
import android.view.View;
import com.android.systemui.statusbar.notification.stack.ExpandableViewState;
/** Compile-only captured ABI; all real instances come from SystemUI. */
public class ExpandableView extends View {
public int mActualHeight = 160;
public ExpandableViewState mViewState;
public boolean mWillBeGone;
public ExpandableView() { super(null); throw new UnsupportedOperationException("ABI stub"); }
public boolean mustStayOnScreen() { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package com.android.systemui.statusbar.notification.stack;
public class AmbientState { public float mStackY; public float mBlurTopFadeoutEnd = 300f, mBlurBottomFadeoutStart = 900f; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package com.android.systemui.statusbar.notification.stack;
public class ExpandableViewState extends ViewState {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.android.systemui.statusbar.notification.stack;
import android.view.View;
/** Compile-only captured ABI. No stack/view implementation is packaged. */
public class NotificationStackScrollLayout extends View {
public StackScrollAlgorithm mStackScrollAlgorithm;
public AmbientState mAmbientState;
public boolean mChildrenUpdateRequested;
public int mOwnScrollY;
public NotificationStackScrollLayout() { super(null); throw new UnsupportedOperationException("ABI stub"); }
public int getTopPadding() { throw new UnsupportedOperationException("ABI stub"); }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.android.systemui.statusbar.notification.stack;
import java.util.ArrayList;
import com.android.systemui.statusbar.notification.row.ExpandableView;
public class StackScrollAlgorithm {
public StackScrollAlgorithmState mTempAlgorithmState;
public static class StackScrollAlgorithmState { public ArrayList<ExpandableView> visibleChildren; }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.android.systemui.statusbar.notification.stack;
import android.view.View;
/** Compile-only captured ABI. */
public class ViewState {
public float mYTranslation, mScaleX, mScaleY, mAlpha;
public boolean gone, hidden;
public static boolean isAnimating(View view) { throw new UnsupportedOperationException("ABI stub"); }
}
116 changes: 116 additions & 0 deletions cm-native-bridge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
// The typed ColorMotion bridge: compiled against stubs, dexed with D8 and shipped as
// assets/colormotion-native.dex. It is loaded at runtime with SystemUI's class loader as parent.
import java.io.File
import java.util.Properties
import javax.inject.Inject
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.bundling.Jar
import org.gradle.process.ExecOperations

plugins { `java-library` }

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

fun androidSdkDir(): File {
val fromEnv = System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")
if (fromEnv != null && File(fromEnv).isDirectory) return File(fromEnv)
val local = rootProject.file("local.properties")
if (local.isFile) {
val dir = Properties().apply { local.inputStream().use { load(it) } }.getProperty("sdk.dir")
if (dir != null && File(dir).isDirectory) return File(dir)
}
error("Android SDK not found: set ANDROID_HOME or sdk.dir in local.properties")
}

val sdkDir: File = androidSdkDir()

// Newest installed platform that is at least API 35.
val androidJar: File = File(sdkDir, "platforms").listFiles().orEmpty()
.mapNotNull { dir -> dir.name.removePrefix("android-").toDoubleOrNull()?.let { it to dir } }
.filter { it.first >= 35 && File(it.second, "android.jar").isFile }
.maxByOrNull { it.first }
?.let { File(it.second, "android.jar") }
?: error("No Android platform 35+ under $sdkDir/platforms")

// Newest installed build-tools that ships D8.
fun versionPart(name: String, index: Int): Int =
name.split('.').getOrNull(index)?.takeWhile { it.isDigit() }?.toIntOrNull() ?: 0

val d8Jar: File = File(sdkDir, "build-tools").listFiles().orEmpty()
.filter { File(it, "lib/d8.jar").isFile }
.maxWithOrNull(
compareBy<File>({ versionPart(it.name, 0) }, { versionPart(it.name, 1) }, { versionPart(it.name, 2) })
)
?.let { File(it, "lib/d8.jar") }
?: error("No build-tools with lib/d8.jar under $sdkDir/build-tools")

dependencies {
compileOnly(files(androidJar))
compileOnly(project(":cm-native-api"))
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:2.2.10")
}

abstract class DexBridge @Inject constructor(private val execOps: ExecOperations) : DefaultTask() {
@get:InputFile
@get:PathSensitive(PathSensitivity.NONE)
abstract val bridgeJar: RegularFileProperty

@get:InputFiles
@get:PathSensitive(PathSensitivity.NONE)
abstract val libraryJars: ConfigurableFileCollection

@get:Input
abstract val androidJarPath: Property<String>

@get:Input
abstract val d8JarPath: Property<String>

@get:OutputDirectory
abstract val outDir: DirectoryProperty

@TaskAction
fun dex() {
val out = outDir.get().asFile
out.deleteRecursively()
out.mkdirs()
val androidJarFile = androidJarPath.get()
val jars = libraryJars.files.filter { it.isFile && it.name.endsWith(".jar") }
execOps.javaexec {
classpath(d8JarPath.get())
mainClass.set("com.android.tools.r8.D8")
val arguments = mutableListOf("--release", "--min-api", "35", "--lib", androidJarFile)
jars.filter { it.absolutePath != androidJarFile }.forEach { arguments += listOf("--lib", it.absolutePath) }
arguments += listOf("--output", out.absolutePath, bridgeJar.get().asFile.absolutePath)
args = arguments
}
}
}

val apiJar = project(":cm-native-api").tasks.named<Jar>("jar")

val dexBridge = tasks.register<DexBridge>("dexBridge") {
bridgeJar.set(tasks.named<Jar>("jar").flatMap { it.archiveFile })
libraryJars.from(configurations.named("compileClasspath"))
libraryJars.from(apiJar.flatMap { it.archiveFile })
androidJarPath.set(androidJar.absolutePath)
d8JarPath.set(d8Jar.absolutePath)
outDir.set(layout.buildDirectory.dir("dex"))
}

tasks.register<Sync>("bridgeAssets") {
from(dexBridge.flatMap { it.outDir.file("classes.dex") }) { rename { "colormotion-native.dex" } }
into(layout.buildDirectory.dir("assets"))
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package dev.colormotion.nativebridge;

import androidx.compose.runtime.snapshots.MutableSnapshot;
import androidx.compose.runtime.snapshots.Snapshot;

/** One synchronous snapshot commit for all changed rows, before the current frame is drawn. */
public final class LayerBatch implements Runnable {
private final Runnable[] pending;
private final int[] count;

public LayerBatch(Runnable[] pending, int[] count) {
this.pending = pending;
this.count = count;
}

@Override public void run() {
int size = count[0];
if (size == 0) return;
MutableSnapshot snapshot = Snapshot.Companion.takeMutableSnapshot$default(Snapshot.Companion);
try {
Snapshot previous = snapshot.makeCurrent();
try {
for (int i = 0; i < size; i++) pending[i].run();
} finally {
Snapshot.restoreCurrent(previous);
}
snapshot.apply().check();
count[0] = 0; // Keep the batch queued if a write or commit failed.
} finally {
snapshot.dispose();
}
}
}
Loading
Loading