Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump org.jetbrains.kotlinx:kotlinx-coroutines-core from 1.8.1 to 1.9.0 in the maven group #33

Closed
wants to merge 7 commits into from
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
11 changes: 0 additions & 11 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ jobs:
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4

- name: Grant Execute Permission for gradlew
run: chmod +x gradlew

- name: Setup ninja
uses: seanmiddleditch/gha-setup-ninja@v5
with:
Expand All @@ -75,14 +72,6 @@ jobs:
with:
version: latest

- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
max-size: 2G
key: ${{ runner.os }}
restore-keys: ${{ runner.os }}
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}

- name: Remove Android's cmake
shell: bash
run: rm -rf $ANDROID_HOME/cmake
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
[submodule "external/xz-embedded"]
path = external/xz-embedded
url = https://github.com/tukaani-project/xz-embedded
[submodule "apache/commons-lang"]
path = apache/commons-lang
url = https://github.com/apache/commons-lang
16 changes: 16 additions & 0 deletions apache/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
val androidSourceCompatibility: JavaVersion by rootProject.extra
val androidTargetCompatibility: JavaVersion by rootProject.extra

plugins {
id("java-library")
}

java {
sourceCompatibility = androidSourceCompatibility
targetCompatibility = androidTargetCompatibility
sourceSets {
main {
java.srcDirs("commons-lang/src/main/java", "local")
}
}
}
1 change: 1 addition & 0 deletions apache/commons-lang
Submodule commons-lang added at c2cd05
31 changes: 31 additions & 0 deletions apache/local/org/apache/commons/lang3/reflect/MemberUtilsX.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/

package org.apache.commons.lang3.reflect;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class MemberUtilsX {
public static int compareConstructorFit(final Constructor<?> left, final Constructor<?> right, final Class<?>[] actual) {
return MemberUtils.compareConstructorFit(left, right, actual);
}

public static int compareMethodFit(final Method left, final Method right, final Class<?>[] actual) {
return MemberUtils.compareMethodFit(left, right, actual);
}
}
19 changes: 19 additions & 0 deletions app/src/main/java/org/lsposed/manager/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@ public static boolean setVerboseLogEnabled(boolean enabled) {
}
}

public static boolean isLogWatchdogEnabled() {
try {
return LSPManagerServiceHolder.getService().isLogWatchdogEnabled();
} catch (RemoteException e) {
Log.e(App.TAG, Log.getStackTraceString(e));
return false;
}
}

public static boolean setLogWatchdog(boolean enabled) {
try {
LSPManagerServiceHolder.getService().setLogWatchdog(enabled);
return true;
} catch (RemoteException e) {
Log.e(App.TAG, Log.getStackTraceString(e));
return false;
}
}

public static ParcelFileDescriptor getLog(boolean verbose) {
try {
return verbose ? LSPManagerServiceHolder.getService().getVerboseLog() : LSPManagerServiceHolder.getService().getModulesLog();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,9 @@ public void onLoadCleared(@Nullable Drawable placeholder) {
holder.root.setAlpha(moduleUtil.isModuleEnabled(item.packageName) ? 1.0f : .5f);
holder.itemView.setOnClickListener(v -> {
searchView.clearFocus();
safeNavigate(ModulesFragmentDirections.actionModulesFragmentToAppListFragment(item.packageName, item.userId));
if (isLoaded()) {
safeNavigate(ModulesFragmentDirections.actionModulesFragmentToAppListFragment(item.packageName, item.userId));
}
});
holder.itemView.setOnLongClickListener(v -> {
searchView.clearFocus();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
prefVerboseLogs.setOnPreferenceChangeListener((preference, newValue) -> ConfigManager.setVerboseLogEnabled(!(boolean) newValue));
}

MaterialSwitchPreference prefEnableLog = findPreference("force_enable_log");
if (prefEnableLog != null) {
prefEnableLog.setEnabled(!BuildConfig.DEBUG && installed);
prefEnableLog.setChecked(!installed || ConfigManager.isLogWatchdogEnabled());
prefEnableLog.setOnPreferenceChangeListener((preference, newValue) -> ConfigManager.setLogWatchdog((boolean) newValue));
}

MaterialSwitchPreference prefDexObfuscate = findPreference("enable_dex_obfuscate");
if (prefDexObfuscate != null) {
prefDexObfuscate.setEnabled(installed);
Expand Down
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 @@ -175,6 +175,8 @@
<string name="settings_group_framework">Framework</string>
<string name="settings_disable_verbose_log">Disable verbose logs</string>
<string name="settings_disable_verbose_log_summary">Report issues request to include verbose logs</string>
<string name="settings_force_enable_log">Enable log watchdog</string>
<string name="settings_force_enable_log_summary">Log watchdog of LSPosed modifies system properties, which could be exploited to detect LSPosed</string>
<string name="pure_black_dark_theme">Black dark theme</string>
<string name="pure_black_dark_theme_summary">Use the pure black theme if dark theme is enabled</string>
<string name="settings_group_theme">Theme</string>
Expand Down
8 changes: 8 additions & 0 deletions app/src/main/res/xml/prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@
android:summary="@string/settings_disable_verbose_log_summary"
android:title="@string/settings_disable_verbose_log" />

<rikka.material.preference.MaterialSwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_outline_assignment_24"
android:key="force_enable_log"
android:persistent="false"
android:summary="@string/settings_force_enable_log_summary"
android:title="@string/settings_force_enable_log" />

<rikka.material.preference.MaterialSwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_outline_shield_24"
Expand Down
2 changes: 1 addition & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ copy {

dependencies {
api(libs.libxposed.api)
implementation(libs.commons.lang3)
implementation(projects.apache)
implementation(projects.axml)
implementation(projects.hiddenapi.bridge)
implementation(projects.services.daemonService)
Expand Down
2 changes: 1 addition & 1 deletion daemon/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ android.applicationVariants.all {
dependencies {
implementation(libs.libxposed.`interface`)
implementation(libs.agp.apksig)
implementation(libs.commons.lang3)
implementation(projects.apache)
implementation(projects.hiddenapi.bridge)
implementation(projects.services.daemonService)
implementation(projects.services.managerService)
Expand Down
19 changes: 19 additions & 0 deletions daemon/src/main/java/org/lsposed/lspd/service/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class ConfigManager {
private final SQLiteDatabase db = openDb();

private boolean verboseLog = true;
private boolean logWatchdog = true;
private boolean dexObfuscate = true;
private boolean enableStatusNotification = true;
private Path miscPath = null;
Expand Down Expand Up @@ -270,6 +271,9 @@ private synchronized void updateConfig() {
Object bool = config.get("enable_verbose_log");
verboseLog = bool == null || (boolean) bool;

bool = config.get("force_enable_log");
logWatchdog = bool == null || (boolean) bool;

bool = config.get("enable_dex_obfuscate");
dexObfuscate = bool == null || (boolean) bool;

Expand Down Expand Up @@ -1048,6 +1052,21 @@ public boolean verboseLog() {
return BuildConfig.DEBUG || verboseLog;
}

public void setLogWatchdog(boolean on) {
var logcatService = ServiceManager.getLogcatService();
if (on) {
logcatService.enableWatchdog();
} else {
logcatService.disableWatchdog();
}
updateModulePrefs("lspd", 0, "config", "force_enable_log", on);
logWatchdog = on;
}

public boolean isLogWatchdogEnabled() {
return logWatchdog;
}

public void setDexObfuscate(boolean on) {
updateModulePrefs("lspd", 0, "config", "enable_dex_obfuscate", on);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -546,4 +546,14 @@ public int getDex2OatWrapperCompatibility() {
return 0;
}
}

@Override
public void setLogWatchdog(boolean enabled) {
ConfigManager.getInstance().setLogWatchdog(enabled);
}

@Override
public boolean isLogWatchdogEnabled() {
return ConfigManager.getInstance().isLogWatchdogEnabled();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ public void stopVerbose() {
Log.i(TAG, "!!stop_verbose!!");
}

public void enableWatchdog() {
Log.i(TAG, "!!start_watchdog!!");
}

public void disableWatchdog() {
Log.i(TAG, "!!stop_watchdog!!");
}

public void refresh(boolean isVerboseLog) {
if (isVerboseLog) {
Log.i(TAG, "!!refresh_verbose!!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,15 @@ public static void start(String[] args) {
logcatService = new LogcatService();
logcatService.start();

// get config before package service is started
// otherwise getInstance will trigger module/scope cache
var configManager = ConfigManager.getInstance();
// --- DO NOT call ConfigManager.getInstance later!!! ---

// Unblock log watchdog before starting anything else
if (configManager.isLogWatchdogEnabled())
logcatService.enableWatchdog();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
permissionManagerWorkaround();

Expand All @@ -133,11 +142,6 @@ public static void start(String[] args) {

systemServerService.putBinderForSystemServer();

// get config before package service is started
// otherwise getInstance will trigger module/scope cache
var configManager = ConfigManager.getInstance();
// --- DO NOT call ConfigManager.getInstance later!!! ---

ActivityThread.systemMain();

DdmHandleAppName.setAppName("org.lsposed.daemon", 0);
Expand Down
14 changes: 12 additions & 2 deletions daemon/src/main/jni/logcat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include <android/log.h>
#include <array>
#include <atomic>
#include <cinttypes>
#include <chrono>
#include <thread>
Expand Down Expand Up @@ -129,6 +130,7 @@ class Logcat {
pid_t my_pid_ = getpid();

bool verbose_ = true;
std::atomic<bool> enable_watchdog = std::atomic<bool>(false);
};

size_t Logcat::PrintLogLine(const AndroidLogEntry &entry, FILE *out) {
Expand Down Expand Up @@ -241,6 +243,12 @@ void Logcat::ProcessBuffer(struct log_msg *buf) {
RefreshFd(false);
} else if (msg == "!!refresh_verbose!!"sv) {
RefreshFd(true);
} else if (msg == "!!start_watchdog!!"sv) {
enable_watchdog = true;
enable_watchdog.notify_one();
} else if (msg == "!!stop_watchdog!!"sv) {
enable_watchdog = false;
enable_watchdog.notify_one();
}
}
}
Expand All @@ -253,6 +261,7 @@ void Logcat::EnsureLogWatchDog() {
constexpr static size_t kErr = -1;
std::thread watch_dog([this] {
while (true) {
enable_watchdog.wait(false);
auto logd_size = GetByteProp(kLogdSizeProp);
auto logd_tag = GetStrProp(kLogdTagProp);
auto logd_main_size = GetByteProp(kLogdMainSizeProp);
Expand All @@ -277,8 +286,9 @@ void Logcat::EnsureLogWatchDog() {
}, &serial);
}
if (!__system_property_wait(pi, serial, &serial, nullptr)) break;
if (pi != nullptr) Log("\nResetting log settings\n");
else std::this_thread::sleep_for(1s);
if (pi != nullptr) {
if (enable_watchdog) Log("\nResetting log settings\n");
} else std::this_thread::sleep_for(1s);
// log tag prop was not found; to avoid frequently trigger wait, sleep for a while
}
});
Expand Down
Loading