mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2025-03-07 13:45:55 -05:00
21.0: Initial bringup
TODO: - f/w/b - settings Signed-off-by: Tavi <tavi@divested.dev>
This commit is contained in:
parent
ce0dac994c
commit
d98f33a337
104
Manifests/Manifest_LAOS-21.0.xml
Normal file
104
Manifests/Manifest_LAOS-21.0.xml
Normal file
@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest>
|
||||
|
||||
<remote name="gitlab" fetch="https://gitlab.com/" />
|
||||
|
||||
<!-- START OF UNNECESSARY REPO REMOVAL -->
|
||||
<remove-project name="LineageOS/android_external_ant-wireless_ant_native" />
|
||||
<remove-project name="LineageOS/android_external_ant-wireless_ant_service" />
|
||||
<remove-project name="LineageOS/android_external_bash" />
|
||||
<remove-project name="LineageOS/android_external_htop" />
|
||||
<remove-project name="LineageOS/android_external_libncurses" />
|
||||
<remove-project name="LineageOS/android_external_nano" />
|
||||
<remove-project name="LineageOS/android_external_openssh" />
|
||||
<remove-project name="LineageOS/android_external_rsync" />
|
||||
<remove-project name="LineageOS/android_external_unrar" />
|
||||
<remove-project name="LineageOS/android_external_vim" />
|
||||
<remove-project name="LineageOS/android_packages_apps_Eleven" />
|
||||
<remove-project name="LineageOS/android_packages_apps_Jelly" />
|
||||
<!--<remove-project name="LineageOS/android_packages_apps_Stk" />-->
|
||||
<remove-project name="LineageOS/charter" />
|
||||
<remove-project name="LineageOS/cm_crowdin" />
|
||||
<remove-project name="LineageOS/contributors-cloud-generator" />
|
||||
<remove-project name="LineageOS/hudson" />
|
||||
<remove-project name="LineageOS/lineage_wiki" />
|
||||
<remove-project name="LineageOS/mirror" />
|
||||
<remove-project name="LineageOS/www" />
|
||||
<remove-project name="platform/packages/apps/Browser2" />
|
||||
<remove-project name="platform/packages/apps/Music" />
|
||||
<remove-project name="platform/packages/apps/MusicFX" />
|
||||
<remove-project name="platform/packages/apps/QuickSearchBox" />
|
||||
<remove-project name="platform/packages/apps/SampleLocationAttribution" />
|
||||
<!--<remove-project name="platform/packages/modules/AdServices" />-->
|
||||
<remove-project name="platform/prebuilts/clang/host/darwin-x86" />
|
||||
<remove-project name="platform/prebuilts/go/darwin-x86" />
|
||||
<!-- END OF UNNECESSARY REPO REMOVAL -->
|
||||
|
||||
<!-- START OF BRANCH SWITCHING -->
|
||||
<!--<remove-project name="platform/external/swiftshader" />
|
||||
<project path="external/swiftshader" name="google/swiftshader" remote="github" revision="master" />-->
|
||||
|
||||
<!-- Switch to the Mulch WebView -->
|
||||
<remove-project name="LineageOS/android_external_chromium-webview_patches" />
|
||||
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_arm" />
|
||||
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_arm64" />
|
||||
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_x86" />
|
||||
<remove-project name="LineageOS/android_external_chromium-webview_prebuilt_x86_64" />
|
||||
<project path="external/chromium-webview" name="divested-mobile/mulch" groups="pdk" clone-depth="1" remote="gitlab" revision="master" />
|
||||
<!-- END OF BRANCH SWITCHING -->
|
||||
|
||||
<!-- START OF ADDITIONAL REPOS -->
|
||||
<!-- GrapheneOS -->
|
||||
<project path="external/hardened_malloc" name="GrapheneOS/hardened_malloc" remote="github" revision="749640c274d54e084505a24fa758bcb5f96a25ef" />
|
||||
<!-- END OF ADDITIONAL REPOS -->
|
||||
|
||||
<!-- START OF DEVICE REPOS -->
|
||||
<!-- Common -->
|
||||
<project path="system/qcom" name="LineageOS/android_system_qcom" remote="github" revision="lineage-21" />
|
||||
<project path="external/bson" name="LineageOS/android_external_bson" remote="github" revision="lineage-21" />
|
||||
<project path="hardware/sony/macaddrsetup" name="LineageOS/android_hardware_sony_macaddrsetup" remote="github" revision="lineage-21" />
|
||||
<project path="hardware/sony/simdetect" name="LineageOS/android_hardware_sony_simdetect" remote="github" revision="lineage-21" />
|
||||
<project path="hardware/sony/SonyOpenTelephony" name="LineageOS/android_hardware_sony_SonyOpenTelephony" remote="github" revision="lineage-21" />
|
||||
<project path="hardware/sony/timekeep" remote="github" name="LineageOS/android_hardware_sony_timekeep" revision="lineage-21" />
|
||||
<project path="packages/apps/ElmyraService" name="LineageOS/android_packages_apps_ElmyraService" remote="github" />
|
||||
|
||||
<!-- Google Pixel 6 (oriole/raven) -->
|
||||
<project path="device/google/oriole" name="LineageOS/android_device_google_oriole" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/raven" name="LineageOS/android_device_google_raven" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/raviole" name="LineageOS/android_device_google_raviole" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/gs101" name="LineageOS/android_device_google_gs101" remote="github" revision="lineage-21" />
|
||||
|
||||
<!-- Google Pixel 6a (bluejay) -->
|
||||
<project path="device/google/bluejay" name="LineageOS/android_device_google_bluejay" remote="github" revision="lineage-21" />
|
||||
<!-- uses gs101 commons -->
|
||||
|
||||
<!-- Google Pixel 7 (panther/cheetah) -->
|
||||
<project path="device/google/panther" name="LineageOS/android_device_google_panther" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/cheetah" name="LineageOS/android_device_google_cheetah" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/pantah" name="LineageOS/android_device_google_pantah" remote="github" revision="lineage-21" />
|
||||
<project path="device/google/gs201" name="LineageOS/android_device_google_gs201" remote="github" revision="lineage-21" />
|
||||
<project path="kernel/google/gs201/private/gs-google" name="LineageOS/android_kernel_google_gs201" remote="github" revision="lineage-21" />
|
||||
<!-- uses gs101 commons -->
|
||||
|
||||
<!-- Google Pixel 7a (lynx) -->
|
||||
<project path="device/google/lynx" name="LineageOS/android_device_google_lynx" remote="github" revision="lineage-21" />
|
||||
<!-- uses gs101 commons -->
|
||||
|
||||
<!-- Google Pixel Tablet (tangorpro) -->
|
||||
<project path="device/google/tangorpro" name="LineageOS/android_device_google_tangorpro" remote="github" revision="lineage-21" />
|
||||
<!-- uses gs101 commons -->
|
||||
|
||||
<!-- Google Pixel Fold (felix) -->
|
||||
<project path="device/google/felix" name="LineageOS/android_device_google_felix" remote="github" revision="lineage-21" />
|
||||
<!-- uses gs101 commons -->
|
||||
|
||||
<!-- Proprietary Blobs -->
|
||||
<project path="vendor/google/bluejay" name="[COLOUR IN THE LINES]/proprietary_vendor_google_bluejay" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/cheetah" name="[COLOUR IN THE LINES]/proprietary_vendor_google_cheetah" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/felix" name="[COLOUR IN THE LINES]/proprietary_vendor_google_felix" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/lynx" name="[COLOUR IN THE LINES]/proprietary_vendor_google_lynx" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/oriole" name="[COLOUR IN THE LINES]/proprietary_vendor_google_oriole" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/panther" name="[COLOUR IN THE LINES]/proprietary_vendor_google_panther" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/raven" name="[COLOUR IN THE LINES]/proprietary_vendor_google_raven" remote="github" revision="lineage-21" />
|
||||
<project path="vendor/google/tangorpro" name="[COLOUR IN THE LINES]/proprietary_vendor_google_tangorpro" remote="github" revision="lineage-21" />
|
||||
</manifest>
|
@ -0,0 +1,539 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <daniel.micay@grapheneos.org>
|
||||
Date: Thu, 5 Oct 2023 08:27:35 -0400
|
||||
Subject: [PATCH] constify JNINativeMethod tables
|
||||
|
||||
---
|
||||
benchmark/micro-native/micro_native.cc | 8 ++++----
|
||||
runtime/native/dalvik_system_BaseDexClassLoader.cc | 2 +-
|
||||
runtime/native/dalvik_system_DexFile.cc | 2 +-
|
||||
runtime/native/dalvik_system_VMDebug.cc | 2 +-
|
||||
runtime/native/dalvik_system_VMRuntime.cc | 2 +-
|
||||
runtime/native/dalvik_system_VMStack.cc | 2 +-
|
||||
runtime/native/dalvik_system_ZygoteHooks.cc | 2 +-
|
||||
runtime/native/java_lang_Class.cc | 2 +-
|
||||
runtime/native/java_lang_Object.cc | 2 +-
|
||||
runtime/native/java_lang_StackStreamFactory.cc | 2 +-
|
||||
runtime/native/java_lang_String.cc | 2 +-
|
||||
runtime/native/java_lang_StringFactory.cc | 2 +-
|
||||
runtime/native/java_lang_System.cc | 2 +-
|
||||
runtime/native/java_lang_Thread.cc | 2 +-
|
||||
runtime/native/java_lang_Throwable.cc | 2 +-
|
||||
runtime/native/java_lang_VMClassLoader.cc | 2 +-
|
||||
runtime/native/java_lang_invoke_MethodHandle.cc | 2 +-
|
||||
runtime/native/java_lang_invoke_MethodHandleImpl.cc | 2 +-
|
||||
runtime/native/java_lang_ref_FinalizerReference.cc | 2 +-
|
||||
runtime/native/java_lang_ref_Reference.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Array.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Constructor.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Executable.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Field.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Method.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Parameter.cc | 2 +-
|
||||
runtime/native/java_lang_reflect_Proxy.cc | 2 +-
|
||||
runtime/native/java_util_concurrent_atomic_AtomicLong.cc | 2 +-
|
||||
runtime/native/jdk_internal_misc_Unsafe.cc | 2 +-
|
||||
runtime/native/libcore_io_Memory.cc | 2 +-
|
||||
runtime/native/libcore_util_CharsetUtils.cc | 2 +-
|
||||
.../native/org_apache_harmony_dalvik_ddmc_DdmServer.cc | 2 +-
|
||||
.../org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc | 2 +-
|
||||
runtime/native/sun_misc_Unsafe.cc | 2 +-
|
||||
test/004-JniTest/jni_test.cc | 2 +-
|
||||
test/139-register-natives/regnative.cc | 2 +-
|
||||
36 files changed, 39 insertions(+), 39 deletions(-)
|
||||
|
||||
diff --git a/benchmark/micro-native/micro_native.cc b/benchmark/micro-native/micro_native.cc
|
||||
index dffbf3b11d..e70366cc48 100644
|
||||
--- a/benchmark/micro-native/micro_native.cc
|
||||
+++ b/benchmark/micro-native/micro_native.cc
|
||||
@@ -38,7 +38,7 @@
|
||||
static void NativeMethods_emptyJniStaticSynchronizedMethod0(JNIEnv*, jclass) { }
|
||||
static void NativeMethods_emptyJniSynchronizedMethod0(JNIEnv*, jclass) { }
|
||||
|
||||
-static JNINativeMethod gMethods_NormalOnly[] = {
|
||||
+static const JNINativeMethod gMethods_NormalOnly[] = {
|
||||
NATIVE_METHOD(NativeMethods, emptyJniStaticSynchronizedMethod0, "()V"),
|
||||
NATIVE_METHOD(NativeMethods, emptyJniSynchronizedMethod0, "()V"),
|
||||
};
|
||||
@@ -53,7 +53,7 @@ static void NativeMethods_emptyJniStaticMethod6L(JNIEnv*, jclass, jobject, jarra
|
||||
static void NativeMethods_emptyJniStaticMethod0(JNIEnv*, jclass) { }
|
||||
static void NativeMethods_emptyJniStaticMethod6(JNIEnv*, jclass, int, int, int, int, int, int) { }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod0, "()V"),
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod6, "(IIIIII)V"),
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod6L, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
|
||||
@@ -72,7 +72,7 @@ static void NativeMethods_emptyJniStaticMethod6L_Fast(JNIEnv*, jclass, jobject,
|
||||
static void NativeMethods_emptyJniStaticMethod0_Fast(JNIEnv*, jclass) { }
|
||||
static void NativeMethods_emptyJniStaticMethod6_Fast(JNIEnv*, jclass, int, int, int, int, int, int) { }
|
||||
|
||||
-static JNINativeMethod gMethods_Fast[] = {
|
||||
+static const JNINativeMethod gMethods_Fast[] = {
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod0_Fast, "()V"),
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod6_Fast, "(IIIIII)V"),
|
||||
NATIVE_METHOD(NativeMethods, emptyJniMethod6L_Fast, "(Ljava/lang/String;[Ljava/lang/String;[[ILjava/lang/Object;[Ljava/lang/Object;[[[[Ljava/lang/Object;)V"),
|
||||
@@ -88,7 +88,7 @@ DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod0_1Critical)() { }
|
||||
DEFINE_NORMAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(JNIEnv*, jclass, int, int, int, int, int, int) { }
|
||||
DEFINE_CRITICAL_JNI_METHOD(void, emptyJniStaticMethod6_1Critical)(int, int, int, int, int, int) { }
|
||||
|
||||
-static JNINativeMethod gMethods_Critical[] = {
|
||||
+static const JNINativeMethod gMethods_Critical[] = {
|
||||
// Don't use NATIVE_METHOD because the name is mangled differently.
|
||||
{ "emptyJniStaticMethod0_Critical", "()V",
|
||||
reinterpret_cast<void*>(NAME_CRITICAL_JNI_METHOD(emptyJniStaticMethod0_1Critical)) },
|
||||
diff --git a/runtime/native/dalvik_system_BaseDexClassLoader.cc b/runtime/native/dalvik_system_BaseDexClassLoader.cc
|
||||
index a4f702c28d..01ea613b1c 100644
|
||||
--- a/runtime/native/dalvik_system_BaseDexClassLoader.cc
|
||||
+++ b/runtime/native/dalvik_system_BaseDexClassLoader.cc
|
||||
@@ -69,7 +69,7 @@ static jobjectArray BaseDexClassLoader_computeClassLoaderContextsNative(JNIEnv*
|
||||
return soa.AddLocalReference<jobjectArray>(array.Get());
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(BaseDexClassLoader, computeClassLoaderContextsNative,
|
||||
"()[Ljava/lang/String;"),
|
||||
};
|
||||
diff --git a/runtime/native/dalvik_system_DexFile.cc b/runtime/native/dalvik_system_DexFile.cc
|
||||
index f602f73630..8539ed8082 100644
|
||||
--- a/runtime/native/dalvik_system_DexFile.cc
|
||||
+++ b/runtime/native/dalvik_system_DexFile.cc
|
||||
@@ -994,7 +994,7 @@ static void DexFile_setTrusted(JNIEnv* env, jclass, jobject j_cookie) {
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(DexFile, closeDexFile, "(Ljava/lang/Object;)Z"),
|
||||
NATIVE_METHOD(DexFile,
|
||||
defineClassNative,
|
||||
diff --git a/runtime/native/dalvik_system_VMDebug.cc b/runtime/native/dalvik_system_VMDebug.cc
|
||||
index cf2b25d6a2..d6fdb84873 100644
|
||||
--- a/runtime/native/dalvik_system_VMDebug.cc
|
||||
+++ b/runtime/native/dalvik_system_VMDebug.cc
|
||||
@@ -514,7 +514,7 @@ static void VMDebug_setAllocTrackerStackDepth(JNIEnv* env, jclass, jint stack_de
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(VMDebug, countInstancesOfClass, "(Ljava/lang/Class;Z)J"),
|
||||
NATIVE_METHOD(VMDebug, countInstancesOfClasses, "([Ljava/lang/Class;Z)[J"),
|
||||
NATIVE_METHOD(VMDebug, dumpHprofData, "(Ljava/lang/String;I)V"),
|
||||
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
|
||||
index f1561a2530..a1de2b5936 100644
|
||||
--- a/runtime/native/dalvik_system_VMRuntime.cc
|
||||
+++ b/runtime/native/dalvik_system_VMRuntime.cc
|
||||
@@ -536,7 +536,7 @@ static jobject VMRuntime_getBaseApkOptimizationInfo(JNIEnv* env, [[maybe_unused]
|
||||
return env->NewObject(cls.get(), ctor, j_compiler_filter.get(), j_compilation_reason.get());
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(VMRuntime, addressOf, "(Ljava/lang/Object;)J"),
|
||||
NATIVE_METHOD(VMRuntime, bootClassPath, "()Ljava/lang/String;"),
|
||||
NATIVE_METHOD(VMRuntime, clampGrowthLimit, "()V"),
|
||||
diff --git a/runtime/native/dalvik_system_VMStack.cc b/runtime/native/dalvik_system_VMStack.cc
|
||||
index 71078c9ad2..457d3887df 100644
|
||||
--- a/runtime/native/dalvik_system_VMStack.cc
|
||||
+++ b/runtime/native/dalvik_system_VMStack.cc
|
||||
@@ -168,7 +168,7 @@ static jobjectArray VMStack_getAnnotatedThreadStackTrace(JNIEnv* env, jclass, jo
|
||||
return GetThreadStack(soa, javaThread, fn);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(VMStack, fillStackTraceElements, "(Ljava/lang/Thread;[Ljava/lang/StackTraceElement;)I"),
|
||||
FAST_NATIVE_METHOD(VMStack, getCallingClassLoader, "()Ljava/lang/ClassLoader;"),
|
||||
FAST_NATIVE_METHOD(VMStack, getClosestUserClassLoader, "()Ljava/lang/ClassLoader;"),
|
||||
diff --git a/runtime/native/dalvik_system_ZygoteHooks.cc b/runtime/native/dalvik_system_ZygoteHooks.cc
|
||||
index dd44e2ec4b..22e35360a3 100644
|
||||
--- a/runtime/native/dalvik_system_ZygoteHooks.cc
|
||||
+++ b/runtime/native/dalvik_system_ZygoteHooks.cc
|
||||
@@ -466,7 +466,7 @@ static jboolean ZygoteHooks_nativeZygoteLongSuspendOk([[maybe_unused]] JNIEnv* e
|
||||
return (isJitZygote || explicitlyDisabled) ? JNI_FALSE : JNI_TRUE;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ZygoteHooks, nativePreFork, "()J"),
|
||||
NATIVE_METHOD(ZygoteHooks, nativePostZygoteFork, "()V"),
|
||||
NATIVE_METHOD(ZygoteHooks, nativePostForkSystemServer, "(I)V"),
|
||||
diff --git a/runtime/native/java_lang_Class.cc b/runtime/native/java_lang_Class.cc
|
||||
index 2abc4935e0..2abe4545a6 100644
|
||||
--- a/runtime/native/java_lang_Class.cc
|
||||
+++ b/runtime/native/java_lang_Class.cc
|
||||
@@ -971,7 +971,7 @@ static jobject Class_newInstance(JNIEnv* env, jobject javaThis) {
|
||||
return soa.AddLocalReference<jobject>(receiver.Get());
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Class, classForName,
|
||||
"(Ljava/lang/String;ZLjava/lang/ClassLoader;)Ljava/lang/Class;"),
|
||||
FAST_NATIVE_METHOD(Class, ensureExtDataPresent, "()Ldalvik/system/ClassExt;"),
|
||||
diff --git a/runtime/native/java_lang_Object.cc b/runtime/native/java_lang_Object.cc
|
||||
index 8fc10d1114..8740755199 100644
|
||||
--- a/runtime/native/java_lang_Object.cc
|
||||
+++ b/runtime/native/java_lang_Object.cc
|
||||
@@ -54,7 +54,7 @@ static jint Object_identityHashCodeNative(JNIEnv* env, jclass, jobject javaObjec
|
||||
return static_cast<jint>(o->IdentityHashCode());
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Object, internalClone, "()Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Object, notify, "()V"),
|
||||
FAST_NATIVE_METHOD(Object, notifyAll, "()V"),
|
||||
diff --git a/runtime/native/java_lang_StackStreamFactory.cc b/runtime/native/java_lang_StackStreamFactory.cc
|
||||
index f876c1014b..f62670350f 100644
|
||||
--- a/runtime/native/java_lang_StackStreamFactory.cc
|
||||
+++ b/runtime/native/java_lang_StackStreamFactory.cc
|
||||
@@ -41,7 +41,7 @@ static jint StackStreamFactory_nativeFetchStackFrameInfo(JNIEnv* env, jclass,
|
||||
startLevel, batchSize, startBufferIndex, frameBuffer);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(StackStreamFactory, nativeGetStackAnchor, "()Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(StackStreamFactory, nativeFetchStackFrameInfo, "(JLjava/lang/Object;III[Ljava/lang/Object;)I"),
|
||||
};
|
||||
diff --git a/runtime/native/java_lang_String.cc b/runtime/native/java_lang_String.cc
|
||||
index f70a188e79..e982c4e3c9 100644
|
||||
--- a/runtime/native/java_lang_String.cc
|
||||
+++ b/runtime/native/java_lang_String.cc
|
||||
@@ -133,7 +133,7 @@ static jstring String_doRepeat(JNIEnv* env, jobject java_this, jint count) {
|
||||
return soa.AddLocalReference<jstring>(result);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(String, charAt, "(I)C"),
|
||||
FAST_NATIVE_METHOD(String, compareTo, "(Ljava/lang/String;)I"),
|
||||
FAST_NATIVE_METHOD(String, concat, "(Ljava/lang/String;)Ljava/lang/String;"),
|
||||
diff --git a/runtime/native/java_lang_StringFactory.cc b/runtime/native/java_lang_StringFactory.cc
|
||||
index 2fbebc0941..62f3fcd566 100644
|
||||
--- a/runtime/native/java_lang_StringFactory.cc
|
||||
+++ b/runtime/native/java_lang_StringFactory.cc
|
||||
@@ -294,7 +294,7 @@ static jstring StringFactory_newStringFromUtf8Bytes(JNIEnv* env, jclass, jbyteAr
|
||||
return soa.AddLocalReference<jstring>(result);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(StringFactory, newStringFromBytes, "([BIII)Ljava/lang/String;"),
|
||||
FAST_NATIVE_METHOD(StringFactory, newStringFromChars, "(II[C)Ljava/lang/String;"),
|
||||
FAST_NATIVE_METHOD(StringFactory, newStringFromString, "(Ljava/lang/String;)Ljava/lang/String;"),
|
||||
diff --git a/runtime/native/java_lang_System.cc b/runtime/native/java_lang_System.cc
|
||||
index 63cbd2c815..e7b3894aad 100644
|
||||
--- a/runtime/native/java_lang_System.cc
|
||||
+++ b/runtime/native/java_lang_System.cc
|
||||
@@ -239,7 +239,7 @@ static void System_arraycopyBooleanUnchecked(JNIEnv* env,
|
||||
javaDst, dstPos, count);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(System, arraycopy, "(Ljava/lang/Object;ILjava/lang/Object;II)V"),
|
||||
FAST_NATIVE_METHOD(System, arraycopyCharUnchecked, "([CI[CII)V"),
|
||||
FAST_NATIVE_METHOD(System, arraycopyByteUnchecked, "([BI[BII)V"),
|
||||
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc
|
||||
index 570c554782..f90db08a8d 100644
|
||||
--- a/runtime/native/java_lang_Thread.cc
|
||||
+++ b/runtime/native/java_lang_Thread.cc
|
||||
@@ -195,7 +195,7 @@ static void Thread_yield(JNIEnv*, jobject) {
|
||||
sched_yield();
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Thread, currentThread, "()Ljava/lang/Thread;"),
|
||||
FAST_NATIVE_METHOD(Thread, interrupted, "()Z"),
|
||||
FAST_NATIVE_METHOD(Thread, isInterrupted, "()Z"),
|
||||
diff --git a/runtime/native/java_lang_Throwable.cc b/runtime/native/java_lang_Throwable.cc
|
||||
index b89e287481..5cdd70c513 100644
|
||||
--- a/runtime/native/java_lang_Throwable.cc
|
||||
+++ b/runtime/native/java_lang_Throwable.cc
|
||||
@@ -38,7 +38,7 @@ static jobjectArray Throwable_nativeGetStackTrace(JNIEnv* env, jclass, jobject j
|
||||
return Thread::InternalStackTraceToStackTraceElementArray(soa, javaStackState);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Throwable, nativeFillInStackTrace, "()Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Throwable, nativeGetStackTrace, "(Ljava/lang/Object;)[Ljava/lang/StackTraceElement;"),
|
||||
};
|
||||
diff --git a/runtime/native/java_lang_VMClassLoader.cc b/runtime/native/java_lang_VMClassLoader.cc
|
||||
index 4dad46fb8c..3208a65c8e 100644
|
||||
--- a/runtime/native/java_lang_VMClassLoader.cc
|
||||
+++ b/runtime/native/java_lang_VMClassLoader.cc
|
||||
@@ -164,7 +164,7 @@ static jobjectArray VMClassLoader_getBootClassPathEntries(JNIEnv* env, jclass) {
|
||||
MakeTransformRange(Filter(path, dchecked_is_base_dex), get_location)));
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(VMClassLoader, findLoadedClass, "(Ljava/lang/ClassLoader;Ljava/lang/String;)Ljava/lang/Class;"),
|
||||
NATIVE_METHOD(VMClassLoader, getBootClassPathEntries, "()[Ljava/lang/String;"),
|
||||
};
|
||||
diff --git a/runtime/native/java_lang_invoke_MethodHandle.cc b/runtime/native/java_lang_invoke_MethodHandle.cc
|
||||
index 5309a28a09..ed2d5ae126 100644
|
||||
--- a/runtime/native/java_lang_invoke_MethodHandle.cc
|
||||
+++ b/runtime/native/java_lang_invoke_MethodHandle.cc
|
||||
@@ -37,7 +37,7 @@ static void MethodHandle_invokeExactWithFrame(JNIEnv* env, jobject thiz, jobject
|
||||
MethodHandleInvokeExactWithFrame(soa.Self(), handle, frame);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(MethodHandle, invokeExactWithFrame, "(Ldalvik/system/EmulatedStackFrame;)V")
|
||||
};
|
||||
|
||||
diff --git a/runtime/native/java_lang_invoke_MethodHandleImpl.cc b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
|
||||
index 00ce01f11a..fc53b82d36 100644
|
||||
--- a/runtime/native/java_lang_invoke_MethodHandleImpl.cc
|
||||
+++ b/runtime/native/java_lang_invoke_MethodHandleImpl.cc
|
||||
@@ -63,7 +63,7 @@ static jobject MethodHandleImpl_getMemberInternal(JNIEnv* env, jobject thiz) {
|
||||
return soa.AddLocalReference<jobject>(h_object.Get());
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(MethodHandleImpl, getMemberInternal, "()Ljava/lang/reflect/Member;"),
|
||||
};
|
||||
|
||||
diff --git a/runtime/native/java_lang_ref_FinalizerReference.cc b/runtime/native/java_lang_ref_FinalizerReference.cc
|
||||
index 535b243411..0a8dfb6c09 100644
|
||||
--- a/runtime/native/java_lang_ref_FinalizerReference.cc
|
||||
+++ b/runtime/native/java_lang_ref_FinalizerReference.cc
|
||||
@@ -42,7 +42,7 @@ static jobject FinalizerReference_getReferent(JNIEnv* env, jobject javaThis) {
|
||||
return soa.AddLocalReference<jobject>(referent);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(FinalizerReference, makeCircularListIfUnenqueued, "()Z"),
|
||||
FAST_NATIVE_METHOD(FinalizerReference, getReferent, "()Ljava/lang/Object;"),
|
||||
};
|
||||
diff --git a/runtime/native/java_lang_ref_Reference.cc b/runtime/native/java_lang_ref_Reference.cc
|
||||
index bd7235e14f..c2ee0f4c22 100644
|
||||
--- a/runtime/native/java_lang_ref_Reference.cc
|
||||
+++ b/runtime/native/java_lang_ref_Reference.cc
|
||||
@@ -76,7 +76,7 @@ static void Reference_clearReferent(JNIEnv* env, jobject javaThis) {
|
||||
Runtime::Current()->GetHeap()->GetReferenceProcessor()->ClearReferent(ref);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Reference, getReferent, "()Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Reference, clearReferent, "()V"),
|
||||
FAST_NATIVE_METHOD(Reference, refersTo0, "(Ljava/lang/Object;)Z"),
|
||||
diff --git a/runtime/native/java_lang_reflect_Array.cc b/runtime/native/java_lang_reflect_Array.cc
|
||||
index ff94593cdf..e359e7d8a8 100644
|
||||
--- a/runtime/native/java_lang_reflect_Array.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Array.cc
|
||||
@@ -74,7 +74,7 @@ static jobject Array_createObjectArray(JNIEnv* env, jclass, jclass javaElementCl
|
||||
return soa.AddLocalReference<jobject>(new_array);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Array, createMultiArray, "(Ljava/lang/Class;[I)Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Array, createObjectArray, "(Ljava/lang/Class;I)Ljava/lang/Object;"),
|
||||
};
|
||||
diff --git a/runtime/native/java_lang_reflect_Constructor.cc b/runtime/native/java_lang_reflect_Constructor.cc
|
||||
index 98afddc260..5f8196a4e5 100644
|
||||
--- a/runtime/native/java_lang_reflect_Constructor.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Constructor.cc
|
||||
@@ -129,7 +129,7 @@ static jobject Constructor_newInstanceFromSerialization(JNIEnv* env,
|
||||
return env->NewObject(allocClass, ctor);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Constructor, getExceptionTypes, "()[Ljava/lang/Class;"),
|
||||
FAST_NATIVE_METHOD(Constructor, newInstance0, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Constructor, newInstanceFromSerialization, "(Ljava/lang/Class;Ljava/lang/Class;)Ljava/lang/Object;"),
|
||||
diff --git a/runtime/native/java_lang_reflect_Executable.cc b/runtime/native/java_lang_reflect_Executable.cc
|
||||
index 87c9f6c341..db54200ef0 100644
|
||||
--- a/runtime/native/java_lang_reflect_Executable.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Executable.cc
|
||||
@@ -363,7 +363,7 @@ static jint Executable_getParameterCountInternal(JNIEnv* env, jobject javaMethod
|
||||
}
|
||||
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Executable, compareMethodParametersInternal,
|
||||
"(Ljava/lang/reflect/Method;)I"),
|
||||
FAST_NATIVE_METHOD(Executable, getAnnotationNative,
|
||||
diff --git a/runtime/native/java_lang_reflect_Field.cc b/runtime/native/java_lang_reflect_Field.cc
|
||||
index f2603d4c48..e1b91c6de2 100644
|
||||
--- a/runtime/native/java_lang_reflect_Field.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Field.cc
|
||||
@@ -549,7 +549,7 @@ static jboolean Field_isAnnotationPresentNative(JNIEnv* env,
|
||||
return annotations::IsFieldAnnotationPresent(field, klass);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Field, get, "(Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Field, getBoolean, "(Ljava/lang/Object;)Z"),
|
||||
FAST_NATIVE_METHOD(Field, getByte, "(Ljava/lang/Object;)B"),
|
||||
diff --git a/runtime/native/java_lang_reflect_Method.cc b/runtime/native/java_lang_reflect_Method.cc
|
||||
index 5f02ad0fd9..e2440d3dc8 100644
|
||||
--- a/runtime/native/java_lang_reflect_Method.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Method.cc
|
||||
@@ -86,7 +86,7 @@ static jobject Method_invoke(JNIEnv* env, jobject javaMethod, jobject javaReceiv
|
||||
return InvokeMethod<kRuntimePointerSize>(soa, javaMethod, javaReceiver, javaArgs);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Method, getDefaultValue, "()Ljava/lang/Object;"),
|
||||
FAST_NATIVE_METHOD(Method, getExceptionTypes, "()[Ljava/lang/Class;"),
|
||||
FAST_NATIVE_METHOD(Method, invoke, "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
diff --git a/runtime/native/java_lang_reflect_Parameter.cc b/runtime/native/java_lang_reflect_Parameter.cc
|
||||
index 263a56796f..92bf9078a4 100644
|
||||
--- a/runtime/native/java_lang_reflect_Parameter.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Parameter.cc
|
||||
@@ -98,7 +98,7 @@ static jobject Parameter_getAnnotationNative(JNIEnv* env,
|
||||
annotations::GetAnnotationForMethodParameter(method, parameterIndex, klass));
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(
|
||||
Parameter,
|
||||
getAnnotationNative,
|
||||
diff --git a/runtime/native/java_lang_reflect_Proxy.cc b/runtime/native/java_lang_reflect_Proxy.cc
|
||||
index f723ed223d..c2b533de5d 100644
|
||||
--- a/runtime/native/java_lang_reflect_Proxy.cc
|
||||
+++ b/runtime/native/java_lang_reflect_Proxy.cc
|
||||
@@ -37,7 +37,7 @@ static jclass Proxy_generateProxy(JNIEnv* env, jclass, jstring name, jobjectArra
|
||||
soa, name, interfaces, loader, methods, throws));
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Proxy, generateProxy, "(Ljava/lang/String;[Ljava/lang/Class;Ljava/lang/ClassLoader;[Ljava/lang/reflect/Method;[[Ljava/lang/Class;)Ljava/lang/Class;"),
|
||||
};
|
||||
|
||||
diff --git a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
|
||||
index fa288edcb8..299ac5a61d 100644
|
||||
--- a/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
|
||||
+++ b/runtime/native/java_util_concurrent_atomic_AtomicLong.cc
|
||||
@@ -30,7 +30,7 @@ static jboolean AtomicLong_VMSupportsCS8(JNIEnv*, jclass) {
|
||||
return QuasiAtomic::LongAtomicsUseMutexes(kRuntimeISA) ? JNI_FALSE : JNI_TRUE;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(AtomicLong, VMSupportsCS8, "()Z"),
|
||||
};
|
||||
|
||||
diff --git a/runtime/native/jdk_internal_misc_Unsafe.cc b/runtime/native/jdk_internal_misc_Unsafe.cc
|
||||
index 9b2021d176..c9de0a1862 100644
|
||||
--- a/runtime/native/jdk_internal_misc_Unsafe.cc
|
||||
+++ b/runtime/native/jdk_internal_misc_Unsafe.cc
|
||||
@@ -506,7 +506,7 @@ static void Unsafe_unpark(JNIEnv* env, jobject, jobject jthread) {
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Unsafe, compareAndSwapInt, "(Ljava/lang/Object;JII)Z"),
|
||||
FAST_NATIVE_METHOD(Unsafe, compareAndSwapLong, "(Ljava/lang/Object;JJJ)Z"),
|
||||
FAST_NATIVE_METHOD(
|
||||
diff --git a/runtime/native/libcore_io_Memory.cc b/runtime/native/libcore_io_Memory.cc
|
||||
index 5e38280259..8648ea3799 100644
|
||||
--- a/runtime/native/libcore_io_Memory.cc
|
||||
+++ b/runtime/native/libcore_io_Memory.cc
|
||||
@@ -181,7 +181,7 @@ static void Memory_peekShortArray(JNIEnv* env,
|
||||
}
|
||||
|
||||
// The remaining Memory methods are contained in libcore/luni/src/main/native/libcore_io_Memory.cpp
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Memory, peekByteArray, "(J[BII)V"),
|
||||
FAST_NATIVE_METHOD(Memory, peekCharArray, "(J[CIIZ)V"),
|
||||
FAST_NATIVE_METHOD(Memory, peekDoubleArray, "(J[DIIZ)V"),
|
||||
diff --git a/runtime/native/libcore_util_CharsetUtils.cc b/runtime/native/libcore_util_CharsetUtils.cc
|
||||
index 46f8993a10..0c053dfb28 100644
|
||||
--- a/runtime/native/libcore_util_CharsetUtils.cc
|
||||
+++ b/runtime/native/libcore_util_CharsetUtils.cc
|
||||
@@ -137,7 +137,7 @@ static jbyteArray CharsetUtils_toUtf8Bytes(JNIEnv* env, jclass, jstring java_str
|
||||
return soa.AddLocalReference<jbyteArray>(result);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(CharsetUtils, asciiBytesToChars, "([BII[C)V"),
|
||||
FAST_NATIVE_METHOD(CharsetUtils, toAsciiBytes, "(Ljava/lang/String;II)[B"),
|
||||
FAST_NATIVE_METHOD(CharsetUtils, toIsoLatin1Bytes, "(Ljava/lang/String;II)[B"),
|
||||
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
|
||||
index 419aed8578..ccbef4f3f4 100644
|
||||
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
|
||||
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmServer.cc
|
||||
@@ -38,7 +38,7 @@ static void DdmServer_nativeSendChunk(JNIEnv* env, jclass, jint type,
|
||||
Runtime::Current()->GetRuntimeCallbacks()->DdmPublishChunk(static_cast<uint32_t>(type), chunk);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(DdmServer, nativeSendChunk, "(I[BII)V"),
|
||||
};
|
||||
|
||||
diff --git a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
|
||||
index 081ec2043a..a84d522e23 100644
|
||||
--- a/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
|
||||
+++ b/runtime/native/org_apache_harmony_dalvik_ddmc_DdmVmInternal.cc
|
||||
@@ -211,7 +211,7 @@ static jbyteArray DdmVmInternal_getThreadStats(JNIEnv* env, jclass) {
|
||||
return result;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(DdmVmInternal, setRecentAllocationsTrackingEnabled, "(Z)V"),
|
||||
NATIVE_METHOD(DdmVmInternal, setThreadNotifyEnabled, "(Z)V"),
|
||||
NATIVE_METHOD(DdmVmInternal, getStackTraceById, "(I)[Ljava/lang/StackTraceElement;"),
|
||||
diff --git a/runtime/native/sun_misc_Unsafe.cc b/runtime/native/sun_misc_Unsafe.cc
|
||||
index f1e47ee100..d2f3a00897 100644
|
||||
--- a/runtime/native/sun_misc_Unsafe.cc
|
||||
+++ b/runtime/native/sun_misc_Unsafe.cc
|
||||
@@ -546,7 +546,7 @@ static void Unsafe_unpark(JNIEnv* env, jobject, jobject jthread) {
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Unsafe, compareAndSwapInt, "(Ljava/lang/Object;JII)Z"),
|
||||
FAST_NATIVE_METHOD(Unsafe, compareAndSwapLong, "(Ljava/lang/Object;JJJ)Z"),
|
||||
FAST_NATIVE_METHOD(Unsafe, compareAndSwapObject, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z"),
|
||||
diff --git a/test/004-JniTest/jni_test.cc b/test/004-JniTest/jni_test.cc
|
||||
index 429bd94fe0..1518f931ab 100644
|
||||
--- a/test/004-JniTest/jni_test.cc
|
||||
+++ b/test/004-JniTest/jni_test.cc
|
||||
@@ -33,7 +33,7 @@ static JavaVM* jvm = nullptr;
|
||||
static jint Java_Main_intFastNativeMethod(JNIEnv*, jclass, jint a, jint b, jint c);
|
||||
static jint Java_Main_intCriticalNativeMethod(jint a, jint b, jint c);
|
||||
|
||||
-static JNINativeMethod sMainMethods[] = {
|
||||
+static const JNINativeMethod sMainMethods[] = {
|
||||
{"intFastNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intFastNativeMethod) },
|
||||
{"intCriticalNativeMethod", "(III)I", reinterpret_cast<void*>(Java_Main_intCriticalNativeMethod) },
|
||||
};
|
||||
diff --git a/test/139-register-natives/regnative.cc b/test/139-register-natives/regnative.cc
|
||||
index d9c8b31ac7..083c14c1ec 100644
|
||||
--- a/test/139-register-natives/regnative.cc
|
||||
+++ b/test/139-register-natives/regnative.cc
|
||||
@@ -22,7 +22,7 @@ namespace art {
|
||||
static void foo(JNIEnv*, jclass) {
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "foo", "()V", reinterpret_cast<void*>(foo) }
|
||||
};
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Wed, 1 Nov 2023 21:27:18 +0200
|
||||
Subject: [PATCH] never enable GWP-ASan
|
||||
|
||||
It weakens hardened_malloc protections, especially when memory tagging is enabled.
|
||||
---
|
||||
libc/bionic/gwp_asan_wrappers.h | 7 -------
|
||||
libc/bionic/malloc_common.cpp | 8 --------
|
||||
libc/bionic/malloc_common_dynamic.cpp | 10 ----------
|
||||
3 files changed, 25 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/gwp_asan_wrappers.h b/libc/bionic/gwp_asan_wrappers.h
|
||||
index 219da9fc5..9053d4aa4 100644
|
||||
--- a/libc/bionic/gwp_asan_wrappers.h
|
||||
+++ b/libc/bionic/gwp_asan_wrappers.h
|
||||
@@ -35,13 +35,6 @@
|
||||
#include "private/bionic_globals.h"
|
||||
#include "private/bionic_malloc_dispatch.h"
|
||||
|
||||
-// Enable GWP-ASan, used by android_mallopt. Should always be called in a
|
||||
-// single-threaded context.
|
||||
-bool EnableGwpAsan(const android_mallopt_gwp_asan_options_t& options);
|
||||
-
|
||||
-// Hooks for libc to possibly install GWP-ASan.
|
||||
-bool MaybeInitGwpAsanFromLibc(libc_globals* globals);
|
||||
-
|
||||
// Returns whether GWP-ASan is the provided dispatch table pointer. Used in
|
||||
// heapprofd's signal-initialization sequence to determine the intermediate
|
||||
// dispatch pointer to use when initing.
|
||||
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
|
||||
index 1ab4861af..9363d7b63 100644
|
||||
--- a/libc/bionic/malloc_common.cpp
|
||||
+++ b/libc/bionic/malloc_common.cpp
|
||||
@@ -340,14 +340,6 @@ extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size) {
|
||||
if (opcode == M_SET_ALLOCATION_LIMIT_BYTES) {
|
||||
return LimitEnable(arg, arg_size);
|
||||
}
|
||||
- if (opcode == M_INITIALIZE_GWP_ASAN) {
|
||||
- if (arg == nullptr || arg_size != sizeof(android_mallopt_gwp_asan_options_t)) {
|
||||
- errno = EINVAL;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- return EnableGwpAsan(*reinterpret_cast<android_mallopt_gwp_asan_options_t*>(arg));
|
||||
- }
|
||||
if (opcode == M_MEMTAG_STACK_IS_ON) {
|
||||
if (arg == nullptr || arg_size != sizeof(bool)) {
|
||||
errno = EINVAL;
|
||||
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
|
||||
index 2cafe9249..84be92ee1 100644
|
||||
--- a/libc/bionic/malloc_common_dynamic.cpp
|
||||
+++ b/libc/bionic/malloc_common_dynamic.cpp
|
||||
@@ -383,8 +383,6 @@ static void MallocInitImpl(libc_globals* globals) {
|
||||
char prop[PROP_VALUE_MAX];
|
||||
char* options = prop;
|
||||
|
||||
- MaybeInitGwpAsanFromLibc(globals);
|
||||
-
|
||||
#if defined(USE_SCUDO)
|
||||
__libc_shared_globals()->scudo_stack_depot = __scudo_get_stack_depot_addr();
|
||||
__libc_shared_globals()->scudo_region_info = __scudo_get_region_info_addr();
|
||||
@@ -533,14 +531,6 @@ extern "C" bool android_mallopt(int opcode, void* arg, size_t arg_size) {
|
||||
}
|
||||
return FreeMallocLeakInfo(reinterpret_cast<android_mallopt_leak_info_t*>(arg));
|
||||
}
|
||||
- if (opcode == M_INITIALIZE_GWP_ASAN) {
|
||||
- if (arg == nullptr || arg_size != sizeof(android_mallopt_gwp_asan_options_t)) {
|
||||
- errno = EINVAL;
|
||||
- return false;
|
||||
- }
|
||||
-
|
||||
- return EnableGwpAsan(*reinterpret_cast<android_mallopt_gwp_asan_options_t*>(arg));
|
||||
- }
|
||||
if (opcode == M_MEMTAG_STACK_IS_ON) {
|
||||
if (arg == nullptr || arg_size != sizeof(bool)) {
|
||||
errno = EINVAL;
|
@ -0,0 +1,99 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Sun, 14 Aug 2022 15:13:01 +0300
|
||||
Subject: [PATCH] add a runtime option to disable hardened_malloc
|
||||
|
||||
---
|
||||
libc/bionic/malloc_common.cpp | 50 +++++++++++++++++++++++++++
|
||||
libc/bionic/malloc_common.h | 1 +
|
||||
libc/bionic/malloc_common_dynamic.cpp | 4 +++
|
||||
3 files changed, 55 insertions(+)
|
||||
|
||||
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
|
||||
index 3c4884b2c..86e6fdcf9 100644
|
||||
--- a/libc/bionic/malloc_common.cpp
|
||||
+++ b/libc/bionic/malloc_common.cpp
|
||||
@@ -393,6 +393,56 @@ static constexpr MallocDispatch __libc_malloc_default_dispatch __attribute__((un
|
||||
Malloc(malloc_info),
|
||||
};
|
||||
|
||||
+#if defined(BOTH_H_MALLOC_AND_SCUDO)
|
||||
+
|
||||
+#define ScudoMalloc(function) scudo_ ## function
|
||||
+
|
||||
+static constexpr MallocDispatch __scudo_malloc_dispatch __attribute__((unused)) = {
|
||||
+ ScudoMalloc(calloc),
|
||||
+ ScudoMalloc(free),
|
||||
+ ScudoMalloc(mallinfo),
|
||||
+ ScudoMalloc(malloc),
|
||||
+ ScudoMalloc(malloc_usable_size),
|
||||
+ ScudoMalloc(memalign),
|
||||
+ ScudoMalloc(posix_memalign),
|
||||
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
|
||||
+ ScudoMalloc(pvalloc),
|
||||
+#endif
|
||||
+ ScudoMalloc(realloc),
|
||||
+#if defined(HAVE_DEPRECATED_MALLOC_FUNCS)
|
||||
+ ScudoMalloc(valloc),
|
||||
+#endif
|
||||
+ ScudoMalloc(malloc_iterate),
|
||||
+ ScudoMalloc(malloc_disable),
|
||||
+ ScudoMalloc(malloc_enable),
|
||||
+ ScudoMalloc(mallopt),
|
||||
+ ScudoMalloc(aligned_alloc),
|
||||
+ ScudoMalloc(malloc_info),
|
||||
+};
|
||||
+
|
||||
+static const MallocDispatch* native_allocator_dispatch;
|
||||
+
|
||||
+void InitNativeAllocatorDispatch(libc_globals* globals) {
|
||||
+ const bool hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr;
|
||||
+
|
||||
+ const MallocDispatch* table = hardened_impl ?
|
||||
+ &__libc_malloc_default_dispatch :
|
||||
+ &__scudo_malloc_dispatch;
|
||||
+
|
||||
+ if (!hardened_impl) {
|
||||
+ globals->malloc_dispatch_table = __scudo_malloc_dispatch;
|
||||
+ globals->current_dispatch_table = &globals->malloc_dispatch_table;
|
||||
+ globals->default_dispatch_table = &globals->malloc_dispatch_table;
|
||||
+ }
|
||||
+
|
||||
+ native_allocator_dispatch = table;
|
||||
+}
|
||||
+
|
||||
+const MallocDispatch* NativeAllocatorDispatch() {
|
||||
+ return native_allocator_dispatch;
|
||||
+}
|
||||
+#else
|
||||
const MallocDispatch* NativeAllocatorDispatch() {
|
||||
return &__libc_malloc_default_dispatch;
|
||||
}
|
||||
+#endif
|
||||
diff --git a/libc/bionic/malloc_common.h b/libc/bionic/malloc_common.h
|
||||
index 8852c85a2..ef4b1a4be 100644
|
||||
--- a/libc/bionic/malloc_common.h
|
||||
+++ b/libc/bionic/malloc_common.h
|
||||
@@ -68,6 +68,7 @@ __END_DECLS
|
||||
|
||||
#if defined(USE_SCUDO)
|
||||
#include "scudo.h"
|
||||
+void InitNativeAllocatorDispatch(libc_globals* globals);
|
||||
#endif
|
||||
|
||||
#define BOTH_H_MALLOC_AND_SCUDO
|
||||
diff --git a/libc/bionic/malloc_common_dynamic.cpp b/libc/bionic/malloc_common_dynamic.cpp
|
||||
index a6bf7a7bb..2cafe9249 100644
|
||||
--- a/libc/bionic/malloc_common_dynamic.cpp
|
||||
+++ b/libc/bionic/malloc_common_dynamic.cpp
|
||||
@@ -376,6 +376,10 @@ extern "C" size_t __scudo_get_stack_depot_size();
|
||||
|
||||
// Initializes memory allocation framework once per process.
|
||||
static void MallocInitImpl(libc_globals* globals) {
|
||||
+#if defined(BOTH_H_MALLOC_AND_SCUDO)
|
||||
+ InitNativeAllocatorDispatch(globals);
|
||||
+#endif
|
||||
+
|
||||
char prop[PROP_VALUE_MAX];
|
||||
char* options = prop;
|
||||
|
@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 2 May 2023 16:45:26 +0300
|
||||
Subject: [PATCH] support assigning ID to path of current executable
|
||||
|
||||
---
|
||||
libc/bionic/libc_init_dynamic.cpp | 27 ++++++++++++++++++++++++++-
|
||||
libc/include/stdlib.h | 3 +++
|
||||
libc/libc.map.txt | 1 +
|
||||
libc/private/bionic_globals.h | 1 +
|
||||
4 files changed, 31 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
|
||||
index c61810e34..804e586e2 100644
|
||||
--- a/libc/bionic/libc_init_dynamic.cpp
|
||||
+++ b/libc/bionic/libc_init_dynamic.cpp
|
||||
@@ -72,6 +72,28 @@ extern "C" __attribute__((weak)) void __hwasan_library_unloaded(ElfW(Addr) base,
|
||||
const ElfW(Phdr)* phdr,
|
||||
ElfW(Half) phnum);
|
||||
|
||||
+static void init_prog_id(libc_globals* globals) {
|
||||
+ char exe_path[500];
|
||||
+ ssize_t readlink_res = readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1 /* space for NUL terminator */);
|
||||
+ if (readlink_res <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ exe_path[readlink_res] = '\0';
|
||||
+
|
||||
+ int prog_id = 0;
|
||||
+
|
||||
+#define IS(prog) (!strcmp(exe_path, prog))
|
||||
+
|
||||
+#undef IS
|
||||
+
|
||||
+ // libc_globals struct is write-protected
|
||||
+ globals->prog_id = prog_id;
|
||||
+}
|
||||
+
|
||||
+int get_prog_id() {
|
||||
+ return __libc_globals->prog_id;
|
||||
+}
|
||||
+
|
||||
// We need a helper function for __libc_preinit because compiling with LTO may
|
||||
// inline functions requiring a stack protector check, but __stack_chk_guard is
|
||||
// not initialized at the start of __libc_preinit. __libc_preinit_impl will run
|
||||
@@ -103,7 +125,10 @@ static void __libc_preinit_impl() {
|
||||
#endif
|
||||
|
||||
// Hooks for various libraries to let them know that we're starting up.
|
||||
- __libc_globals.mutate(__libc_init_malloc);
|
||||
+ __libc_globals.mutate([](libc_globals* globals) {
|
||||
+ init_prog_id(globals);
|
||||
+ __libc_init_malloc(globals);
|
||||
+ });
|
||||
|
||||
// Install reserved signal handlers for assisting the platform's profilers.
|
||||
__libc_init_profiling_handlers();
|
||||
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
|
||||
index 2830a493d..5ce8f9103 100644
|
||||
--- a/libc/include/stdlib.h
|
||||
+++ b/libc/include/stdlib.h
|
||||
@@ -210,6 +210,9 @@ long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, i
|
||||
// Implemented as static inlines before 26.
|
||||
#endif
|
||||
|
||||
+int get_prog_id();
|
||||
+#define is_prog(id) (get_prog_id() == id)
|
||||
+
|
||||
__END_DECLS
|
||||
|
||||
#include <android/legacy_stdlib_inlines.h>
|
||||
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
|
||||
index 156e9ee32..5d87cd8ef 100644
|
||||
--- a/libc/libc.map.txt
|
||||
+++ b/libc/libc.map.txt
|
||||
@@ -420,6 +420,7 @@ LIBC {
|
||||
get_nprocs; # introduced=23
|
||||
get_nprocs_conf; # introduced=23
|
||||
get_phys_pages; # introduced=23
|
||||
+ get_prog_id;
|
||||
getaddrinfo;
|
||||
getauxval; # introduced-arm=18 introduced-arm64=21 introduced-x86=18 introduced-x86_64=21
|
||||
getc;
|
||||
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
|
||||
index 8ea7d4d66..66f8d84b0 100644
|
||||
--- a/libc/private/bionic_globals.h
|
||||
+++ b/libc/private/bionic_globals.h
|
||||
@@ -65,6 +65,7 @@ struct libc_globals {
|
||||
// limit is enabled and some other hook is enabled at the same time.
|
||||
_Atomic(const MallocDispatch*) default_dispatch_table;
|
||||
MallocDispatch malloc_dispatch_table;
|
||||
+ int prog_id;
|
||||
};
|
||||
|
||||
struct memtag_dynamic_entries_t {
|
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 2 May 2023 16:46:56 +0300
|
||||
Subject: [PATCH] support disabling hardened_malloc for specific program IDs
|
||||
|
||||
---
|
||||
libc/bionic/malloc_common.cpp | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
|
||||
index 86e6fdcf9..3d3e8ef61 100644
|
||||
--- a/libc/bionic/malloc_common.cpp
|
||||
+++ b/libc/bionic/malloc_common.cpp
|
||||
@@ -423,7 +423,11 @@ static constexpr MallocDispatch __scudo_malloc_dispatch __attribute__((unused))
|
||||
static const MallocDispatch* native_allocator_dispatch;
|
||||
|
||||
void InitNativeAllocatorDispatch(libc_globals* globals) {
|
||||
- const bool hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr;
|
||||
+ bool hardened_impl = true;
|
||||
+ switch (get_prog_id()) {
|
||||
+ default:
|
||||
+ hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr;
|
||||
+ }
|
||||
|
||||
const MallocDispatch* table = hardened_impl ?
|
||||
&__libc_malloc_default_dispatch :
|
189
Patches/LineageOS-21.0/android_bionic/0001-HM-Use_HM.patch
Normal file
189
Patches/LineageOS-21.0/android_bionic/0001-HM-Use_HM.patch
Normal file
@ -0,0 +1,189 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 5 Dec 2018 08:51:56 +0200
|
||||
Subject: [PATCH] use Scudo on 32-bit and hardened_malloc on 64-bit
|
||||
|
||||
64-bit Scudo can be swithed to at runtime, see the next commit.
|
||||
|
||||
Squashed with 6562b94dfc6dec13e1df79a1b029e6c78f4aa9ad
|
||||
|
||||
Co-authored-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/Android.bp | 45 ++++++++++++++++++++++------
|
||||
libc/bionic/h_malloc_wrapper.cpp | 51 ++++++++++++++++++++++++++++++++
|
||||
libc/bionic/malloc_common.h | 25 +++++++++-------
|
||||
3 files changed, 102 insertions(+), 19 deletions(-)
|
||||
create mode 100644 libc/bionic/h_malloc_wrapper.cpp
|
||||
|
||||
diff --git a/libc/Android.bp b/libc/Android.bp
|
||||
index 71d8ee556..13cefe94f 100644
|
||||
--- a/libc/Android.bp
|
||||
+++ b/libc/Android.bp
|
||||
@@ -76,6 +76,8 @@ libc_common_flags = [
|
||||
// ever touch 0, 1, or 2 bytes into a call to memset, which was never going
|
||||
// to amortize.)
|
||||
"-fno-builtin",
|
||||
+
|
||||
+ "-DH_MALLOC_PREFIX",
|
||||
]
|
||||
|
||||
// Define some common cflags
|
||||
@@ -159,13 +161,30 @@ libc_scudo_product_variables = {
|
||||
// ========================================================
|
||||
cc_defaults {
|
||||
name: "libc_native_allocator_defaults",
|
||||
+ whole_static_libs: ["libc_jemalloc_wrapper"],
|
||||
+ multilib: {
|
||||
+ lib32: {
|
||||
+ cflags: ["-DUSE_SCUDO"],
|
||||
+ whole_static_libs: ["libscudo"],
|
||||
+ exclude_static_libs: [
|
||||
+ "libjemalloc5",
|
||||
+ "libc_jemalloc_wrapper",
|
||||
+ ],
|
||||
+ },
|
||||
+ lib64: {
|
||||
+ cflags: [
|
||||
+ "-DH_MALLOC_PREFIX",
|
||||
+ "-DUSE_H_MALLOC",
|
||||
+ "-DUSE_SCUDO",
|
||||
+ ],
|
||||
+ whole_static_libs: [
|
||||
+ "libhardened_malloc",
|
||||
+ "libscudo",
|
||||
+ ],
|
||||
+ },
|
||||
+ },
|
||||
|
||||
- whole_static_libs: [
|
||||
- "libjemalloc5",
|
||||
- "libc_jemalloc_wrapper",
|
||||
- ],
|
||||
header_libs: ["gwp_asan_headers"],
|
||||
- product_variables: libc_scudo_product_variables,
|
||||
}
|
||||
|
||||
// Functions not implemented by jemalloc directly, or that need to
|
||||
@@ -173,12 +192,20 @@ cc_defaults {
|
||||
cc_library_static {
|
||||
name: "libc_jemalloc_wrapper",
|
||||
defaults: ["libc_defaults"],
|
||||
- srcs: ["bionic/jemalloc_wrapper.cpp"],
|
||||
+ multilib: {
|
||||
+ lib32: {
|
||||
+ // Used to pull in the jemalloc/hardened_malloc include directory so that if the
|
||||
+ // library is removed, the include directory is also removed.
|
||||
+ srcs: ["bionic/jemalloc_wrapper.cpp"],
|
||||
+ static_libs: ["libjemalloc5"],
|
||||
+ },
|
||||
+ lib64: {
|
||||
+ srcs: ["bionic/h_malloc_wrapper.cpp"],
|
||||
+ static_libs: ["libhardened_malloc"],
|
||||
+ },
|
||||
+ },
|
||||
cflags: ["-fvisibility=hidden"],
|
||||
|
||||
- // Used to pull in the jemalloc include directory so that if the
|
||||
- // library is removed, the include directory is also removed.
|
||||
- static_libs: ["libjemalloc5"],
|
||||
}
|
||||
|
||||
// ========================================================
|
||||
diff --git a/libc/bionic/h_malloc_wrapper.cpp b/libc/bionic/h_malloc_wrapper.cpp
|
||||
new file mode 100644
|
||||
index 000000000..5fb0968c2
|
||||
--- /dev/null
|
||||
+++ b/libc/bionic/h_malloc_wrapper.cpp
|
||||
@@ -0,0 +1,51 @@
|
||||
+#include <errno.h>
|
||||
+#include <malloc.h>
|
||||
+#include <sys/param.h>
|
||||
+#include <unistd.h>
|
||||
+
|
||||
+#include <private/MallocXmlElem.h>
|
||||
+
|
||||
+#include "h_malloc.h"
|
||||
+
|
||||
+__BEGIN_DECLS
|
||||
+int h_malloc_info(int options, FILE* fp);
|
||||
+__END_DECLS
|
||||
+
|
||||
+int h_malloc_info(int options, FILE* fp) {
|
||||
+ if (options != 0) {
|
||||
+ errno = EINVAL;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ fflush(fp);
|
||||
+ int fd = fileno(fp);
|
||||
+ MallocXmlElem root(fd, "malloc", "version=\"jemalloc-1\"");
|
||||
+
|
||||
+ // Dump all of the large allocations in the arenas.
|
||||
+ for (size_t i = 0; i < h_mallinfo_narenas(); i++) {
|
||||
+ struct mallinfo mi = h_mallinfo_arena_info(i);
|
||||
+ if (mi.hblkhd != 0) {
|
||||
+ MallocXmlElem arena_elem(fd, "heap", "nr=\"%d\"", i);
|
||||
+ {
|
||||
+ MallocXmlElem(fd, "allocated-large").Contents("%zu", mi.ordblks);
|
||||
+ MallocXmlElem(fd, "allocated-huge").Contents("%zu", mi.uordblks);
|
||||
+ MallocXmlElem(fd, "allocated-bins").Contents("%zu", mi.fsmblks);
|
||||
+
|
||||
+ size_t total = 0;
|
||||
+ for (size_t j = 0; j < h_mallinfo_nbins(); j++) {
|
||||
+ struct mallinfo mi = h_mallinfo_bin_info(i, j);
|
||||
+ if (mi.ordblks != 0) {
|
||||
+ MallocXmlElem bin_elem(fd, "bin", "nr=\"%d\"", j);
|
||||
+ MallocXmlElem(fd, "allocated").Contents("%zu", mi.ordblks);
|
||||
+ MallocXmlElem(fd, "nmalloc").Contents("%zu", mi.uordblks);
|
||||
+ MallocXmlElem(fd, "ndalloc").Contents("%zu", mi.fordblks);
|
||||
+ total += mi.ordblks;
|
||||
+ }
|
||||
+ }
|
||||
+ MallocXmlElem(fd, "bins-total").Contents("%zu", total);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/libc/bionic/malloc_common.h b/libc/bionic/malloc_common.h
|
||||
index 4afcc4a8d..8852c85a2 100644
|
||||
--- a/libc/bionic/malloc_common.h
|
||||
+++ b/libc/bionic/malloc_common.h
|
||||
@@ -55,21 +55,26 @@ __END_DECLS
|
||||
|
||||
#else // __has_feature(hwaddress_sanitizer)
|
||||
|
||||
-#if defined(USE_SCUDO)
|
||||
-
|
||||
-#include "scudo.h"
|
||||
-#define Malloc(function) scudo_ ## function
|
||||
+#ifdef __LP64__
|
||||
+#ifndef USE_H_MALLOC
|
||||
+#error missing USE_H_MALLOC
|
||||
+#endif
|
||||
|
||||
-#elif defined(USE_SCUDO_SVELTE)
|
||||
+#include "h_malloc.h"
|
||||
+#define Malloc(function) h_ ## function
|
||||
+__BEGIN_DECLS
|
||||
+int h_malloc_info(int options, FILE* fp);
|
||||
+__END_DECLS
|
||||
|
||||
+#if defined(USE_SCUDO)
|
||||
#include "scudo.h"
|
||||
-#define Malloc(function) scudo_svelte_ ## function
|
||||
-
|
||||
-#else
|
||||
+#endif
|
||||
|
||||
-#include "jemalloc.h"
|
||||
-#define Malloc(function) je_ ## function
|
||||
+#define BOTH_H_MALLOC_AND_SCUDO
|
||||
|
||||
+#else // 32-bit
|
||||
+#include "scudo.h"
|
||||
+#define Malloc(function) scudo_ ## function
|
||||
#endif
|
||||
|
||||
#endif
|
@ -0,0 +1,51 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 2 May 2023 16:47:49 +0300
|
||||
Subject: [PATCH] disable hardened_malloc for Pixel camera provider service
|
||||
|
||||
---
|
||||
libc/bionic/libc_init_dynamic.cpp | 3 +++
|
||||
libc/bionic/malloc_common.cpp | 3 +++
|
||||
libc/include/stdlib.h | 1 +
|
||||
3 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
|
||||
index 804e586e2..7097a70b0 100644
|
||||
--- a/libc/bionic/libc_init_dynamic.cpp
|
||||
+++ b/libc/bionic/libc_init_dynamic.cpp
|
||||
@@ -84,6 +84,9 @@ static void init_prog_id(libc_globals* globals) {
|
||||
|
||||
#define IS(prog) (!strcmp(exe_path, prog))
|
||||
|
||||
+ if (IS("/apex/com.google.pixel.camera.hal/bin/hw/android.hardware.camera.provider@2.7-service-google")) {
|
||||
+ prog_id = PROG_PIXEL_CAMERA_PROVIDER_SERVICE;
|
||||
+ }
|
||||
#undef IS
|
||||
|
||||
// libc_globals struct is write-protected
|
||||
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
|
||||
index 3d3e8ef61..9b7310347 100644
|
||||
--- a/libc/bionic/malloc_common.cpp
|
||||
+++ b/libc/bionic/malloc_common.cpp
|
||||
@@ -425,6 +425,9 @@ static const MallocDispatch* native_allocator_dispatch;
|
||||
void InitNativeAllocatorDispatch(libc_globals* globals) {
|
||||
bool hardened_impl = true;
|
||||
switch (get_prog_id()) {
|
||||
+ case PROG_PIXEL_CAMERA_PROVIDER_SERVICE:
|
||||
+ hardened_impl = false;
|
||||
+ break;
|
||||
default:
|
||||
hardened_impl = getenv("DISABLE_HARDENED_MALLOC") == nullptr;
|
||||
}
|
||||
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
|
||||
index 5ce8f9103..cb8d3d3b2 100644
|
||||
--- a/libc/include/stdlib.h
|
||||
+++ b/libc/include/stdlib.h
|
||||
@@ -213,6 +213,7 @@ long strtol_l(const char* _Nonnull __s, char* _Nullable * _Nullable __end_ptr, i
|
||||
int get_prog_id();
|
||||
#define is_prog(id) (get_prog_id() == id)
|
||||
|
||||
+#define PROG_PIXEL_CAMERA_PROVIDER_SERVICE 1
|
||||
__END_DECLS
|
||||
|
||||
#include <android/legacy_stdlib_inlines.h>
|
@ -0,0 +1,49 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 12 Dec 2023 20:37:48 +0200
|
||||
Subject: [PATCH] disable hardened_malloc for surfaceflinger
|
||||
|
||||
---
|
||||
libc/bionic/libc_init_dynamic.cpp | 3 +++
|
||||
libc/bionic/malloc_common.cpp | 1 +
|
||||
libc/include/stdlib.h | 1 +
|
||||
3 files changed, 5 insertions(+)
|
||||
|
||||
diff --git a/libc/bionic/libc_init_dynamic.cpp b/libc/bionic/libc_init_dynamic.cpp
|
||||
index 7097a70b0..f83d24ea7 100644
|
||||
--- a/libc/bionic/libc_init_dynamic.cpp
|
||||
+++ b/libc/bionic/libc_init_dynamic.cpp
|
||||
@@ -87,6 +87,9 @@ static void init_prog_id(libc_globals* globals) {
|
||||
if (IS("/apex/com.google.pixel.camera.hal/bin/hw/android.hardware.camera.provider@2.7-service-google")) {
|
||||
prog_id = PROG_PIXEL_CAMERA_PROVIDER_SERVICE;
|
||||
}
|
||||
+ else if (IS("/system/bin/surfaceflinger")) {
|
||||
+ prog_id = PROG_SURFACEFLINGER;
|
||||
+ }
|
||||
#undef IS
|
||||
|
||||
// libc_globals struct is write-protected
|
||||
diff --git a/libc/bionic/malloc_common.cpp b/libc/bionic/malloc_common.cpp
|
||||
index 9b7310347..1ab4861af 100644
|
||||
--- a/libc/bionic/malloc_common.cpp
|
||||
+++ b/libc/bionic/malloc_common.cpp
|
||||
@@ -426,6 +426,7 @@ void InitNativeAllocatorDispatch(libc_globals* globals) {
|
||||
bool hardened_impl = true;
|
||||
switch (get_prog_id()) {
|
||||
case PROG_PIXEL_CAMERA_PROVIDER_SERVICE:
|
||||
+ case PROG_SURFACEFLINGER:
|
||||
hardened_impl = false;
|
||||
break;
|
||||
default:
|
||||
diff --git a/libc/include/stdlib.h b/libc/include/stdlib.h
|
||||
index cb8d3d3b2..5dd67daa4 100644
|
||||
--- a/libc/include/stdlib.h
|
||||
+++ b/libc/include/stdlib.h
|
||||
@@ -214,6 +214,7 @@ int get_prog_id();
|
||||
#define is_prog(id) (get_prog_id() == id)
|
||||
|
||||
#define PROG_PIXEL_CAMERA_PROVIDER_SERVICE 1
|
||||
+#define PROG_SURFACEFLINGER 3
|
||||
__END_DECLS
|
||||
|
||||
#include <android/legacy_stdlib_inlines.h>
|
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
Date: Wed, 13 Oct 2021 12:30:25 +0300
|
||||
Subject: [PATCH] add a real explicit_bzero implementation
|
||||
|
||||
Clang, GCC and other compilers special-case standard C functions like
|
||||
memset. Calls to memset will be optimized out.
|
||||
|
||||
OpenBSD provides explicit_bzero to work around this but Android simply
|
||||
defines it as memset so nothing prevents it from being optimized away.
|
||||
|
||||
This implementation uses a memory read constraint via empty inline
|
||||
assembly rather than something that may be broken via link-time
|
||||
optimization in the future.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
Change-Id: Ia021e30f86ee4b998d541fbf7262110f9d1d6fbf
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/Android.bp | 1 +
|
||||
libc/bionic/explicit_bzero.cpp | 7 +++++++
|
||||
libc/include/string.h | 2 ++
|
||||
libc/libc.map.txt | 1 +
|
||||
libc/upstream-openbsd/android/include/openbsd-compat.h | 4 ----
|
||||
5 files changed, 11 insertions(+), 4 deletions(-)
|
||||
create mode 100644 libc/bionic/explicit_bzero.cpp
|
||||
|
||||
diff --git a/libc/Android.bp b/libc/Android.bp
|
||||
index 13cefe94f..9f8b689af 100644
|
||||
--- a/libc/Android.bp
|
||||
+++ b/libc/Android.bp
|
||||
@@ -1127,6 +1127,7 @@ cc_library_static {
|
||||
"bionic/eventfd.cpp",
|
||||
"bionic/exec.cpp",
|
||||
"bionic/execinfo.cpp",
|
||||
+ "bionic/explicit_bzero.cpp",
|
||||
"bionic/faccessat.cpp",
|
||||
"bionic/fchmod.cpp",
|
||||
"bionic/fchmodat.cpp",
|
||||
diff --git a/libc/bionic/explicit_bzero.cpp b/libc/bionic/explicit_bzero.cpp
|
||||
new file mode 100644
|
||||
index 000000000..dd43f9c00
|
||||
--- /dev/null
|
||||
+++ b/libc/bionic/explicit_bzero.cpp
|
||||
@@ -0,0 +1,7 @@
|
||||
+#include <string.h>
|
||||
+
|
||||
+void* _Nonnull explicit_bzero(void* _Nonnull s, size_t n) {
|
||||
+ void *ptr = memset(s, 0, n);
|
||||
+ __asm__ __volatile__("" : : "r"(ptr) : "memory");
|
||||
+ return ptr;
|
||||
+}
|
||||
diff --git a/libc/include/string.h b/libc/include/string.h
|
||||
index 47bdd7271..e601ea022 100644
|
||||
--- a/libc/include/string.h
|
||||
+++ b/libc/include/string.h
|
||||
@@ -64,6 +64,8 @@ void* _Nonnull memmove(void* _Nonnull __dst, const void* _Nonnull __src, size_t
|
||||
*/
|
||||
void* _Nonnull memset(void* _Nonnull __dst, int __ch, size_t __n);
|
||||
|
||||
+void* _Nonnull explicit_bzero(void* _Nonnull s, size_t n);
|
||||
+
|
||||
/**
|
||||
* [memset_explicit(3)](http://man7.org/linux/man-pages/man3/memset_explicit.3.html)
|
||||
* writes the bottom 8 bits of the given int to the next `n` bytes of `dst`,
|
||||
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
|
||||
index 5d87cd8ef..dd2e6c6f7 100644
|
||||
--- a/libc/libc.map.txt
|
||||
+++ b/libc/libc.map.txt
|
||||
@@ -332,6 +332,7 @@ LIBC {
|
||||
execvp;
|
||||
execvpe; # introduced=21
|
||||
exit;
|
||||
+ explicit_bzero; # introduced=33
|
||||
faccessat;
|
||||
fallocate; # introduced=21
|
||||
fallocate64; # introduced=21
|
||||
diff --git a/libc/upstream-openbsd/android/include/openbsd-compat.h b/libc/upstream-openbsd/android/include/openbsd-compat.h
|
||||
index 8e6f87da8..26dc01863 100644
|
||||
--- a/libc/upstream-openbsd/android/include/openbsd-compat.h
|
||||
+++ b/libc/upstream-openbsd/android/include/openbsd-compat.h
|
||||
@@ -57,10 +57,6 @@ extern const char* __progname;
|
||||
/* OpenBSD has this, but we can't really implement it correctly on Linux. */
|
||||
#define issetugid() 0
|
||||
|
||||
-#if !defined(ANDROID_HOST_MUSL)
|
||||
-#define explicit_bzero(p, s) memset(p, 0, s)
|
||||
-#endif
|
||||
-
|
||||
#if defined(ANDROID_HOST_MUSL)
|
||||
#define __LIBC_HIDDEN__ __attribute__((visibility("hidden")))
|
||||
#endif
|
@ -0,0 +1,84 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 2 Dec 2015 23:37:28 -0500
|
||||
Subject: [PATCH] switch pthread_atfork handler allocation to mmap
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/pthread_atfork.cpp | 35 ++++++++++++++++++++++++++++------
|
||||
1 file changed, 29 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_atfork.cpp b/libc/bionic/pthread_atfork.cpp
|
||||
index 0dcabdfb2..6306052ee 100644
|
||||
--- a/libc/bionic/pthread_atfork.cpp
|
||||
+++ b/libc/bionic/pthread_atfork.cpp
|
||||
@@ -29,6 +29,9 @@
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <sys/prctl.h>
|
||||
+#include <unistd.h>
|
||||
|
||||
#include "platform/bionic/macros.h"
|
||||
|
||||
@@ -43,6 +46,8 @@ struct atfork_t {
|
||||
void* dso_handle;
|
||||
};
|
||||
|
||||
+static atfork_t* pool;
|
||||
+
|
||||
class atfork_list_t {
|
||||
public:
|
||||
constexpr atfork_list_t() : first_(nullptr), last_(nullptr) {}
|
||||
@@ -101,7 +106,8 @@ class atfork_list_t {
|
||||
last_ = entry->prev;
|
||||
}
|
||||
|
||||
- free(entry);
|
||||
+ entry->next = pool;
|
||||
+ pool = entry;
|
||||
}
|
||||
|
||||
atfork_t* first_;
|
||||
@@ -154,18 +160,35 @@ void __bionic_atfork_run_parent() {
|
||||
// __register_atfork is the name used by glibc
|
||||
extern "C" int __register_atfork(void (*prepare)(void), void (*parent)(void),
|
||||
void(*child)(void), void* dso) {
|
||||
- atfork_t* entry = reinterpret_cast<atfork_t*>(malloc(sizeof(atfork_t)));
|
||||
- if (entry == nullptr) {
|
||||
- return ENOMEM;
|
||||
+ pthread_mutex_lock(&g_atfork_list_mutex);
|
||||
+
|
||||
+ if (!pool) {
|
||||
+ size_t page_size = getpagesize();
|
||||
+ char* page = static_cast<char*>(mmap(NULL, page_size, PROT_READ|PROT_WRITE,
|
||||
+ MAP_ANONYMOUS|MAP_PRIVATE, -1, 0));
|
||||
+ if (page == MAP_FAILED) {
|
||||
+ pthread_mutex_unlock(&g_atfork_list_mutex);
|
||||
+ return ENOMEM;
|
||||
+ }
|
||||
+
|
||||
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, page, page_size,
|
||||
+ "atfork handlers");
|
||||
+
|
||||
+ for (char* it = page; it < page + page_size - sizeof(atfork_t); it += sizeof(atfork_t)) {
|
||||
+ atfork_t* node = reinterpret_cast<atfork_t*>(it);
|
||||
+ node->next = pool;
|
||||
+ pool = node;
|
||||
+ }
|
||||
}
|
||||
|
||||
+ atfork_t* entry = pool;
|
||||
+ pool = entry->next;
|
||||
+
|
||||
entry->prepare = prepare;
|
||||
entry->parent = parent;
|
||||
entry->child = child;
|
||||
entry->dso_handle = dso;
|
||||
|
||||
- pthread_mutex_lock(&g_atfork_list_mutex);
|
||||
-
|
||||
g_atfork_list.push_back(entry);
|
||||
|
||||
pthread_mutex_unlock(&g_atfork_list_mutex);
|
@ -0,0 +1,95 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Thu, 3 Dec 2015 12:58:31 -0500
|
||||
Subject: [PATCH] add memory protection for pthread_atfork handlers
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/pthread_atfork.cpp | 34 ++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 32 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_atfork.cpp b/libc/bionic/pthread_atfork.cpp
|
||||
index 6306052ee..d59f3ae54 100644
|
||||
--- a/libc/bionic/pthread_atfork.cpp
|
||||
+++ b/libc/bionic/pthread_atfork.cpp
|
||||
@@ -47,6 +47,7 @@ struct atfork_t {
|
||||
};
|
||||
|
||||
static atfork_t* pool;
|
||||
+static atfork_t* page_list;
|
||||
|
||||
class atfork_list_t {
|
||||
public:
|
||||
@@ -160,13 +161,22 @@ void __bionic_atfork_run_parent() {
|
||||
// __register_atfork is the name used by glibc
|
||||
extern "C" int __register_atfork(void (*prepare)(void), void (*parent)(void),
|
||||
void(*child)(void), void* dso) {
|
||||
+ size_t page_size = getpagesize();
|
||||
+
|
||||
pthread_mutex_lock(&g_atfork_list_mutex);
|
||||
|
||||
+ for (atfork_t* page_it = page_list; page_it; page_it = page_it->next) {
|
||||
+ mprotect(page_it, page_size, PROT_READ|PROT_WRITE);
|
||||
+ }
|
||||
+
|
||||
if (!pool) {
|
||||
- size_t page_size = getpagesize();
|
||||
char* page = static_cast<char*>(mmap(NULL, page_size, PROT_READ|PROT_WRITE,
|
||||
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0));
|
||||
if (page == MAP_FAILED) {
|
||||
+ for (atfork_t* page_it = page_list; page_it; page_it = page_it->next) {
|
||||
+ mprotect(page_it, page_size, PROT_READ);
|
||||
+ }
|
||||
+
|
||||
pthread_mutex_unlock(&g_atfork_list_mutex);
|
||||
return ENOMEM;
|
||||
}
|
||||
@@ -174,11 +184,15 @@ extern "C" int __register_atfork(void (*prepare)(void), void (*parent)(void),
|
||||
prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, page, page_size,
|
||||
"atfork handlers");
|
||||
|
||||
- for (char* it = page; it < page + page_size - sizeof(atfork_t); it += sizeof(atfork_t)) {
|
||||
+ for (char* it = page + sizeof(atfork_t); it < page + page_size - sizeof(atfork_t); it += sizeof(atfork_t)) {
|
||||
atfork_t* node = reinterpret_cast<atfork_t*>(it);
|
||||
node->next = pool;
|
||||
pool = node;
|
||||
}
|
||||
+
|
||||
+ atfork_t* page_node = reinterpret_cast<atfork_t*>(page);
|
||||
+ page_node->next = page_list;
|
||||
+ page_list = page_node;
|
||||
}
|
||||
|
||||
atfork_t* entry = pool;
|
||||
@@ -191,6 +205,10 @@ extern "C" int __register_atfork(void (*prepare)(void), void (*parent)(void),
|
||||
|
||||
g_atfork_list.push_back(entry);
|
||||
|
||||
+ for (atfork_t* page_it = page_list; page_it; page_it = page_it->next) {
|
||||
+ mprotect(page_it, page_size, PROT_READ);
|
||||
+ }
|
||||
+
|
||||
pthread_mutex_unlock(&g_atfork_list_mutex);
|
||||
|
||||
return 0;
|
||||
@@ -198,8 +216,20 @@ extern "C" int __register_atfork(void (*prepare)(void), void (*parent)(void),
|
||||
|
||||
extern "C" __LIBC_HIDDEN__ void __unregister_atfork(void* dso) {
|
||||
pthread_mutex_lock(&g_atfork_list_mutex);
|
||||
+
|
||||
+ size_t page_size = getpagesize();
|
||||
+
|
||||
+ for (atfork_t* page_it = page_list; page_it; page_it = page_it->next) {
|
||||
+ mprotect(page_it, page_size, PROT_READ|PROT_WRITE);
|
||||
+ }
|
||||
+
|
||||
g_atfork_list.remove_if([&](const atfork_t* entry) {
|
||||
return entry->dso_handle == dso;
|
||||
});
|
||||
+
|
||||
+ for (atfork_t* page_it = page_list; page_it; page_it = page_it->next) {
|
||||
+ mprotect(page_it, page_size, PROT_READ);
|
||||
+ }
|
||||
+
|
||||
pthread_mutex_unlock(&g_atfork_list_mutex);
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 27 Jan 2016 18:02:15 -0500
|
||||
Subject: [PATCH] add XOR mangling mitigation for thread-local dtors
|
||||
|
||||
memtag_stack struct member is required to be at its exact position by static_assert below.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/__cxa_thread_atexit_impl.cpp | 8 +++++---
|
||||
libc/bionic/libc_init_common.cpp | 2 ++
|
||||
libc/private/bionic_globals.h | 1 +
|
||||
3 files changed, 8 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/__cxa_thread_atexit_impl.cpp b/libc/bionic/__cxa_thread_atexit_impl.cpp
|
||||
index 99077c101..74608513e 100644
|
||||
--- a/libc/bionic/__cxa_thread_atexit_impl.cpp
|
||||
+++ b/libc/bionic/__cxa_thread_atexit_impl.cpp
|
||||
@@ -13,15 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
+#include <stdint.h>
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
#include <private/bionic_defs.h>
|
||||
+#include <private/bionic_globals.h>
|
||||
|
||||
#include "pthread_internal.h"
|
||||
|
||||
class thread_local_dtor {
|
||||
public:
|
||||
- void (*func) (void *);
|
||||
+ uintptr_t func;
|
||||
void *arg;
|
||||
void *dso_handle; // unused...
|
||||
thread_local_dtor* next;
|
||||
@@ -35,7 +37,7 @@ __BIONIC_WEAK_FOR_NATIVE_BRIDGE
|
||||
int __cxa_thread_atexit_impl(void (*func) (void *), void *arg, void *dso_handle) {
|
||||
thread_local_dtor* dtor = new thread_local_dtor();
|
||||
|
||||
- dtor->func = func;
|
||||
+ dtor->func = __libc_globals->dtor_cookie ^ reinterpret_cast<uintptr_t>(func);
|
||||
dtor->arg = arg;
|
||||
dtor->dso_handle = dso_handle;
|
||||
|
||||
@@ -54,7 +56,7 @@ extern "C" __LIBC_HIDDEN__ void __cxa_thread_finalize() {
|
||||
thread_local_dtor* current = thread->thread_local_dtors;
|
||||
thread->thread_local_dtors = current->next;
|
||||
|
||||
- current->func(current->arg);
|
||||
+ (reinterpret_cast<void (*)(void*)>(__libc_globals->dtor_cookie ^ current->func))(current->arg);
|
||||
if (__loader_remove_thread_local_dtor != nullptr) {
|
||||
__loader_remove_thread_local_dtor(current->dso_handle);
|
||||
}
|
||||
diff --git a/libc/bionic/libc_init_common.cpp b/libc/bionic/libc_init_common.cpp
|
||||
index 7ef79b61a..9c946b077 100644
|
||||
--- a/libc/bionic/libc_init_common.cpp
|
||||
+++ b/libc/bionic/libc_init_common.cpp
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "heap_tagging.h"
|
||||
#include "private/ScopedPthreadMutexLocker.h"
|
||||
#include "private/WriteProtected.h"
|
||||
+#include "private/bionic_arc4random.h"
|
||||
#include "private/bionic_defs.h"
|
||||
#include "private/bionic_globals.h"
|
||||
#include "private/bionic_tls.h"
|
||||
@@ -70,6 +71,7 @@ void __libc_init_globals() {
|
||||
__libc_globals.mutate([](libc_globals* globals) {
|
||||
__libc_init_vdso(globals);
|
||||
__libc_init_setjmp_cookie(globals);
|
||||
+ arc4random_buf(&globals->dtor_cookie, sizeof(globals->dtor_cookie));
|
||||
});
|
||||
}
|
||||
|
||||
diff --git a/libc/private/bionic_globals.h b/libc/private/bionic_globals.h
|
||||
index 66f8d84b0..bd34e3a08 100644
|
||||
--- a/libc/private/bionic_globals.h
|
||||
+++ b/libc/private/bionic_globals.h
|
||||
@@ -50,6 +50,7 @@ struct libc_globals {
|
||||
uintptr_t heap_pointer_tag;
|
||||
_Atomic(bool) memtag_stack;
|
||||
_Atomic(bool) decay_time_enabled;
|
||||
+ long dtor_cookie;
|
||||
|
||||
// In order to allow a complete switch between dispatch tables without
|
||||
// the need for copying each function by function in the structure,
|
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Fri, 29 Jan 2016 20:20:09 -0500
|
||||
Subject: [PATCH] use a better pthread_attr junk filling pattern
|
||||
|
||||
Guarantee that junk filled pointers will fault, at least on pure 64-bit.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/pthread_attr.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_attr.cpp b/libc/bionic/pthread_attr.cpp
|
||||
index de4cc9e8d..7e74b8a80 100644
|
||||
--- a/libc/bionic/pthread_attr.cpp
|
||||
+++ b/libc/bionic/pthread_attr.cpp
|
||||
@@ -54,7 +54,7 @@ int pthread_attr_init(pthread_attr_t* attr) {
|
||||
|
||||
__BIONIC_WEAK_FOR_NATIVE_BRIDGE
|
||||
int pthread_attr_destroy(pthread_attr_t* attr) {
|
||||
- memset(attr, 0x42, sizeof(pthread_attr_t));
|
||||
+ memset(attr, 0xdf, sizeof(pthread_attr_t));
|
||||
return 0;
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Renlord <me@renlord.com>
|
||||
Date: Thu, 12 Sep 2019 14:51:51 +1000
|
||||
Subject: [PATCH] add guard page(s) between static_tls and stack
|
||||
|
||||
---
|
||||
libc/bionic/pthread_create.cpp | 29 ++++++++++++++++++++---------
|
||||
1 file changed, 20 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
|
||||
index 194db1821..88e57f973 100644
|
||||
--- a/libc/bionic/pthread_create.cpp
|
||||
+++ b/libc/bionic/pthread_create.cpp
|
||||
@@ -212,9 +212,10 @@ int __init_thread(pthread_internal_t* thread) {
|
||||
ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_size) {
|
||||
const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
|
||||
|
||||
- // Allocate in order: stack guard, stack, static TLS, guard page.
|
||||
+ // Allocate in order: stack guard, stack, guard page, static TLS, guard page.
|
||||
size_t mmap_size;
|
||||
if (__builtin_add_overflow(stack_size, stack_guard_size, &mmap_size)) return {};
|
||||
+ if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, layout.size(), &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
|
||||
@@ -223,8 +224,8 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
mmap_size = __BIONIC_ALIGN(mmap_size, page_size());
|
||||
if (mmap_size < unaligned_size) return {};
|
||||
|
||||
- // Create a new private anonymous map. Make the entire mapping PROT_NONE, then carve out a
|
||||
- // read+write area in the middle.
|
||||
+ // Create a new private anonymous map. Make the entire mapping PROT_NONE, then carve out
|
||||
+ // read+write areas for the stack and static TLS
|
||||
const int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE;
|
||||
char* const space = static_cast<char*>(mmap(nullptr, mmap_size, PROT_NONE, flags, -1, 0));
|
||||
if (space == MAP_FAILED) {
|
||||
@@ -233,7 +234,6 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
mmap_size);
|
||||
return {};
|
||||
}
|
||||
- const size_t writable_size = mmap_size - stack_guard_size - PTHREAD_GUARD_SIZE;
|
||||
int prot = PROT_READ | PROT_WRITE;
|
||||
const char* prot_str = "R+W";
|
||||
#ifdef __aarch64__
|
||||
@@ -242,11 +242,22 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
prot_str = "R+W+MTE";
|
||||
}
|
||||
#endif
|
||||
- if (mprotect(space + stack_guard_size, writable_size, prot) != 0) {
|
||||
+ if (mprotect(space + stack_guard_size, stack_size, prot) != 0) {
|
||||
+ async_safe_format_log(
|
||||
+ ANDROID_LOG_WARN, "libc",
|
||||
+ "pthread_create failed: couldn't mprotect %s %zu-byte stack mapping region: %m", prot_str,
|
||||
+ stack_size);
|
||||
+ munmap(space, mmap_size);
|
||||
+ return {};
|
||||
+ }
|
||||
+
|
||||
+ char* const static_tls_space = space + stack_guard_size + stack_size + PTHREAD_GUARD_SIZE;
|
||||
+
|
||||
+ if (mprotect(static_tls_space, layout.size(), PROT_READ | PROT_WRITE) != 0) {
|
||||
async_safe_format_log(
|
||||
ANDROID_LOG_WARN, "libc",
|
||||
- "pthread_create failed: couldn't mprotect %s %zu-byte thread mapping region: %m", prot_str,
|
||||
- writable_size);
|
||||
+ "pthread_create failed: couldn't mprotect R+W %zu-byte static TLS mapping region: %m",
|
||||
+ layout.size());
|
||||
munmap(space, mmap_size);
|
||||
return {};
|
||||
}
|
||||
@@ -256,9 +267,9 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
result.mmap_size = mmap_size;
|
||||
result.mmap_base_unguarded = space + stack_guard_size;
|
||||
result.mmap_size_unguarded = mmap_size - stack_guard_size - PTHREAD_GUARD_SIZE;
|
||||
- result.static_tls = space + mmap_size - PTHREAD_GUARD_SIZE - layout.size();
|
||||
+ result.static_tls = static_tls_space;
|
||||
result.stack_base = space;
|
||||
- result.stack_top = result.static_tls;
|
||||
+ result.stack_top = space + stack_guard_size + stack_size;
|
||||
return result;
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Fri, 11 Oct 2019 05:52:49 +0300
|
||||
Subject: [PATCH] move pthread_internal_t behind guard page
|
||||
|
||||
---
|
||||
libc/bionic/pthread_create.cpp | 23 +++++++++++------------
|
||||
1 file changed, 11 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
|
||||
index 88e57f973..f21e3a63f 100644
|
||||
--- a/libc/bionic/pthread_create.cpp
|
||||
+++ b/libc/bionic/pthread_create.cpp
|
||||
@@ -212,10 +212,13 @@ int __init_thread(pthread_internal_t* thread) {
|
||||
ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_size) {
|
||||
const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
|
||||
|
||||
- // Allocate in order: stack guard, stack, guard page, static TLS, guard page.
|
||||
+ size_t thread_page_size = __BIONIC_ALIGN(sizeof(pthread_internal_t), PAGE_SIZE);
|
||||
+
|
||||
+ // Allocate in order: stack guard, stack, guard page, pthread_internal_t, static TLS, guard page.
|
||||
size_t mmap_size;
|
||||
if (__builtin_add_overflow(stack_size, stack_guard_size, &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
+ if (__builtin_add_overflow(mmap_size, thread_page_size, &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, layout.size(), &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
|
||||
@@ -251,13 +254,14 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
return {};
|
||||
}
|
||||
|
||||
- char* const static_tls_space = space + stack_guard_size + stack_size + PTHREAD_GUARD_SIZE;
|
||||
+ char* const thread = space + stack_guard_size + stack_size + PTHREAD_GUARD_SIZE;
|
||||
+ char* const static_tls_space = thread + thread_page_size;
|
||||
|
||||
- if (mprotect(static_tls_space, layout.size(), PROT_READ | PROT_WRITE) != 0) {
|
||||
+ if (mprotect(thread, thread_page_size + layout.size(), PROT_READ | PROT_WRITE) != 0) {
|
||||
async_safe_format_log(
|
||||
ANDROID_LOG_WARN, "libc",
|
||||
- "pthread_create failed: couldn't mprotect R+W %zu-byte static TLS mapping region: %m",
|
||||
- layout.size());
|
||||
+ "pthread_create failed: couldn't mprotect R+W %zu-byte static TLS and pthread_internal mapping region: %m",
|
||||
+ thread_page_size + layout.size());
|
||||
munmap(space, mmap_size);
|
||||
return {};
|
||||
}
|
||||
@@ -299,13 +303,8 @@ static int __allocate_thread(pthread_attr_t* attr, bionic_tcb** tcbp, void** chi
|
||||
stack_top = static_cast<char*>(attr->stack_base) + attr->stack_size;
|
||||
}
|
||||
|
||||
- // Carve out space from the stack for the thread's pthread_internal_t. This
|
||||
- // memory isn't counted in pthread_attr_getstacksize.
|
||||
-
|
||||
- // To safely access the pthread_internal_t and thread stack, we need to find a 16-byte aligned boundary.
|
||||
- stack_top = align_down(stack_top - sizeof(pthread_internal_t), 16);
|
||||
-
|
||||
- pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(stack_top);
|
||||
+ pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(
|
||||
+ mapping.static_tls - __BIONIC_ALIGN(sizeof(pthread_internal_t), PAGE_SIZE));
|
||||
if (!stack_clean) {
|
||||
// If thread was not allocated by mmap(), it may not have been cleared to zero.
|
||||
// So assume the worst and zero it.
|
@ -0,0 +1,97 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Renlord <me@renlord.com>
|
||||
Date: Sun, 20 Oct 2019 00:17:11 +0300
|
||||
Subject: [PATCH] add secondary stack randomization
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/pthread_create.cpp | 30 ++++++++++++++++++++++++++----
|
||||
libc/include/sys/cdefs.h | 1 +
|
||||
2 files changed, 27 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
|
||||
index f21e3a63f..035967d3c 100644
|
||||
--- a/libc/bionic/pthread_create.cpp
|
||||
+++ b/libc/bionic/pthread_create.cpp
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
#include <errno.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/auxv.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -212,12 +213,24 @@ int __init_thread(pthread_internal_t* thread) {
|
||||
ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_size) {
|
||||
const StaticTlsLayout& layout = __libc_shared_globals()->static_tls_layout;
|
||||
|
||||
+ // round up if the given stack size is not in multiples of PAGE_SIZE
|
||||
+ stack_size = __BIONIC_ALIGN(stack_size, PAGE_SIZE);
|
||||
size_t thread_page_size = __BIONIC_ALIGN(sizeof(pthread_internal_t), PAGE_SIZE);
|
||||
|
||||
- // Allocate in order: stack guard, stack, guard page, pthread_internal_t, static TLS, guard page.
|
||||
+ // Place a randomly sized gap above the stack, up to 10% as large as the stack
|
||||
+ // on 32-bit and 50% on 64-bit where virtual memory is plentiful.
|
||||
+#if __LP64__
|
||||
+ size_t max_gap_size = stack_size / 2;
|
||||
+#else
|
||||
+ size_t max_gap_size = stack_size / 10;
|
||||
+#endif
|
||||
+ // Make sure random stack top guard size are multiples of PAGE_SIZE.
|
||||
+ size_t gap_size = __BIONIC_ALIGN(arc4random_uniform(max_gap_size), PAGE_SIZE);
|
||||
+
|
||||
+ // Allocate in order: stack guard, stack, (random) guard page(s), pthread_internal_t, static TLS, guard page.
|
||||
size_t mmap_size;
|
||||
if (__builtin_add_overflow(stack_size, stack_guard_size, &mmap_size)) return {};
|
||||
- if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
+ if (__builtin_add_overflow(mmap_size, gap_size, &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, thread_page_size, &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, layout.size(), &mmap_size)) return {};
|
||||
if (__builtin_add_overflow(mmap_size, PTHREAD_GUARD_SIZE, &mmap_size)) return {};
|
||||
@@ -245,6 +258,9 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
prot_str = "R+W+MTE";
|
||||
}
|
||||
#endif
|
||||
+ // Stack is at the lower end of mapped space, stack guard region is at the lower end of stack.
|
||||
+ // Make the usable portion of the stack between the guard region and random gap readable and
|
||||
+ // writable.
|
||||
if (mprotect(space + stack_guard_size, stack_size, prot) != 0) {
|
||||
async_safe_format_log(
|
||||
ANDROID_LOG_WARN, "libc",
|
||||
@@ -253,8 +269,11 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
munmap(space, mmap_size);
|
||||
return {};
|
||||
}
|
||||
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, space, stack_guard_size, "stack guard");
|
||||
+ char* const stack_top_guard = space + stack_guard_size + stack_size;
|
||||
+ prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, stack_top_guard, gap_size, "stack top guard");
|
||||
|
||||
- char* const thread = space + stack_guard_size + stack_size + PTHREAD_GUARD_SIZE;
|
||||
+ char* const thread = space + stack_guard_size + stack_size + gap_size;
|
||||
char* const static_tls_space = thread + thread_page_size;
|
||||
|
||||
if (mprotect(thread, thread_page_size + layout.size(), PROT_READ | PROT_WRITE) != 0) {
|
||||
@@ -273,7 +292,10 @@ ThreadMapping __allocate_thread_mapping(size_t stack_size, size_t stack_guard_si
|
||||
result.mmap_size_unguarded = mmap_size - stack_guard_size - PTHREAD_GUARD_SIZE;
|
||||
result.static_tls = static_tls_space;
|
||||
result.stack_base = space;
|
||||
- result.stack_top = space + stack_guard_size + stack_size;
|
||||
+ // Choose a random base within the first page of the stack. Waste no more
|
||||
+ // than the space originally wasted by pthread_internal_t for compatibility.
|
||||
+ result.stack_top = space + stack_guard_size + stack_size - arc4random_uniform(sizeof(pthread_internal_t));
|
||||
+ result.stack_top = reinterpret_cast<char*>(__BIONIC_ALIGN_DOWN(reinterpret_cast<size_t>(result.stack_top), 16));
|
||||
return result;
|
||||
}
|
||||
|
||||
diff --git a/libc/include/sys/cdefs.h b/libc/include/sys/cdefs.h
|
||||
index a8fb6240a..dd95423c4 100644
|
||||
--- a/libc/include/sys/cdefs.h
|
||||
+++ b/libc/include/sys/cdefs.h
|
||||
@@ -61,6 +61,7 @@
|
||||
#endif
|
||||
|
||||
#define __BIONIC_ALIGN(__value, __alignment) (((__value) + (__alignment)-1) & ~((__alignment)-1))
|
||||
+#define __BIONIC_ALIGN_DOWN(value, alignment) ((value) & ~((alignment) - 1))
|
||||
|
||||
/*
|
||||
* The nullness constraints of this parameter or return value are
|
@ -0,0 +1,76 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sun, 8 Feb 2015 01:18:54 -0500
|
||||
Subject: [PATCH] replace brk and sbrk with stubs
|
||||
|
||||
Pretend that there is never room to grow the heap in order to prevent
|
||||
usage of these unsafe legacy functions. There are likely no users of
|
||||
these in practice as it is inherently broken to use them outside of
|
||||
malloc.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/brk.cpp | 48 ++++++++-------------------------------------
|
||||
1 file changed, 8 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/brk.cpp b/libc/bionic/brk.cpp
|
||||
index 566c33a7a..ef9305513 100644
|
||||
--- a/libc/bionic/brk.cpp
|
||||
+++ b/libc/bionic/brk.cpp
|
||||
@@ -29,48 +29,16 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
-#if defined(__LP64__)
|
||||
-static void* __bionic_brk;
|
||||
-#else
|
||||
-void* __bionic_brk; // Accidentally exported by the NDK.
|
||||
+#if !defined(__LP64__)
|
||||
+void* __bionic_brk = reinterpret_cast<void*>(-1); // Accidentally exported by the NDK.
|
||||
#endif
|
||||
|
||||
-extern "C" void* __brk(void* __addr);
|
||||
-
|
||||
-int brk(void* end_data) {
|
||||
- __bionic_brk = __brk(end_data);
|
||||
- if (__bionic_brk < end_data) {
|
||||
- errno = ENOMEM;
|
||||
- return -1;
|
||||
- }
|
||||
- return 0;
|
||||
+int brk(void*) {
|
||||
+ errno = ENOMEM;
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
-void* sbrk(ptrdiff_t increment) {
|
||||
- // Initialize __bionic_brk if necessary.
|
||||
- if (__bionic_brk == nullptr) {
|
||||
- __bionic_brk = __brk(nullptr);
|
||||
- }
|
||||
-
|
||||
- // Don't ask the kernel if we already know the answer.
|
||||
- if (increment == 0) {
|
||||
- return __bionic_brk;
|
||||
- }
|
||||
-
|
||||
- // Avoid overflow.
|
||||
- uintptr_t old_brk = reinterpret_cast<uintptr_t>(__bionic_brk);
|
||||
- if ((increment > 0 && static_cast<uintptr_t>(increment) > (UINTPTR_MAX - old_brk)) ||
|
||||
- (increment < 0 && static_cast<uintptr_t>(-increment) > old_brk)) {
|
||||
- errno = ENOMEM;
|
||||
- return reinterpret_cast<void*>(-1);
|
||||
- }
|
||||
-
|
||||
- void* desired_brk = reinterpret_cast<void*>(old_brk + increment);
|
||||
- __bionic_brk = __brk(desired_brk);
|
||||
- if (__bionic_brk < desired_brk) {
|
||||
- errno = ENOMEM;
|
||||
- return reinterpret_cast<void*>(-1);
|
||||
- }
|
||||
-
|
||||
- return reinterpret_cast<void*>(old_brk);
|
||||
+void* sbrk(ptrdiff_t) {
|
||||
+ errno = ENOMEM;
|
||||
+ return reinterpret_cast<void*>(-1);
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Mon, 4 Mar 2019 04:26:04 -0500
|
||||
Subject: [PATCH] use blocking getrandom and avoid urandom fallback
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/getentropy.cpp | 28 +++-------------------------
|
||||
1 file changed, 3 insertions(+), 25 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/getentropy.cpp b/libc/bionic/getentropy.cpp
|
||||
index 9c93e713b..c9438ad2b 100644
|
||||
--- a/libc/bionic/getentropy.cpp
|
||||
+++ b/libc/bionic/getentropy.cpp
|
||||
@@ -33,22 +33,6 @@
|
||||
|
||||
#include "private/ScopedFd.h"
|
||||
|
||||
-static int getentropy_urandom(void* buffer, size_t buffer_size, int saved_errno) {
|
||||
- ScopedFd fd(TEMP_FAILURE_RETRY(open("/dev/urandom", O_RDONLY | O_NOFOLLOW | O_CLOEXEC, 0)));
|
||||
- if (fd.get() == -1) return -1;
|
||||
-
|
||||
- size_t collected = 0;
|
||||
- while (collected < buffer_size) {
|
||||
- ssize_t count = TEMP_FAILURE_RETRY(read(fd.get(), static_cast<char*>(buffer) + collected,
|
||||
- buffer_size - collected));
|
||||
- if (count == -1) return -1;
|
||||
- collected += count;
|
||||
- }
|
||||
-
|
||||
- errno = saved_errno;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
int getentropy(void* buffer, size_t buffer_size) {
|
||||
if (buffer_size > 256) {
|
||||
errno = EIO;
|
||||
@@ -59,16 +43,10 @@ int getentropy(void* buffer, size_t buffer_size) {
|
||||
|
||||
size_t collected = 0;
|
||||
while (collected < buffer_size) {
|
||||
- long count = TEMP_FAILURE_RETRY(getrandom(static_cast<char*>(buffer) + collected,
|
||||
- buffer_size - collected, GRND_NONBLOCK));
|
||||
+ long count = TEMP_FAILURE_RETRY(
|
||||
+ getrandom(static_cast<char*>(buffer) + collected, buffer_size - collected, 0));
|
||||
if (count == -1) {
|
||||
- // EAGAIN: there isn't enough entropy right now.
|
||||
- // ENOSYS/EINVAL: getrandom(2) or GRND_NONBLOCK isn't supported.
|
||||
- // EFAULT: `buffer` is invalid.
|
||||
- // Try /dev/urandom regardless because it can't hurt,
|
||||
- // and we don't need to optimize the EFAULT case.
|
||||
- // See http://b/33059407 and http://b/67015565.
|
||||
- return getentropy_urandom(buffer, buffer_size, saved_errno);
|
||||
+ return -1;
|
||||
}
|
||||
collected += count;
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Mon, 19 Sep 2016 07:57:43 -0400
|
||||
Subject: [PATCH] fix undefined out-of-bounds accesses in sched.h
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/include/sched.h | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/include/sched.h b/libc/include/sched.h
|
||||
index b1f18421b..20e25662f 100644
|
||||
--- a/libc/include/sched.h
|
||||
+++ b/libc/include/sched.h
|
||||
@@ -215,7 +215,10 @@ int sched_getcpu(void);
|
||||
* statically-sized CPU set. See `CPU_ALLOC` for dynamically-sized CPU sets.
|
||||
*/
|
||||
typedef struct {
|
||||
- __CPU_BITTYPE __bits[ CPU_SETSIZE / __CPU_BITS ];
|
||||
+ union {
|
||||
+ __CPU_BITTYPE __bits_minimum[ CPU_SETSIZE / __CPU_BITS ];
|
||||
+ __CPU_BITTYPE __bits[0];
|
||||
+ };
|
||||
} cpu_set_t;
|
||||
|
||||
/**
|
@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sat, 16 Jul 2016 23:55:16 -0400
|
||||
Subject: [PATCH] replace VLA formatting with dprintf-like function
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/bionic_systrace.cpp | 10 +---------
|
||||
1 file changed, 1 insertion(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/bionic_systrace.cpp b/libc/bionic/bionic_systrace.cpp
|
||||
index 227cb84c3..25ae76a89 100644
|
||||
--- a/libc/bionic/bionic_systrace.cpp
|
||||
+++ b/libc/bionic/bionic_systrace.cpp
|
||||
@@ -29,8 +29,6 @@
|
||||
#include <async_safe/log.h>
|
||||
#include <cutils/trace.h> // For ATRACE_TAG_BIONIC.
|
||||
|
||||
-#define WRITE_OFFSET 32
|
||||
-
|
||||
static Lock g_lock;
|
||||
static CachedProperty g_debug_atrace_tags_enableflags("debug.atrace.tags.enableflags");
|
||||
static uint64_t g_tags;
|
||||
@@ -67,15 +65,9 @@ static void trace_begin_internal(const char* message) {
|
||||
return;
|
||||
}
|
||||
|
||||
- // If bionic tracing has been enabled, then write the message to the
|
||||
- // kernel trace_marker.
|
||||
- int length = strlen(message);
|
||||
- char buf[length + WRITE_OFFSET];
|
||||
- size_t len = async_safe_format_buffer(buf, length + WRITE_OFFSET, "B|%d|%s", getpid(), message);
|
||||
-
|
||||
// Tracing may stop just after checking property and before writing the message.
|
||||
// So the write is acceptable to fail. See b/20666100.
|
||||
- TEMP_FAILURE_RETRY(write(trace_marker_fd, buf, len));
|
||||
+ async_safe_format_fd(trace_marker_fd, "B|%d|%s", getpid(), message);
|
||||
}
|
||||
|
||||
void bionic_trace_begin(const char* message) {
|
@ -0,0 +1,26 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Fri, 17 Jul 2015 21:32:05 -0400
|
||||
Subject: [PATCH] increase default pthread stack to 8MiB on 64-bit
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/pthread_internal.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/libc/bionic/pthread_internal.h b/libc/bionic/pthread_internal.h
|
||||
index 3b9e6a481..c4d124e8e 100644
|
||||
--- a/libc/bionic/pthread_internal.h
|
||||
+++ b/libc/bionic/pthread_internal.h
|
||||
@@ -256,7 +256,11 @@ __LIBC_HIDDEN__ void pthread_key_clean_all(void);
|
||||
// stack overflows, we subtracted the same amount we were using there
|
||||
// from the default thread stack size. This should keep memory usage
|
||||
// roughly constant.
|
||||
+#ifdef __LP64__
|
||||
+#define PTHREAD_STACK_SIZE_DEFAULT ((8 * 1024 * 1024) - SIGNAL_STACK_SIZE_WITHOUT_GUARD)
|
||||
+#else
|
||||
#define PTHREAD_STACK_SIZE_DEFAULT ((1 * 1024 * 1024) - SIGNAL_STACK_SIZE_WITHOUT_GUARD)
|
||||
+#endif
|
||||
|
||||
// Leave room for a guard page in the internally created signal stacks.
|
||||
#define SIGNAL_STACK_SIZE (SIGNAL_STACK_SIZE_WITHOUT_GUARD + PTHREAD_GUARD_SIZE)
|
@ -0,0 +1,59 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sat, 1 Oct 2016 05:11:44 -0400
|
||||
Subject: [PATCH] make __stack_chk_guard read-only at runtime
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/__libc_init_main_thread.cpp | 15 ++++++++++++---
|
||||
1 file changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
|
||||
index 1b539f274..a6ddc64d5 100644
|
||||
--- a/libc/bionic/__libc_init_main_thread.cpp
|
||||
+++ b/libc/bionic/__libc_init_main_thread.cpp
|
||||
@@ -28,6 +28,9 @@
|
||||
|
||||
#include "libc_init_common.h"
|
||||
|
||||
+#include <limits.h>
|
||||
+#include <sys/mman.h>
|
||||
+
|
||||
#include <async_safe/log.h>
|
||||
|
||||
#include "private/KernelArgumentBlock.h"
|
||||
@@ -35,14 +38,14 @@
|
||||
#include "private/bionic_defs.h"
|
||||
#include "private/bionic_elf_tls.h"
|
||||
#include "private/bionic_globals.h"
|
||||
-#include "private/bionic_ssp.h"
|
||||
#include "pthread_internal.h"
|
||||
|
||||
extern "C" pid_t __getpid();
|
||||
extern "C" int __set_tid_address(int* tid_address);
|
||||
|
||||
// Declared in "private/bionic_ssp.h".
|
||||
-uintptr_t __stack_chk_guard = 0;
|
||||
+__attribute__((aligned(PAGE_SIZE)))
|
||||
+uintptr_t __stack_chk_guard[PAGE_SIZE / sizeof(uintptr_t)] = {0};
|
||||
|
||||
static pthread_internal_t main_thread;
|
||||
|
||||
@@ -107,10 +110,16 @@ void __init_tcb_dtv(bionic_tcb* tcb) {
|
||||
// Note in particular that it is not possible to return from any existing
|
||||
// stack frame with stack protector enabled after this function is called.
|
||||
extern "C" void android_reset_stack_guards() {
|
||||
+ if (mprotect(__stack_chk_guard, sizeof(__stack_chk_guard), PROT_READ|PROT_WRITE) == -1) {
|
||||
+ async_safe_fatal("mprotect __stack_chk_guard: %s", strerror(errno));
|
||||
+ }
|
||||
// The TLS stack guard is set from the global, so ensure that we've initialized the global
|
||||
// before we initialize the TLS. Dynamic executables will initialize their copy of the global
|
||||
// stack protector from the one in the main thread's TLS.
|
||||
- __libc_safe_arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard));
|
||||
+ __libc_safe_arc4random_buf(&__stack_chk_guard[0], sizeof(__stack_chk_guard[0]));
|
||||
+ if (mprotect(__stack_chk_guard, sizeof(__stack_chk_guard), PROT_READ) == -1) {
|
||||
+ async_safe_fatal("mprotect __stack_chk_guard: %s", strerror(errno));
|
||||
+ }
|
||||
__init_tcb_stack_guard(__get_bionic_tcb());
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sun, 12 Mar 2017 17:49:13 -0400
|
||||
Subject: [PATCH] on 64-bit, zero the leading stack canary byte
|
||||
|
||||
This reduces entropy of the canary from 64-bit to 56-bit in exchange for
|
||||
mitigating non-terminated C string overflows.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
libc/bionic/__libc_init_main_thread.cpp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/libc/bionic/__libc_init_main_thread.cpp b/libc/bionic/__libc_init_main_thread.cpp
|
||||
index a6ddc64d5..c03a8b79d 100644
|
||||
--- a/libc/bionic/__libc_init_main_thread.cpp
|
||||
+++ b/libc/bionic/__libc_init_main_thread.cpp
|
||||
@@ -49,6 +49,12 @@ uintptr_t __stack_chk_guard[PAGE_SIZE / sizeof(uintptr_t)] = {0};
|
||||
|
||||
static pthread_internal_t main_thread;
|
||||
|
||||
+#if __LP64__
|
||||
+static const uintptr_t canary_mask = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ ?
|
||||
+ 0xffffffffffffff00UL :
|
||||
+ 0x00ffffffffffffffUL;
|
||||
+#endif
|
||||
+
|
||||
// Setup for the main thread. For dynamic executables, this is called by the
|
||||
// linker _before_ libc is mapped in memory. This means that all writes to
|
||||
// globals from this function will apply to linker-private copies and will not
|
||||
@@ -117,6 +123,10 @@ extern "C" void android_reset_stack_guards() {
|
||||
// before we initialize the TLS. Dynamic executables will initialize their copy of the global
|
||||
// stack protector from the one in the main thread's TLS.
|
||||
__libc_safe_arc4random_buf(&__stack_chk_guard[0], sizeof(__stack_chk_guard[0]));
|
||||
+#if __LP64__
|
||||
+ // Sacrifice 8 bits of entropy on 64-bit to mitigate non-terminated C string overflows
|
||||
+ __stack_chk_guard[0] &= canary_mask;
|
||||
+#endif
|
||||
if (mprotect(__stack_chk_guard, sizeof(__stack_chk_guard), PROT_READ) == -1) {
|
||||
async_safe_fatal("mprotect __stack_chk_guard: %s", strerror(errno));
|
||||
}
|
639
Patches/LineageOS-21.0/android_bionic/0003-Hosts_Cache.patch
Normal file
639
Patches/LineageOS-21.0/android_bionic/0003-Hosts_Cache.patch
Normal file
@ -0,0 +1,639 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Marshall <tdm@cyngn.com>
|
||||
Date: Fri, 17 Jun 2016 16:38:12 -0700
|
||||
Subject: [PATCH] bionic: Sort and cache hosts file data for fast lookup
|
||||
|
||||
The hosts file is normally searched linearly. This is very slow when
|
||||
the file is large. To mitigate this, read the hosts file and sort the
|
||||
entries in an in-memory cache. When an address is requested via
|
||||
gethostbyname or getaddrinfo, binary search the cache.
|
||||
|
||||
In case where the cache is not available, return a suitable error code
|
||||
and fall back to the existing lookup code.
|
||||
|
||||
This has been written to behave as much like the existing lookup code as
|
||||
possible. But note bionic and glibc differ in behavior for some corner
|
||||
cases. Choose the most standard compliant behavior for these where
|
||||
possible. Otherwise choose the behavior that seems most reasonable.
|
||||
|
||||
RM-290
|
||||
|
||||
Change-Id: I3b322883cbc48b0d76a0ce9d149b59faaac1dc58
|
||||
(cherry picked from commit ed4c3a6bd449a4ed70645071a440ae146f194116)
|
||||
---
|
||||
libc/dns/net/getaddrinfo.c | 10 +
|
||||
libc/dns/net/hosts_cache.c | 520 +++++++++++++++++++++++++++++++++++++
|
||||
libc/dns/net/hosts_cache.h | 23 ++
|
||||
libc/dns/net/sethostent.c | 7 +
|
||||
4 files changed, 560 insertions(+)
|
||||
create mode 100644 libc/dns/net/hosts_cache.c
|
||||
create mode 100644 libc/dns/net/hosts_cache.h
|
||||
|
||||
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
|
||||
index d0c11d2b0..cc94b21e2 100644
|
||||
--- a/libc/dns/net/getaddrinfo.c
|
||||
+++ b/libc/dns/net/getaddrinfo.c
|
||||
@@ -109,6 +109,8 @@
|
||||
#include "nsswitch.h"
|
||||
#include "private/bionic_defs.h"
|
||||
|
||||
+#include "hosts_cache.h"
|
||||
+
|
||||
typedef union sockaddr_union {
|
||||
struct sockaddr generic;
|
||||
struct sockaddr_in in;
|
||||
@@ -2125,6 +2127,14 @@ _files_getaddrinfo(void *rv, void *cb_data, va_list ap)
|
||||
name = va_arg(ap, char *);
|
||||
pai = va_arg(ap, struct addrinfo *);
|
||||
|
||||
+ memset(&sentinel, 0, sizeof(sentinel));
|
||||
+ cur = &sentinel;
|
||||
+ int gai_error = hc_getaddrinfo(name, NULL, pai, &cur);
|
||||
+ if (gai_error != EAI_SYSTEM) {
|
||||
+ *((struct addrinfo **)rv) = sentinel.ai_next;
|
||||
+ return (gai_error == 0 ? NS_SUCCESS : NS_NOTFOUND);
|
||||
+ }
|
||||
+
|
||||
// fprintf(stderr, "_files_getaddrinfo() name = '%s'\n", name);
|
||||
memset(&sentinel, 0, sizeof(sentinel));
|
||||
cur = &sentinel;
|
||||
diff --git a/libc/dns/net/hosts_cache.c b/libc/dns/net/hosts_cache.c
|
||||
new file mode 100644
|
||||
index 000000000..52d29e032
|
||||
--- /dev/null
|
||||
+++ b/libc/dns/net/hosts_cache.c
|
||||
@@ -0,0 +1,520 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 The CyanogenMod 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.
|
||||
+ */
|
||||
+
|
||||
+#include <fcntl.h>
|
||||
+#include <netdb.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <string.h>
|
||||
+#include <ctype.h>
|
||||
+#include <strings.h>
|
||||
+#include <sys/file.h>
|
||||
+#include <sys/mman.h>
|
||||
+#include <sys/socket.h>
|
||||
+#include <sys/stat.h>
|
||||
+#include <sys/types.h>
|
||||
+#include <unistd.h>
|
||||
+#include <utime.h>
|
||||
+#include <pthread.h>
|
||||
+
|
||||
+#include <netinet/in6.h>
|
||||
+#include <arpa/inet.h>
|
||||
+
|
||||
+#include "hostent.h"
|
||||
+#include "resolv_private.h"
|
||||
+
|
||||
+#define MAX_ADDRLEN (INET6_ADDRSTRLEN - (1 + 5))
|
||||
+#define MAX_HOSTLEN MAXHOSTNAMELEN
|
||||
+
|
||||
+#define ESTIMATED_LINELEN 32
|
||||
+#define HCFILE_ALLOC_SIZE 256
|
||||
+
|
||||
+/*
|
||||
+ * Host cache entry for hcfile.c_data.
|
||||
+ * Offsets are into hcfile.h_data.
|
||||
+ * Strings are *not* terminated by NULL, but by whitespace (isspace) or '#'.
|
||||
+ * Use hstr* functions with these.
|
||||
+ */
|
||||
+struct hcent
|
||||
+{
|
||||
+ uint32_t addr;
|
||||
+ uint32_t name;
|
||||
+};
|
||||
+
|
||||
+/*
|
||||
+ * Overall host cache file state.
|
||||
+ */
|
||||
+struct hcfile
|
||||
+{
|
||||
+ int h_fd;
|
||||
+ struct stat h_st;
|
||||
+ char *h_data;
|
||||
+
|
||||
+ uint32_t c_alloc;
|
||||
+ uint32_t c_len;
|
||||
+ struct hcent *c_data;
|
||||
+};
|
||||
+static struct hcfile hcfile;
|
||||
+static pthread_mutex_t hclock = PTHREAD_MUTEX_INITIALIZER;
|
||||
+
|
||||
+static size_t hstrlen(const char *s)
|
||||
+{
|
||||
+ const char *p = s;
|
||||
+ while (*p && *p != '#' && !isspace(*p))
|
||||
+ ++p;
|
||||
+ return p - s;
|
||||
+}
|
||||
+
|
||||
+static int hstrcmp(const char *a, const char *b)
|
||||
+{
|
||||
+ size_t alen = hstrlen(a);
|
||||
+ size_t blen = hstrlen(b);
|
||||
+ int res = strncmp(a, b, MIN(alen, blen));
|
||||
+ if (res == 0)
|
||||
+ res = alen - blen;
|
||||
+ return res;
|
||||
+}
|
||||
+
|
||||
+static char *hstrcpy(char *dest, const char *src)
|
||||
+{
|
||||
+ size_t len = hstrlen(src);
|
||||
+ memcpy(dest, src, len);
|
||||
+ dest[len] = '\0';
|
||||
+ return dest;
|
||||
+}
|
||||
+
|
||||
+static char *hstrdup(const char *s)
|
||||
+{
|
||||
+ size_t len = hstrlen(s);
|
||||
+ char *dest = (char *)malloc(len + 1);
|
||||
+ if (!dest)
|
||||
+ return NULL;
|
||||
+ memcpy(dest, s, len);
|
||||
+ dest[len] = '\0';
|
||||
+ return dest;
|
||||
+}
|
||||
+
|
||||
+static int cmp_hcent_name(const void *a, const void *b)
|
||||
+{
|
||||
+ struct hcent *ea = (struct hcent *)a;
|
||||
+ const char *na = hcfile.h_data + ea->name;
|
||||
+ struct hcent *eb = (struct hcent *)b;
|
||||
+ const char *nb = hcfile.h_data + eb->name;
|
||||
+
|
||||
+ return hstrcmp(na, nb);
|
||||
+}
|
||||
+
|
||||
+static struct hcent *_hcfindname(const char *name)
|
||||
+{
|
||||
+ size_t first, last, mid;
|
||||
+ struct hcent *cur = NULL;
|
||||
+ int cmp;
|
||||
+
|
||||
+ if (hcfile.c_len == 0)
|
||||
+ return NULL;
|
||||
+
|
||||
+ first = 0;
|
||||
+ last = hcfile.c_len - 1;
|
||||
+ mid = (first + last) / 2;
|
||||
+ while (first <= last) {
|
||||
+ cur = hcfile.c_data + mid;
|
||||
+ cmp = hstrcmp(hcfile.h_data + cur->name, name);
|
||||
+ if (cmp == 0)
|
||||
+ goto found;
|
||||
+ if (cmp < 0)
|
||||
+ first = mid + 1;
|
||||
+ else {
|
||||
+ if (mid > 0)
|
||||
+ last = mid - 1;
|
||||
+ else
|
||||
+ return NULL;
|
||||
+ }
|
||||
+ mid = (first + last) / 2;
|
||||
+ }
|
||||
+ return NULL;
|
||||
+
|
||||
+found:
|
||||
+ while (cur > hcfile.c_data) {
|
||||
+ struct hcent *prev = cur - 1;
|
||||
+ cmp = cmp_hcent_name(cur, prev);
|
||||
+ if (cmp)
|
||||
+ break;
|
||||
+ cur = prev;
|
||||
+ }
|
||||
+
|
||||
+ return cur;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Find next name on line, if any.
|
||||
+ *
|
||||
+ * Assumes that line is terminated by LF.
|
||||
+ */
|
||||
+static const char *_hcnextname(const char *name)
|
||||
+{
|
||||
+ while (!isspace(*name)) {
|
||||
+ if (*name == '#')
|
||||
+ return NULL;
|
||||
+ ++name;
|
||||
+ }
|
||||
+ while (isspace(*name)) {
|
||||
+ if (*name == '\n')
|
||||
+ return NULL;
|
||||
+ ++name;
|
||||
+ }
|
||||
+ if (*name == '#')
|
||||
+ return NULL;
|
||||
+ return name;
|
||||
+}
|
||||
+
|
||||
+static int _hcfilemmap(void)
|
||||
+{
|
||||
+ struct stat st;
|
||||
+ int h_fd;
|
||||
+ char *h_addr;
|
||||
+ const char *p, *pend;
|
||||
+ uint32_t c_alloc;
|
||||
+
|
||||
+ h_fd = open(_PATH_HOSTS, O_RDONLY);
|
||||
+ if (h_fd < 0)
|
||||
+ return -1;
|
||||
+ if (flock(h_fd, LOCK_EX) != 0) {
|
||||
+ close(h_fd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (hcfile.h_data) {
|
||||
+ memset(&st, 0, sizeof(st));
|
||||
+ if (fstat(h_fd, &st) == 0) {
|
||||
+ if (st.st_size == hcfile.h_st.st_size &&
|
||||
+ st.st_mtime == hcfile.h_st.st_mtime) {
|
||||
+ flock(h_fd, LOCK_UN);
|
||||
+ close(h_fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ free(hcfile.c_data);
|
||||
+ munmap(hcfile.h_data, hcfile.h_st.st_size);
|
||||
+ close(hcfile.h_fd);
|
||||
+ memset(&hcfile, 0, sizeof(struct hcfile));
|
||||
+ }
|
||||
+
|
||||
+ if (fstat(h_fd, &st) != 0) {
|
||||
+ flock(h_fd, LOCK_UN);
|
||||
+ close(h_fd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+ h_addr = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, h_fd, 0);
|
||||
+ if (h_addr == MAP_FAILED) {
|
||||
+ flock(h_fd, LOCK_UN);
|
||||
+ close(h_fd);
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ hcfile.h_fd = h_fd;
|
||||
+ hcfile.h_st = st;
|
||||
+ hcfile.h_data = h_addr;
|
||||
+
|
||||
+ c_alloc = 0;
|
||||
+ /*
|
||||
+ * Do an initial allocation if the file is "large". Estimate
|
||||
+ * 32 bytes per line and define "large" as more than half of
|
||||
+ * the alloc growth size (256 entries).
|
||||
+ */
|
||||
+ if (st.st_size >= ESTIMATED_LINELEN * HCFILE_ALLOC_SIZE / 2) {
|
||||
+ c_alloc = st.st_size / ESTIMATED_LINELEN;
|
||||
+ hcfile.c_data = malloc(c_alloc * sizeof(struct hcent));
|
||||
+ if (!hcfile.c_data) {
|
||||
+ goto oom;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ p = (const char *)h_addr;
|
||||
+ pend = p + st.st_size;
|
||||
+ while (p < pend) {
|
||||
+ const char *eol, *addr, *name;
|
||||
+ size_t len;
|
||||
+ addr = p;
|
||||
+ eol = memchr(p, '\n', pend - p);
|
||||
+ if (!eol)
|
||||
+ break;
|
||||
+ p = eol + 1;
|
||||
+ if (*addr == '#' || *addr == '\n')
|
||||
+ continue;
|
||||
+ len = hstrlen(addr);
|
||||
+ if (len > MAX_ADDRLEN)
|
||||
+ continue;
|
||||
+ name = addr + len;
|
||||
+ while (name < eol && isspace(*name))
|
||||
+ ++name;
|
||||
+ while (name < eol) {
|
||||
+ len = hstrlen(name);
|
||||
+ if (len == 0)
|
||||
+ break;
|
||||
+ if (len < MAX_HOSTLEN) {
|
||||
+ struct hcent *ent;
|
||||
+ if (c_alloc <= hcfile.c_len) {
|
||||
+ struct hcent *c_data;
|
||||
+ c_alloc += HCFILE_ALLOC_SIZE;
|
||||
+ c_data = realloc(hcfile.c_data, c_alloc * sizeof(struct hcent));
|
||||
+ if (!c_data) {
|
||||
+ goto oom;
|
||||
+ }
|
||||
+ hcfile.c_data = c_data;
|
||||
+ }
|
||||
+ ent = hcfile.c_data + hcfile.c_len;
|
||||
+ ent->addr = addr - h_addr;
|
||||
+ ent->name = name - h_addr;
|
||||
+ ++hcfile.c_len;
|
||||
+ }
|
||||
+ name += len;
|
||||
+ while (name < eol && isspace(*name))
|
||||
+ ++name;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ qsort(hcfile.c_data, hcfile.c_len,
|
||||
+ sizeof(struct hcent), cmp_hcent_name);
|
||||
+
|
||||
+ flock(h_fd, LOCK_UN);
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+oom:
|
||||
+ free(hcfile.c_data);
|
||||
+ munmap(hcfile.h_data, hcfile.h_st.st_size);
|
||||
+ flock(hcfile.h_fd, LOCK_UN);
|
||||
+ close(hcfile.h_fd);
|
||||
+ memset(&hcfile, 0, sizeof(struct hcfile));
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Caching version of getaddrinfo.
|
||||
+ *
|
||||
+ * If we find the requested host name in the cache, use getaddrinfo to
|
||||
+ * populate the result for each address we find.
|
||||
+ *
|
||||
+ * Note glibc and bionic differ in the handling of ai_canonname. POSIX
|
||||
+ * says that ai_canonname is only populated in the first result entry.
|
||||
+ * glibc does this. bionic populates ai_canonname in all result entries.
|
||||
+ * We choose the POSIX/glibc way here.
|
||||
+ */
|
||||
+int hc_getaddrinfo(const char *host, const char *service,
|
||||
+ const struct addrinfo *hints,
|
||||
+ struct addrinfo **result)
|
||||
+{
|
||||
+ int ret = 0;
|
||||
+ struct hcent *ent, *cur;
|
||||
+ struct addrinfo *ai;
|
||||
+ struct addrinfo rhints;
|
||||
+ struct addrinfo *last;
|
||||
+ int canonname = 0;
|
||||
+ int cmp;
|
||||
+
|
||||
+ if (getenv("ANDROID_HOSTS_CACHE_DISABLE") != NULL)
|
||||
+ return EAI_SYSTEM;
|
||||
+
|
||||
+ /* Avoid needless work and recursion */
|
||||
+ if (hints && (hints->ai_flags & AI_NUMERICHOST))
|
||||
+ return EAI_SYSTEM;
|
||||
+ if (!host)
|
||||
+ return EAI_SYSTEM;
|
||||
+
|
||||
+ pthread_mutex_lock(&hclock);
|
||||
+
|
||||
+ if (_hcfilemmap() != 0) {
|
||||
+ ret = EAI_SYSTEM;
|
||||
+ goto out;
|
||||
+ }
|
||||
+ ent = _hcfindname(host);
|
||||
+ if (!ent) {
|
||||
+ ret = EAI_NONAME;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (hints) {
|
||||
+ canonname = (hints->ai_flags & AI_CANONNAME);
|
||||
+ memcpy(&rhints, hints, sizeof(rhints));
|
||||
+ rhints.ai_flags &= ~AI_CANONNAME;
|
||||
+ }
|
||||
+ else {
|
||||
+ memset(&rhints, 0, sizeof(rhints));
|
||||
+ }
|
||||
+ rhints.ai_flags |= AI_NUMERICHOST;
|
||||
+
|
||||
+ last = NULL;
|
||||
+ cur = ent;
|
||||
+ do {
|
||||
+ char addrstr[MAX_ADDRLEN];
|
||||
+ struct addrinfo *res;
|
||||
+
|
||||
+ hstrcpy(addrstr, hcfile.h_data + cur->addr);
|
||||
+
|
||||
+ if (getaddrinfo(addrstr, service, &rhints, &res) == 0) {
|
||||
+ if (!last)
|
||||
+ (*result)->ai_next = res;
|
||||
+ else
|
||||
+ last->ai_next = res;
|
||||
+ last = res;
|
||||
+ while (last->ai_next)
|
||||
+ last = last->ai_next;
|
||||
+ }
|
||||
+
|
||||
+ if(cur + 1 >= hcfile.c_data + hcfile.c_len)
|
||||
+ break;
|
||||
+ cmp = cmp_hcent_name(cur, cur + 1);
|
||||
+ cur = cur + 1;
|
||||
+ }
|
||||
+ while (!cmp);
|
||||
+
|
||||
+ if (last == NULL) {
|
||||
+ /* This check is equivalent to (*result)->ai_next == NULL */
|
||||
+ ret = EAI_NODATA;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ if (canonname) {
|
||||
+ ai = (*result)->ai_next;
|
||||
+ free(ai->ai_canonname);
|
||||
+ ai->ai_canonname = hstrdup(hcfile.h_data + ent->name);
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ pthread_mutex_unlock(&hclock);
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * Caching version of gethtbyname.
|
||||
+ *
|
||||
+ * Note glibc and bionic differ in the handling of aliases. glibc returns
|
||||
+ * all aliases for all entries, regardless of whether they match h_addrtype.
|
||||
+ * bionic returns only the aliases for the first hosts entry. We return all
|
||||
+ * aliases for all IPv4 entries.
|
||||
+ *
|
||||
+ * Additionally, if an alias is IPv6 and the primary name for an alias also
|
||||
+ * has an IPv4 entry, glibc will return the IPv4 address(es), but bionic
|
||||
+ * will not. Neither do we.
|
||||
+ */
|
||||
+int hc_gethtbyname(const char *host, int af, struct getnamaddr *info)
|
||||
+{
|
||||
+ int ret = NETDB_SUCCESS;
|
||||
+ struct hcent *ent, *cur;
|
||||
+ int cmp;
|
||||
+ size_t addrlen;
|
||||
+ unsigned int naliases = 0;
|
||||
+ char *aliases[MAXALIASES];
|
||||
+ unsigned int naddrs = 0;
|
||||
+ char *addr_ptrs[MAXADDRS];
|
||||
+ unsigned int n;
|
||||
+
|
||||
+ if (getenv("ANDROID_HOSTS_CACHE_DISABLE") != NULL)
|
||||
+ return NETDB_INTERNAL;
|
||||
+
|
||||
+ switch (af) {
|
||||
+ case AF_INET: addrlen = NS_INADDRSZ; break;
|
||||
+ case AF_INET6: addrlen = NS_IN6ADDRSZ; break;
|
||||
+ default:
|
||||
+ return NETDB_INTERNAL;
|
||||
+ }
|
||||
+
|
||||
+ pthread_mutex_lock(&hclock);
|
||||
+
|
||||
+ if (_hcfilemmap() != 0) {
|
||||
+ ret = NETDB_INTERNAL;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ ent = _hcfindname(host);
|
||||
+ if (!ent) {
|
||||
+ ret = HOST_NOT_FOUND;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ cur = ent;
|
||||
+ do {
|
||||
+ char addr[16];
|
||||
+ char addrstr[MAX_ADDRLEN];
|
||||
+ char namestr[MAX_HOSTLEN];
|
||||
+ const char *name;
|
||||
+
|
||||
+ hstrcpy(addrstr, hcfile.h_data + cur->addr);
|
||||
+ if (inet_pton(af, addrstr, &addr) == 1) {
|
||||
+ char *aligned;
|
||||
+ /* First match is considered the official hostname */
|
||||
+ if (naddrs == 0) {
|
||||
+ hstrcpy(namestr, hcfile.h_data + cur->name);
|
||||
+ HENT_SCOPY(info->hp->h_name, namestr, info->buf, info->buflen);
|
||||
+ }
|
||||
+ for (name = hcfile.h_data + cur->name; name; name = _hcnextname(name)) {
|
||||
+ if (!hstrcmp(name, host))
|
||||
+ continue;
|
||||
+ hstrcpy(namestr, name);
|
||||
+ HENT_SCOPY(aliases[naliases], namestr, info->buf, info->buflen);
|
||||
+ ++naliases;
|
||||
+ if (naliases >= MAXALIASES)
|
||||
+ goto nospc;
|
||||
+ }
|
||||
+ aligned = (char *)ALIGN(info->buf);
|
||||
+ if (info->buf != aligned) {
|
||||
+ if ((ptrdiff_t)info->buflen < (aligned - info->buf))
|
||||
+ goto nospc;
|
||||
+ info->buflen -= (aligned - info->buf);
|
||||
+ info->buf = aligned;
|
||||
+ }
|
||||
+ HENT_COPY(addr_ptrs[naddrs], addr, addrlen, info->buf, info->buflen);
|
||||
+ ++naddrs;
|
||||
+ if (naddrs >= MAXADDRS)
|
||||
+ goto nospc;
|
||||
+ }
|
||||
+
|
||||
+ if(cur + 1 >= hcfile.c_data + hcfile.c_len)
|
||||
+ break;
|
||||
+ cmp = cmp_hcent_name(cur, cur + 1);
|
||||
+ cur = cur + 1;
|
||||
+ }
|
||||
+ while (!cmp);
|
||||
+
|
||||
+ if (naddrs == 0) {
|
||||
+ ret = HOST_NOT_FOUND;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ addr_ptrs[naddrs++] = NULL;
|
||||
+ aliases[naliases++] = NULL;
|
||||
+
|
||||
+ /* hp->h_name already populated */
|
||||
+ HENT_ARRAY(info->hp->h_aliases, naliases, info->buf, info->buflen);
|
||||
+ for (n = 0; n < naliases; ++n) {
|
||||
+ info->hp->h_aliases[n] = aliases[n];
|
||||
+ }
|
||||
+ info->hp->h_addrtype = af;
|
||||
+ info->hp->h_length = addrlen;
|
||||
+ HENT_ARRAY(info->hp->h_addr_list, naddrs, info->buf, info->buflen);
|
||||
+ for (n = 0; n < naddrs; ++n) {
|
||||
+ info->hp->h_addr_list[n] = addr_ptrs[n];
|
||||
+ }
|
||||
+
|
||||
+out:
|
||||
+ pthread_mutex_unlock(&hclock);
|
||||
+ *info->he = ret;
|
||||
+ return ret;
|
||||
+
|
||||
+nospc:
|
||||
+ ret = NETDB_INTERNAL;
|
||||
+ goto out;
|
||||
+}
|
||||
diff --git a/libc/dns/net/hosts_cache.h b/libc/dns/net/hosts_cache.h
|
||||
new file mode 100644
|
||||
index 000000000..fa5488f51
|
||||
--- /dev/null
|
||||
+++ b/libc/dns/net/hosts_cache.h
|
||||
@@ -0,0 +1,23 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2016 The CyanogenMod 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.
|
||||
+ */
|
||||
+
|
||||
+struct getnamaddr;
|
||||
+
|
||||
+int hc_getaddrinfo(const char *host, const char *service,
|
||||
+ const struct addrinfo *hints,
|
||||
+ struct addrinfo **result);
|
||||
+
|
||||
+int hc_gethtbyname(const char *host, int af, struct getnamaddr *info);
|
||||
diff --git a/libc/dns/net/sethostent.c b/libc/dns/net/sethostent.c
|
||||
index 5c4bdb5ab..5e4e174fa 100644
|
||||
--- a/libc/dns/net/sethostent.c
|
||||
+++ b/libc/dns/net/sethostent.c
|
||||
@@ -55,6 +55,8 @@ __RCSID("$NetBSD: sethostent.c,v 1.20 2014/03/17 13:24:23 christos Exp $");
|
||||
#include "hostent.h"
|
||||
#include "resolv_private.h"
|
||||
|
||||
+#include "hosts_cache.h"
|
||||
+
|
||||
#ifndef _REENTRANT
|
||||
void res_close(void);
|
||||
#endif
|
||||
@@ -109,6 +111,11 @@ _hf_gethtbyname(void *rv, void *cb_data, va_list ap)
|
||||
/* NOSTRICT skip string len */(void)va_arg(ap, int);
|
||||
af = va_arg(ap, int);
|
||||
|
||||
+ int rc = hc_gethtbyname(name, af, info);
|
||||
+ if (rc != NETDB_INTERNAL) {
|
||||
+ return (rc == NETDB_SUCCESS ? NS_SUCCESS : NS_NOTFOUND);
|
||||
+ }
|
||||
+
|
||||
#if 0
|
||||
{
|
||||
res_state res = __res_get_state();
|
@ -0,0 +1,69 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tom Marshall <tdm.code@gmail.com>
|
||||
Date: Thu, 16 Jan 2020 13:07:04 -0800
|
||||
Subject: [PATCH] bionic: Support wildcards in cached hosts file
|
||||
|
||||
If an exact name is not found in the hosts file and the host name
|
||||
contains at least one dot, search for entries of the form "*.domain",
|
||||
where domain is the portion of the host name after the first dot. If
|
||||
that is not found, repeat using the domain.
|
||||
|
||||
Example: a.b.c.example.com would search for the following in turn:
|
||||
a.b.c.example.com
|
||||
*.b.c.example.com
|
||||
*.c.example.com
|
||||
*.example.com
|
||||
*.com
|
||||
|
||||
Change-Id: I4b0bb81699151d5b371850daebf785e35ec9b180
|
||||
---
|
||||
libc/dns/net/hosts_cache.c | 29 ++++++++++++++++++++++++++++-
|
||||
1 file changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/dns/net/hosts_cache.c b/libc/dns/net/hosts_cache.c
|
||||
index 52d29e032..fc6370d0c 100644
|
||||
--- a/libc/dns/net/hosts_cache.c
|
||||
+++ b/libc/dns/net/hosts_cache.c
|
||||
@@ -117,7 +117,7 @@ static int cmp_hcent_name(const void *a, const void *b)
|
||||
return hstrcmp(na, nb);
|
||||
}
|
||||
|
||||
-static struct hcent *_hcfindname(const char *name)
|
||||
+static struct hcent *_hcfindname_exact(const char *name)
|
||||
{
|
||||
size_t first, last, mid;
|
||||
struct hcent *cur = NULL;
|
||||
@@ -158,6 +158,33 @@ found:
|
||||
return cur;
|
||||
}
|
||||
|
||||
+static struct hcent *_hcfindname(const char *name)
|
||||
+{
|
||||
+ struct hcent *ent;
|
||||
+ char namebuf[MAX_HOSTLEN];
|
||||
+ char *p;
|
||||
+ char *dot;
|
||||
+
|
||||
+ ent = _hcfindname_exact(name);
|
||||
+ if (!ent && strlen(name) < sizeof(namebuf)) {
|
||||
+ strcpy(namebuf, name);
|
||||
+ p = namebuf;
|
||||
+ do {
|
||||
+ dot = strchr(p, '.');
|
||||
+ if (!dot)
|
||||
+ break;
|
||||
+ if (dot > p) {
|
||||
+ *(dot - 1) = '*';
|
||||
+ ent = _hcfindname_exact(dot - 1);
|
||||
+ }
|
||||
+ p = dot + 1;
|
||||
+ }
|
||||
+ while (!ent);
|
||||
+ }
|
||||
+
|
||||
+ return ent;
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Find next name on line, if any.
|
||||
*
|
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Wed, 20 Apr 2022 00:40:52 -0400
|
||||
Subject: [PATCH] Add a toggle to disable /etc/hosts lookup
|
||||
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
Change-Id: I92679c57e73228dc194e61a86ea1a18b2ac90e04
|
||||
---
|
||||
libc/dns/net/getaddrinfo.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/libc/dns/net/getaddrinfo.c b/libc/dns/net/getaddrinfo.c
|
||||
index cc94b21e2..12294da04 100644
|
||||
--- a/libc/dns/net/getaddrinfo.c
|
||||
+++ b/libc/dns/net/getaddrinfo.c
|
||||
@@ -83,6 +83,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/socket.h>
|
||||
+#include <sys/system_properties.h>
|
||||
#include <sys/un.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -2127,6 +2128,11 @@ _files_getaddrinfo(void *rv, void *cb_data, va_list ap)
|
||||
name = va_arg(ap, char *);
|
||||
pai = va_arg(ap, struct addrinfo *);
|
||||
|
||||
+ char value[PROP_VALUE_MAX] = { 0 };
|
||||
+ if (__system_property_get("persist.security.hosts_disable", value) != 0)
|
||||
+ if (atoi(value) != 0 && strcmp(name, "localhost") != 0 && strcmp(name, "ip6-localhost") != 0)
|
||||
+ return NS_NOTFOUND;
|
||||
+
|
||||
memset(&sentinel, 0, sizeof(sentinel));
|
||||
cur = &sentinel;
|
||||
int gai_error = hc_getaddrinfo(name, NULL, pai, &cur);
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 19 Aug 2020 09:31:04 -0400
|
||||
Subject: [PATCH] reject updates with serialno constraints
|
||||
|
||||
---
|
||||
install/install.cpp | 13 ++-----------
|
||||
1 file changed, 2 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/install/install.cpp b/install/install.cpp
|
||||
index 9906a41f..e85a95c5 100644
|
||||
--- a/install/install.cpp
|
||||
+++ b/install/install.cpp
|
||||
@@ -234,17 +234,8 @@ bool CheckPackageMetadata(const std::map<std::string, std::string>& metadata, Ot
|
||||
|
||||
auto pkg_serial_no = get_value(metadata, "serialno");
|
||||
if (!pkg_serial_no.empty()) {
|
||||
- auto device_serial_no = android::base::GetProperty("ro.serialno", "");
|
||||
- bool serial_number_match = false;
|
||||
- for (const auto& number : android::base::Split(pkg_serial_no, "|")) {
|
||||
- if (device_serial_no == android::base::Trim(number)) {
|
||||
- serial_number_match = true;
|
||||
- }
|
||||
- }
|
||||
- if (!serial_number_match) {
|
||||
- LOG(ERROR) << "Package is for serial " << pkg_serial_no;
|
||||
- return false;
|
||||
- }
|
||||
+ LOG(ERROR) << "Serial number constraint not permitted: " << pkg_serial_no;
|
||||
+ return INSTALL_ERROR;
|
||||
} else if (ota_type == OtaType::BRICK) {
|
||||
const auto device_build_tag = android::base::GetProperty("ro.build.tags", "");
|
||||
if (device_build_tag.empty()) {
|
@ -0,0 +1,24 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 13 Sep 2016 22:05:56 -0400
|
||||
Subject: [PATCH] use -fwrapv when signed overflow checking is off
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
core/config_sanitizers.mk | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
|
||||
index 3507961833..01cb295bfe 100644
|
||||
--- a/core/config_sanitizers.mk
|
||||
+++ b/core/config_sanitizers.mk
|
||||
@@ -572,3 +572,9 @@ ifneq ($(findstring fsanitize,$(my_cflags)),)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
+
|
||||
+ifeq ($(filter signed-integer-overflow integer undefined,$(my_sanitize)),)
|
||||
+ ifeq ($(filter -ftrapv,$(my_cflags)),)
|
||||
+ my_cflags += -fwrapv
|
||||
+ endif
|
||||
+endif
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Thu, 17 Sep 2020 10:53:00 -0400
|
||||
Subject: [PATCH] disable enforce RRO for mainline devices
|
||||
|
||||
This is currently incompatible with exec-based spawning. This also
|
||||
impacts the wrapper spawning model for the stock OS which is available
|
||||
by default, making it an upstream bug rather than a missing feature for
|
||||
exec-based spawning in GrapheneOS.
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
target/product/generic_system.mk | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/target/product/generic_system.mk b/target/product/generic_system.mk
|
||||
index 08a7cdf83e..8ed85ab6fa 100644
|
||||
--- a/target/product/generic_system.mk
|
||||
+++ b/target/product/generic_system.mk
|
||||
@@ -112,7 +112,7 @@ PRODUCT_COPY_FILES += \
|
||||
# Enable dynamic partition size
|
||||
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
|
||||
|
||||
-PRODUCT_ENFORCE_RRO_TARGETS := *
|
||||
+#PRODUCT_ENFORCE_RRO_TARGETS := *
|
||||
|
||||
PRODUCT_NAME := generic_system
|
||||
PRODUCT_BRAND := generic
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: flawedworld <flawedworld@flawed.world>
|
||||
Date: Mon, 7 Mar 2022 01:38:23 +0000
|
||||
Subject: [PATCH] only enable APEX on 6th/7th gen Pixel devices
|
||||
|
||||
Change-Id: Icffb72d8c3ed0e33e76538bb3427377c33c55ff9
|
||||
[tad@spotco.us]: adjusted for Lineage
|
||||
---
|
||||
target/product/generic_system.mk | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/target/product/generic_system.mk b/target/product/generic_system.mk
|
||||
index 8ed85ab6fa..7b9ed53281 100644
|
||||
--- a/target/product/generic_system.mk
|
||||
+++ b/target/product/generic_system.mk
|
||||
@@ -21,8 +21,10 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/languages_default.mk)
|
||||
# Add adb keys to debuggable AOSP builds (if they exist)
|
||||
$(call inherit-product-if-exists, vendor/google/security/adb/vendor_key.mk)
|
||||
|
||||
-# Enable updating of APEXes
|
||||
-$(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
|
||||
+# Enable updating of APEXes on 6th and 7th generation Pixel devices only
|
||||
+ifneq (,$(filter lineage_cheetah lineage_panther lineage_oriole lineage_raven lineage_bluejay lineage_lynx lineage_tangorpro lineage_felix, $(TARGET_PRODUCT)))
|
||||
+ $(call inherit-product, $(SRC_TARGET_DIR)/product/updatable_apex.mk)
|
||||
+endif
|
||||
|
||||
# Shared java libs
|
||||
PRODUCT_PACKAGES += \
|
@ -0,0 +1,65 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 23 Aug 2017 20:28:03 -0400
|
||||
Subject: [PATCH] use -fwrapv when signed overflow checking is off
|
||||
|
||||
13: 62bea80ab9189b81a8728b71b284b7afba9d5969
|
||||
---
|
||||
cc/cc.go | 2 ++
|
||||
cc/cc_test.go | 2 +-
|
||||
cc/sanitize.go | 14 ++++++++++++++
|
||||
3 files changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/cc/cc.go b/cc/cc.go
|
||||
index 9d5b8d894..01cae261a 100644
|
||||
--- a/cc/cc.go
|
||||
+++ b/cc/cc.go
|
||||
@@ -2052,6 +2052,8 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
|
||||
}
|
||||
if c.sanitize != nil {
|
||||
flags = c.sanitize.flags(ctx, flags)
|
||||
+ } else {
|
||||
+ flags.Local.CFlags = append(flags.Local.CFlags, "-fwrapv")
|
||||
}
|
||||
if c.coverage != nil {
|
||||
flags, deps = c.coverage.flags(ctx, flags, deps)
|
||||
diff --git a/cc/cc_test.go b/cc/cc_test.go
|
||||
index 3631f1998..af9498499 100644
|
||||
--- a/cc/cc_test.go
|
||||
+++ b/cc/cc_test.go
|
||||
@@ -4427,7 +4427,7 @@ func TestIncludeDirectoryOrdering(t *testing.T) {
|
||||
conly := []string{"-fPIC", "${config.CommonGlobalConlyflags}"}
|
||||
cppOnly := []string{"-fPIC", "${config.CommonGlobalCppflags}", "${config.DeviceGlobalCppflags}", "${config.ArmCppflags}"}
|
||||
|
||||
- cflags := []string{"-Werror", "-std=candcpp"}
|
||||
+ cflags := []string{"-Werror", "-std=candcpp", "-fwrapv"}
|
||||
cstd := []string{"-std=gnu17", "-std=conly"}
|
||||
cppstd := []string{"-std=gnu++20", "-std=cpp", "-fno-rtti"}
|
||||
|
||||
diff --git a/cc/sanitize.go b/cc/sanitize.go
|
||||
index 31c050018..38eeb12af 100644
|
||||
--- a/cc/sanitize.go
|
||||
+++ b/cc/sanitize.go
|
||||
@@ -787,8 +787,22 @@ func toDisableUnsignedShiftBaseChange(flags []string) bool {
|
||||
|
||||
func (s *sanitize) flags(ctx ModuleContext, flags Flags) Flags {
|
||||
if !s.Properties.SanitizerEnabled && !s.Properties.UbsanRuntimeDep {
|
||||
+ flags.Local.CFlags = append(flags.Local.CFlags, "-fwrapv")
|
||||
return flags
|
||||
}
|
||||
+
|
||||
+ wrapv := true
|
||||
+ for _, san := range s.Properties.Sanitizers {
|
||||
+ if san == "signed-integer-overflow" || san == "integer" || san == "undefined" {
|
||||
+ wrapv = false
|
||||
+ break
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if wrapv {
|
||||
+ flags.Local.CFlags = append(flags.Local.CFlags, "-fwrapv")
|
||||
+ }
|
||||
+
|
||||
sanProps := &s.Properties.SanitizeMutated
|
||||
|
||||
if Bool(sanProps.Address) {
|
@ -0,0 +1,21 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Thu, 5 Oct 2023 15:16:24 +0300
|
||||
Subject: [PATCH] mark hardened_malloc as bp2build_available
|
||||
|
||||
---
|
||||
android/allowlists/allowlists.go | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
|
||||
index b9d26f884..34c83e00c 100644
|
||||
--- a/android/allowlists/allowlists.go
|
||||
+++ b/android/allowlists/allowlists.go
|
||||
@@ -160,6 +160,7 @@ var (
|
||||
"external/guava": Bp2BuildDefaultTrueRecursively,
|
||||
"external/gwp_asan": Bp2BuildDefaultTrueRecursively,
|
||||
"external/hamcrest": Bp2BuildDefaultTrueRecursively,
|
||||
+ "external/hardened_malloc": Bp2BuildDefaultTrueRecursively,
|
||||
"external/icu": Bp2BuildDefaultTrueRecursively,
|
||||
"external/icu/android_icu4j": Bp2BuildDefaultFalse, // java rules incomplete
|
||||
"external/icu/icu4j": Bp2BuildDefaultFalse, // java rules incomplete
|
@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 18 Nov 2020 14:28:24 -0500
|
||||
Subject: [PATCH] constify JNINativeMethod table
|
||||
|
||||
---
|
||||
common/src/jni/main/cpp/conscrypt/native_crypto.cc | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/common/src/jni/main/cpp/conscrypt/native_crypto.cc b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
|
||||
index 6d831d03..db24fbc3 100644
|
||||
--- a/common/src/jni/main/cpp/conscrypt/native_crypto.cc
|
||||
+++ b/common/src/jni/main/cpp/conscrypt/native_crypto.cc
|
||||
@@ -10940,7 +10940,7 @@ static jlong NativeCrypto_SSL_get1_session(JNIEnv* env, jclass, jlong ssl_addres
|
||||
#define REF_X509_CRL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/OpenSSLX509CRL;"
|
||||
#define REF_SSL "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/NativeSsl;"
|
||||
#define REF_SSL_CTX "L" TO_STRING(JNI_JARJAR_PREFIX) "org/conscrypt/AbstractSessionContext;"
|
||||
-static JNINativeMethod sNativeCryptoMethods[] = {
|
||||
+static const JNINativeMethod sNativeCryptoMethods[] = {
|
||||
CONSCRYPT_NATIVE_METHOD(clinit, "()V"),
|
||||
CONSCRYPT_NATIVE_METHOD(CMAC_CTX_new, "()J"),
|
||||
CONSCRYPT_NATIVE_METHOD(CMAC_CTX_free, "(J)V"),
|
@ -0,0 +1,35 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: MSe1969 <mse1969@posteo.de>
|
||||
Date: Mon, 29 Oct 2018 12:14:17 +0100
|
||||
Subject: [PATCH] SUPL: Don't send IMSI / Phone number to SUPL server
|
||||
|
||||
Change-Id: I5ccc4d61e52ac11ef33f44618d0e610089885b87
|
||||
---
|
||||
.../android/server/location/gnss/GnssLocationProvider.java | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
|
||||
index 0386ee454278..af7dcc7d917a 100644
|
||||
--- a/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
|
||||
+++ b/services/core/java/com/android/server/location/gnss/GnssLocationProvider.java
|
||||
@@ -1798,6 +1798,11 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
int type = AGPS_SETID_TYPE_NONE;
|
||||
String setId = null;
|
||||
|
||||
+ /*
|
||||
+ * We don't want to tell Google our IMSI or phone number to spy on us!
|
||||
+ * As devices w/o SIM card also have working GPS, providing this data does
|
||||
+ * not seem to add a lot of value, at least not for the device holder
|
||||
+ *
|
||||
int subId = SubscriptionManager.getDefaultDataSubscriptionId();
|
||||
if (mGnssConfiguration.isActiveSimEmergencySuplEnabled() && mNIHandler.getInEmergency()
|
||||
&& mNetworkConnectivityHandler.getActiveSubId() >= 0) {
|
||||
@@ -1818,7 +1823,7 @@ public class GnssLocationProvider extends AbstractLocationProvider implements
|
||||
// This means the framework has the SIM card.
|
||||
type = AGPS_SETID_TYPE_MSISDN;
|
||||
}
|
||||
- }
|
||||
+ } */
|
||||
|
||||
mGnssNative.setAgpsSetId(type, (setId == null) ? "" : setId);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 12 Sep 2017 01:52:11 -0400
|
||||
Subject: [PATCH] use permanent fingerprint lockout immediately
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
.../sensors/fingerprint/hidl/LockoutFrameworkImpl.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
|
||||
index 0730c672acd9..cbd7a8963eb1 100644
|
||||
--- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
|
||||
+++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/LockoutFrameworkImpl.java
|
||||
@@ -43,7 +43,7 @@ public class LockoutFrameworkImpl implements LockoutTracker {
|
||||
private static final String ACTION_LOCKOUT_RESET =
|
||||
"com.android.server.biometrics.sensors.fingerprint.ACTION_LOCKOUT_RESET";
|
||||
private static final int MAX_FAILED_ATTEMPTS_LOCKOUT_TIMED = 5;
|
||||
- private static final int MAX_FAILED_ATTEMPTS_LOCKOUT_PERMANENT = 20;
|
||||
+ private static final int MAX_FAILED_ATTEMPTS_LOCKOUT_PERMANENT = 5;
|
||||
private static final long FAIL_LOCKOUT_TIMEOUT_MS = 30 * 1000;
|
||||
private static final String KEY_LOCKOUT_RESET_USER = "lockout_reset_user";
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Thu, 18 Aug 2022 10:04:46 +0300
|
||||
Subject: [PATCH] fix DevicePolicyManager#logoutUser() never succeeding
|
||||
|
||||
To succeed, userId to switch to needs to be set with setLogoutUserIdLocked(), but this is not done
|
||||
in both callers of this method (both of which are "End session" buttons), making them no-ops.
|
||||
---
|
||||
.../server/devicepolicy/DevicePolicyManagerService.java | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
index cc8da148d272..6a2d88e49c27 100644
|
||||
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
@@ -12698,6 +12698,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
Preconditions.checkCallAuthorization(canManageUsers(caller)
|
||||
|| hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS));
|
||||
|
||||
+ synchronized (getLockObject()) {
|
||||
+ if (getLogoutUserIdUnchecked() == UserHandle.USER_NULL) {
|
||||
+ setLogoutUserIdLocked(UserHandle.USER_SYSTEM);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
int currentUserId = getCurrentForegroundUserId();
|
||||
if (VERBOSE_LOG) {
|
||||
Slogf.v(LOG_TAG, "logout() called by uid %d; current user is %d", caller.getUid(),
|
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: flawedworld <flawedworld@flawed.world>
|
||||
Date: Fri, 15 Oct 2021 17:07:13 +0100
|
||||
Subject: [PATCH] enable secondary user logout support by default
|
||||
|
||||
Ported from 11, 12 moved the isLogoutEnabled boolean to ActiveAdmin.java
|
||||
---
|
||||
.../java/com/android/server/devicepolicy/ActiveAdmin.java | 2 +-
|
||||
.../server/devicepolicy/DevicePolicyManagerService.java | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java b/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
|
||||
index 17638fcaba68..7e416811c45a 100644
|
||||
--- a/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
|
||||
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
|
||||
@@ -234,7 +234,7 @@ class ActiveAdmin {
|
||||
boolean requireAutoTime = false;
|
||||
boolean forceEphemeralUsers = false;
|
||||
boolean isNetworkLoggingEnabled = false;
|
||||
- boolean isLogoutEnabled = false;
|
||||
+ boolean isLogoutEnabled = true;
|
||||
|
||||
// one notification after enabling + one more after reboots
|
||||
static final int DEF_MAXIMUM_NETWORK_LOGGING_NOTIFICATIONS_SHOWN = 2;
|
||||
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
index fb07763f58d6..cc8da148d272 100644
|
||||
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
|
||||
@@ -18919,11 +18919,11 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
@Override
|
||||
public boolean isLogoutEnabled() {
|
||||
if (!mHasFeature) {
|
||||
- return false;
|
||||
+ return true;
|
||||
}
|
||||
synchronized (getLockObject()) {
|
||||
ActiveAdmin deviceOwner = getDeviceOwnerAdminLocked();
|
||||
- return (deviceOwner != null) && deviceOwner.isLogoutEnabled;
|
||||
+ return (deviceOwner == null) || deviceOwner.isLogoutEnabled;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 6 Sep 2017 21:40:48 -0400
|
||||
Subject: [PATCH] always set deprecated Build.SERIAL to UNKNOWN
|
||||
|
||||
Only support fetching the serial number via the new Build.getSerial()
|
||||
requiring the READ_PHONE_STATE permission.
|
||||
---
|
||||
.../java/com/android/server/am/ActivityManagerService.java | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
index 89b53aab1539..0d95e615911d 100644
|
||||
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
@@ -4707,12 +4707,7 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
|
||||
ProfilerInfo profilerInfo = mAppProfiler.setupProfilerInfoLocked(thread, app, instr);
|
||||
|
||||
- // We deprecated Build.SERIAL and it is not accessible to
|
||||
- // Instant Apps and target APIs higher than O MR1. Since access to the serial
|
||||
- // is now behind a permission we push down the value.
|
||||
- final String buildSerial = (!appInfo.isInstantApp()
|
||||
- && appInfo.targetSdkVersion < Build.VERSION_CODES.P)
|
||||
- ? sTheRealBuildSerial : Build.UNKNOWN;
|
||||
+ final String buildSerial = Build.UNKNOWN;
|
||||
|
||||
// Figure out whether the app needs to run in autofill compat mode.
|
||||
AutofillOptions autofillOptions = null;
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Mon, 18 Mar 2019 01:54:30 +0200
|
||||
Subject: [PATCH] stop auto-granting location to system browsers
|
||||
|
||||
---
|
||||
.../pm/permission/DefaultPermissionGrantPolicy.java | 13 -------------
|
||||
1 file changed, 13 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
index f7f76aaaee16..2c5b6ddc876e 100644
|
||||
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
@@ -776,19 +776,6 @@ final class DefaultPermissionGrantPolicy {
|
||||
Intent.CATEGORY_APP_EMAIL, userId),
|
||||
userId, CONTACTS_PERMISSIONS, CALENDAR_PERMISSIONS);
|
||||
|
||||
- // Browser
|
||||
- String browserPackage = ArrayUtils.firstOrNull(getKnownPackages(
|
||||
- KnownPackages.PACKAGE_BROWSER, userId));
|
||||
- if (browserPackage == null) {
|
||||
- browserPackage = getDefaultSystemHandlerActivityPackageForCategory(pm,
|
||||
- Intent.CATEGORY_APP_BROWSER, userId);
|
||||
- if (!pm.isSystemPackage(browserPackage)) {
|
||||
- browserPackage = null;
|
||||
- }
|
||||
- }
|
||||
- grantPermissionsToPackage(pm, browserPackage, userId, false /* ignoreSystemPackage */,
|
||||
- true /*whitelistRestrictedPermissions*/, FOREGROUND_LOCATION_PERMISSIONS);
|
||||
-
|
||||
// Voice interaction
|
||||
if (voiceInteractPackageNames != null) {
|
||||
for (String voiceInteractPackageName : voiceInteractPackageNames) {
|
@ -0,0 +1,509 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 9 Oct 2023 14:21:11 +0300
|
||||
Subject: [PATCH] constify JNINativeMethod tables
|
||||
|
||||
fd '.+\.(c|cpp|cc)$' --exec sed -i 's/static JNINativeMethod/static const JNINativeMethod/'
|
||||
---
|
||||
.../jni/com_android_commands_hid_Device.cpp | 2 +-
|
||||
.../com_android_commands_uinput_Device.cpp | 2 +-
|
||||
core/jni/LayoutlibLoader.cpp | 2 +-
|
||||
core/jni/android_app_ActivityThread.cpp | 2 +-
|
||||
core/jni/android_media_MediaMetricsJNI.cpp | 238 +++++++++++++++++-
|
||||
core/jni/android_os_HidlMemory.cpp | 2 +-
|
||||
core/jni/android_os_HwBinder.cpp | 2 +-
|
||||
core/jni/android_os_HwBlob.cpp | 2 +-
|
||||
core/jni/android_os_HwParcel.cpp | 2 +-
|
||||
core/jni/android_os_HwRemoteBinder.cpp | 2 +-
|
||||
.../android_graphics_DisplayListCanvas.cpp | 2 +-
|
||||
media/jni/android_media_ImageWriter.cpp | 4 +-
|
||||
media/jni/android_media_MediaSync.cpp | 2 +-
|
||||
.../jni/soundpool/android_media_SoundPool.cpp | 2 +-
|
||||
.../com_android_server_UsbAlsaMidiDevice.cpp | 2 +-
|
||||
...rver_companion_virtual_InputController.cpp | 2 +-
|
||||
.../com_android_server_tv_TvUinputBridge.cpp | 2 +-
|
||||
...oid_view_tests_ChoreographerNativeTest.cpp | 2 +-
|
||||
18 files changed, 255 insertions(+), 19 deletions(-)
|
||||
mode change 120000 => 100644 core/jni/android_media_MediaMetricsJNI.cpp
|
||||
|
||||
diff --git a/cmds/hid/jni/com_android_commands_hid_Device.cpp b/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
||||
index 8b8d361edbd4..60aa5e4267aa 100644
|
||||
--- a/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
||||
+++ b/cmds/hid/jni/com_android_commands_hid_Device.cpp
|
||||
@@ -368,7 +368,7 @@ static void closeDevice(JNIEnv* /* env */, jclass /* clazz */, jlong ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod sMethods[] = {
|
||||
+static const JNINativeMethod sMethods[] = {
|
||||
{"nativeOpenDevice",
|
||||
"(Ljava/lang/String;IIII[B"
|
||||
"Lcom/android/commands/hid/Device$DeviceCallback;)J",
|
||||
diff --git a/cmds/uinput/jni/com_android_commands_uinput_Device.cpp b/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
||||
index a78a46504684..5752be8829cb 100644
|
||||
--- a/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
||||
+++ b/cmds/uinput/jni/com_android_commands_uinput_Device.cpp
|
||||
@@ -325,7 +325,7 @@ static jint getEvdevInputPropByLabel(JNIEnv* env, jclass /* clazz */, jstring ra
|
||||
return InputEventLookup::getLinuxEvdevInputPropByLabel(label.c_str()).value_or(-1);
|
||||
}
|
||||
|
||||
-static JNINativeMethod sMethods[] = {
|
||||
+static const JNINativeMethod sMethods[] = {
|
||||
{"nativeOpenUinputDevice",
|
||||
"(Ljava/lang/String;IIIIIILjava/lang/String;"
|
||||
"Lcom/android/commands/uinput/Device$DeviceCallback;)J",
|
||||
diff --git a/core/jni/LayoutlibLoader.cpp b/core/jni/LayoutlibLoader.cpp
|
||||
index 200ddefc3bbc..e7acbdfbddf6 100644
|
||||
--- a/core/jni/LayoutlibLoader.cpp
|
||||
+++ b/core/jni/LayoutlibLoader.cpp
|
||||
@@ -69,7 +69,7 @@ static void NativeAllocationRegistry_Delegate_nativeApplyFreeFunction(JNIEnv*, j
|
||||
nativeFreeFunction(nativePtr);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(NativeAllocationRegistry_Delegate, nativeApplyFreeFunction, "(JJ)V"),
|
||||
};
|
||||
|
||||
diff --git a/core/jni/android_app_ActivityThread.cpp b/core/jni/android_app_ActivityThread.cpp
|
||||
index e25ba76cbbeb..16a8d4656179 100644
|
||||
--- a/core/jni/android_app_ActivityThread.cpp
|
||||
+++ b/core/jni/android_app_ActivityThread.cpp
|
||||
@@ -33,7 +33,7 @@ static void android_app_ActivityThread_initZygoteChildHeapProfiling(JNIEnv* env,
|
||||
android_mallopt(M_INIT_ZYGOTE_CHILD_PROFILING, nullptr, 0);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gActivityThreadMethods[] = {
|
||||
+static const JNINativeMethod gActivityThreadMethods[] = {
|
||||
// ------------ Regular JNI ------------------
|
||||
{ "nPurgePendingResources", "()V",
|
||||
(void*) android_app_ActivityThread_purgePendingResources },
|
||||
diff --git a/core/jni/android_media_MediaMetricsJNI.cpp b/core/jni/android_media_MediaMetricsJNI.cpp
|
||||
deleted file mode 120000
|
||||
index 3204317cab68..000000000000
|
||||
--- a/core/jni/android_media_MediaMetricsJNI.cpp
|
||||
+++ /dev/null
|
||||
@@ -1 +0,0 @@
|
||||
-../../media/jni/android_media_MediaMetricsJNI.cpp
|
||||
\ No newline at end of file
|
||||
diff --git a/core/jni/android_media_MediaMetricsJNI.cpp b/core/jni/android_media_MediaMetricsJNI.cpp
|
||||
new file mode 100644
|
||||
index 000000000000..2769dbc430ba
|
||||
--- /dev/null
|
||||
+++ b/core/jni/android_media_MediaMetricsJNI.cpp
|
||||
@@ -0,0 +1,237 @@
|
||||
+/*
|
||||
+ * Copyright 2017, 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.
|
||||
+ */
|
||||
+
|
||||
+#define LOG_TAG "MediaMetricsJNI"
|
||||
+
|
||||
+#include <binder/Parcel.h>
|
||||
+#include <jni.h>
|
||||
+#include <media/MediaMetricsItem.h>
|
||||
+#include <nativehelper/JNIHelp.h>
|
||||
+#include <variant>
|
||||
+
|
||||
+#include "android_media_MediaMetricsJNI.h"
|
||||
+#include "android_os_Parcel.h"
|
||||
+#include "android_runtime/AndroidRuntime.h"
|
||||
+
|
||||
+// This source file is compiled and linked into:
|
||||
+// core/jni/ (libandroid_runtime.so)
|
||||
+
|
||||
+namespace android {
|
||||
+
|
||||
+namespace {
|
||||
+struct BundleHelper {
|
||||
+ BundleHelper(JNIEnv* _env, jobject _bundle)
|
||||
+ : env(_env)
|
||||
+ , clazzBundle(env->FindClass("android/os/PersistableBundle"))
|
||||
+ , putIntID(env->GetMethodID(clazzBundle, "putInt", "(Ljava/lang/String;I)V"))
|
||||
+ , putLongID(env->GetMethodID(clazzBundle, "putLong", "(Ljava/lang/String;J)V"))
|
||||
+ , putDoubleID(env->GetMethodID(clazzBundle, "putDouble", "(Ljava/lang/String;D)V"))
|
||||
+ , putStringID(env->GetMethodID(clazzBundle,
|
||||
+ "putString", "(Ljava/lang/String;Ljava/lang/String;)V"))
|
||||
+ , constructID(env->GetMethodID(clazzBundle, "<init>", "()V"))
|
||||
+ , bundle(_bundle == nullptr ? env->NewObject(clazzBundle, constructID) : _bundle)
|
||||
+ { }
|
||||
+
|
||||
+ JNIEnv* const env;
|
||||
+ const jclass clazzBundle;
|
||||
+ const jmethodID putIntID;
|
||||
+ const jmethodID putLongID;
|
||||
+ const jmethodID putDoubleID;
|
||||
+ const jmethodID putStringID;
|
||||
+ const jmethodID constructID;
|
||||
+ jobject const bundle;
|
||||
+
|
||||
+ // We use templated put to access mediametrics::Item based on data type not type enum.
|
||||
+ // See std::variant and std::visit.
|
||||
+ template<typename T>
|
||||
+ void put(jstring keyName, const T& value) = delete;
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const int32_t& value) {
|
||||
+ env->CallVoidMethod(bundle, putIntID, keyName, (jint)value);
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const int64_t& value) {
|
||||
+ env->CallVoidMethod(bundle, putLongID, keyName, (jlong)value);
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const double& value) {
|
||||
+ env->CallVoidMethod(bundle, putDoubleID, keyName, (jdouble)value);
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const std::string& value) {
|
||||
+ env->CallVoidMethod(bundle, putStringID, keyName, env->NewStringUTF(value.c_str()));
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const std::pair<int64_t, int64_t>& value) {
|
||||
+ ; // rate is currently ignored
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const std::monostate& value) {
|
||||
+ ; // none is currently ignored
|
||||
+ }
|
||||
+
|
||||
+ // string char * helpers
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, const char * const& value) {
|
||||
+ env->CallVoidMethod(bundle, putStringID, keyName, env->NewStringUTF(value));
|
||||
+ }
|
||||
+
|
||||
+ template<>
|
||||
+ void put(jstring keyName, char * const& value) {
|
||||
+ env->CallVoidMethod(bundle, putStringID, keyName, env->NewStringUTF(value));
|
||||
+ }
|
||||
+
|
||||
+ // We allow both jstring and non-jstring variants.
|
||||
+ template<typename T>
|
||||
+ void put(const char *keyName, const T& value) {
|
||||
+ put(env->NewStringUTF(keyName), value);
|
||||
+ }
|
||||
+};
|
||||
+} // namespace
|
||||
+
|
||||
+// place the attributes into a java PersistableBundle object
|
||||
+jobject MediaMetricsJNI::writeMetricsToBundle(
|
||||
+ JNIEnv* env, mediametrics::Item *item, jobject bundle)
|
||||
+{
|
||||
+ BundleHelper bh(env, bundle);
|
||||
+
|
||||
+ if (bh.bundle == nullptr) {
|
||||
+ ALOGE("%s: unable to create Bundle", __func__);
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
+ bh.put(mediametrics::BUNDLE_KEY, item->getKey().c_str());
|
||||
+ if (item->getPid() != -1) {
|
||||
+ bh.put(mediametrics::BUNDLE_PID, (int32_t)item->getPid());
|
||||
+ }
|
||||
+ if (item->getTimestamp() > 0) {
|
||||
+ bh.put(mediametrics::BUNDLE_TIMESTAMP, (int64_t)item->getTimestamp());
|
||||
+ }
|
||||
+ if (static_cast<int32_t>(item->getUid()) != -1) {
|
||||
+ bh.put(mediametrics::BUNDLE_UID, (int32_t)item->getUid());
|
||||
+ }
|
||||
+ for (const auto &prop : *item) {
|
||||
+ const char *name = prop.getName();
|
||||
+ if (name == nullptr) continue;
|
||||
+ prop.visit([&] (auto &value) { bh.put(name, value); });
|
||||
+ }
|
||||
+ return bh.bundle;
|
||||
+}
|
||||
+
|
||||
+// Implementation of MediaMetrics.native_submit_bytebuffer(),
|
||||
+// Delivers the byte buffer to the mediametrics service.
|
||||
+static jint android_media_MediaMetrics_submit_bytebuffer(
|
||||
+ JNIEnv* env, jobject thiz, jobject byteBuffer, jint length)
|
||||
+{
|
||||
+ const jbyte* buffer =
|
||||
+ reinterpret_cast<const jbyte*>(env->GetDirectBufferAddress(byteBuffer));
|
||||
+ if (buffer == nullptr) {
|
||||
+ ALOGE("Error retrieving source of audio data to play, can't play");
|
||||
+ return (jint)BAD_VALUE;
|
||||
+ }
|
||||
+
|
||||
+ return (jint)mediametrics::BaseItem::submitBuffer((char *)buffer, length);
|
||||
+}
|
||||
+
|
||||
+// Helper function to convert a native PersistableBundle to a Java
|
||||
+// PersistableBundle.
|
||||
+jobject MediaMetricsJNI::nativeToJavaPersistableBundle(JNIEnv *env,
|
||||
+ os::PersistableBundle* nativeBundle) {
|
||||
+ if (env == NULL || nativeBundle == NULL) {
|
||||
+ ALOGE("Unexpected NULL parmeter");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ // Create a Java parcel with the native parcel data.
|
||||
+ // Then create a new PersistableBundle with that parcel as a parameter.
|
||||
+ jobject jParcel = android::createJavaParcelObject(env);
|
||||
+ if (jParcel == NULL) {
|
||||
+ ALOGE("Failed to create a Java Parcel.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ android::Parcel* nativeParcel = android::parcelForJavaObject(env, jParcel);
|
||||
+ if (nativeParcel == NULL) {
|
||||
+ ALOGE("Failed to get the native Parcel.");
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+ android::status_t result = nativeBundle->writeToParcel(nativeParcel);
|
||||
+ nativeParcel->setDataPosition(0);
|
||||
+ if (result != android::OK) {
|
||||
+ ALOGE("Failed to write nativeBundle to Parcel: %d.", result);
|
||||
+ return NULL;
|
||||
+ }
|
||||
+
|
||||
+#define STATIC_INIT_JNI(T, obj, method, globalref, ...) \
|
||||
+ static T obj{};\
|
||||
+ if (obj == NULL) { \
|
||||
+ obj = method(__VA_ARGS__); \
|
||||
+ if (obj == NULL) { \
|
||||
+ ALOGE("%s can't find " #obj, __func__); \
|
||||
+ return NULL; \
|
||||
+ } else { \
|
||||
+ obj = globalref; \
|
||||
+ }\
|
||||
+ } \
|
||||
+
|
||||
+ STATIC_INIT_JNI(jclass, clazzBundle, env->FindClass,
|
||||
+ static_cast<jclass>(env->NewGlobalRef(clazzBundle)),
|
||||
+ "android/os/PersistableBundle");
|
||||
+ STATIC_INIT_JNI(jfieldID, bundleCreatorId, env->GetStaticFieldID,
|
||||
+ bundleCreatorId,
|
||||
+ clazzBundle, "CREATOR", "Landroid/os/Parcelable$Creator;");
|
||||
+ STATIC_INIT_JNI(jobject, bundleCreator, env->GetStaticObjectField,
|
||||
+ env->NewGlobalRef(bundleCreator),
|
||||
+ clazzBundle, bundleCreatorId);
|
||||
+ STATIC_INIT_JNI(jclass, clazzCreator, env->FindClass,
|
||||
+ static_cast<jclass>(env->NewGlobalRef(clazzCreator)),
|
||||
+ "android/os/Parcelable$Creator");
|
||||
+ STATIC_INIT_JNI(jmethodID, createFromParcelId, env->GetMethodID,
|
||||
+ createFromParcelId,
|
||||
+ clazzCreator, "createFromParcel", "(Landroid/os/Parcel;)Ljava/lang/Object;");
|
||||
+
|
||||
+ jobject newBundle = env->CallObjectMethod(bundleCreator, createFromParcelId, jParcel);
|
||||
+ if (newBundle == NULL) {
|
||||
+ ALOGE("Failed to create a new PersistableBundle "
|
||||
+ "from the createFromParcel call.");
|
||||
+ }
|
||||
+
|
||||
+ return newBundle;
|
||||
+}
|
||||
+
|
||||
+// ----------------------------------------------------------------------------
|
||||
+
|
||||
+static constexpr JNINativeMethod gMethods[] = {
|
||||
+ {"native_submit_bytebuffer", "(Ljava/nio/ByteBuffer;I)I",
|
||||
+ (void *)android_media_MediaMetrics_submit_bytebuffer},
|
||||
+};
|
||||
+
|
||||
+// Registers the native methods, called from core/jni/AndroidRuntime.cpp
|
||||
+int register_android_media_MediaMetrics(JNIEnv *env)
|
||||
+{
|
||||
+ return AndroidRuntime::registerNativeMethods(
|
||||
+ env, "android/media/MediaMetrics", gMethods, std::size(gMethods));
|
||||
+}
|
||||
+
|
||||
+}; // namespace android
|
||||
diff --git a/core/jni/android_os_HidlMemory.cpp b/core/jni/android_os_HidlMemory.cpp
|
||||
index 69e48184c0ad..612fc95776a5 100644
|
||||
--- a/core/jni/android_os_HidlMemory.cpp
|
||||
+++ b/core/jni/android_os_HidlMemory.cpp
|
||||
@@ -50,7 +50,7 @@ static void nativeFinalize(JNIEnv* env, jobject jobj) {
|
||||
delete native;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"nativeFinalize", "()V", (void*) nativeFinalize},
|
||||
};
|
||||
|
||||
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp
|
||||
index 781895eeeaba..cbec79144826 100644
|
||||
--- a/core/jni/android_os_HwBinder.cpp
|
||||
+++ b/core/jni/android_os_HwBinder.cpp
|
||||
@@ -352,7 +352,7 @@ static void JHwBinder_report_sysprop_change(JNIEnv * /*env*/, jclass /*clazz*/)
|
||||
report_sysprop_change();
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "native_init", "()J", (void *)JHwBinder_native_init },
|
||||
{ "native_setup", "()V", (void *)JHwBinder_native_setup },
|
||||
|
||||
diff --git a/core/jni/android_os_HwBlob.cpp b/core/jni/android_os_HwBlob.cpp
|
||||
index e554b44233b5..065937f935fb 100644
|
||||
--- a/core/jni/android_os_HwBlob.cpp
|
||||
+++ b/core/jni/android_os_HwBlob.cpp
|
||||
@@ -599,7 +599,7 @@ static jlong JHwBlob_native_handle(JNIEnv *env, jobject thiz) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "native_init", "()J", (void *)JHwBlob_native_init },
|
||||
{ "native_setup", "(I)V", (void *)JHwBlob_native_setup },
|
||||
|
||||
diff --git a/core/jni/android_os_HwParcel.cpp b/core/jni/android_os_HwParcel.cpp
|
||||
index 0e3c51047b31..edda99533f63 100644
|
||||
--- a/core/jni/android_os_HwParcel.cpp
|
||||
+++ b/core/jni/android_os_HwParcel.cpp
|
||||
@@ -1066,7 +1066,7 @@ static void JHwParcel_native_writeBuffer(
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "native_init", "()J", (void *)JHwParcel_native_init },
|
||||
{ "native_setup", "(Z)V", (void *)JHwParcel_native_setup },
|
||||
|
||||
diff --git a/core/jni/android_os_HwRemoteBinder.cpp b/core/jni/android_os_HwRemoteBinder.cpp
|
||||
index d2d7213e5761..497aa193eb4d 100644
|
||||
--- a/core/jni/android_os_HwRemoteBinder.cpp
|
||||
+++ b/core/jni/android_os_HwRemoteBinder.cpp
|
||||
@@ -452,7 +452,7 @@ static jint JHwRemoteBinder_hashCode(JNIEnv* env, jobject thiz) {
|
||||
return static_cast<jint>(longHash ^ (longHash >> 32)); // See Long.hashCode()
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "native_init", "()J", (void *)JHwRemoteBinder_native_init },
|
||||
|
||||
{ "native_setup_empty", "()V",
|
||||
diff --git a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
||||
index 426644ee6a4e..f886d7dc4e5c 100644
|
||||
--- a/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
||||
+++ b/libs/hwui/jni/android_graphics_DisplayListCanvas.cpp
|
||||
@@ -174,7 +174,7 @@ static void android_view_DisplayListCanvas_drawWebViewFunctor(CRITICAL_JNI_PARAM
|
||||
|
||||
const char* const kClassPathName = "android/graphics/RecordingCanvas";
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"nGetMaximumTextureWidth", "()I", (void*)android_view_DisplayListCanvas_getMaxTextureSize},
|
||||
{"nGetMaximumTextureHeight", "()I",
|
||||
(void*)android_view_DisplayListCanvas_getMaxTextureSize},
|
||||
diff --git a/media/jni/android_media_ImageWriter.cpp b/media/jni/android_media_ImageWriter.cpp
|
||||
index f64233fb9c79..a99fcea46911 100644
|
||||
--- a/media/jni/android_media_ImageWriter.cpp
|
||||
+++ b/media/jni/android_media_ImageWriter.cpp
|
||||
@@ -1114,7 +1114,7 @@ static jobjectArray Image_createSurfacePlanes(JNIEnv* env, jobject thiz,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
-static JNINativeMethod gImageWriterMethods[] = {
|
||||
+static const JNINativeMethod gImageWriterMethods[] = {
|
||||
{"nativeClassInit", "()V", (void*)ImageWriter_classInit },
|
||||
{"nativeInit", "(Ljava/lang/Object;Landroid/view/Surface;IIIZIIJ)J",
|
||||
(void*)ImageWriter_init },
|
||||
@@ -1131,7 +1131,7 @@ static JNINativeMethod gImageWriterMethods[] = {
|
||||
{"cancelImage", "(JLandroid/media/Image;)V", (void*)ImageWriter_cancelImage },
|
||||
};
|
||||
|
||||
-static JNINativeMethod gImageMethods[] = {
|
||||
+static const JNINativeMethod gImageMethods[] = {
|
||||
{"nativeCreatePlanes", "(II)[Landroid/media/ImageWriter$WriterSurfaceImage$SurfacePlane;",
|
||||
(void*)Image_createSurfacePlanes },
|
||||
{"nativeGetWidth", "()I", (void*)Image_getWidth },
|
||||
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
|
||||
index d1ce30a3e827..d93bda166c44 100644
|
||||
--- a/media/jni/android_media_MediaSync.cpp
|
||||
+++ b/media/jni/android_media_MediaSync.cpp
|
||||
@@ -514,7 +514,7 @@ static void android_media_MediaSync_native_finalize(JNIEnv *env, jobject thiz) {
|
||||
android_media_MediaSync_release(env, thiz);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "native_setSurface",
|
||||
"(Landroid/view/Surface;)V",
|
||||
(void *)android_media_MediaSync_native_setSurface },
|
||||
diff --git a/media/jni/soundpool/android_media_SoundPool.cpp b/media/jni/soundpool/android_media_SoundPool.cpp
|
||||
index 25040a942061..f62c4340428c 100644
|
||||
--- a/media/jni/soundpool/android_media_SoundPool.cpp
|
||||
+++ b/media/jni/soundpool/android_media_SoundPool.cpp
|
||||
@@ -560,7 +560,7 @@ android_media_SoundPool_release(JNIEnv *env, jobject thiz)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// Dalvik VM type signatures
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "_load",
|
||||
"(Ljava/io/FileDescriptor;JJI)I",
|
||||
(void *)android_media_SoundPool_load_FD
|
||||
diff --git a/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp b/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
||||
index 93938b1ff1bc..47b22c5fd39f 100644
|
||||
--- a/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
||||
+++ b/services/core/jni/com_android_server_UsbAlsaMidiDevice.cpp
|
||||
@@ -138,7 +138,7 @@ static void android_server_UsbAlsaMidiDevice_close(JNIEnv *env, jobject thiz, jo
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod method_table[] = {
|
||||
+static const JNINativeMethod method_table[] = {
|
||||
{"nativeOpen", "(IIII)[Ljava/io/FileDescriptor;",
|
||||
(void *)android_server_UsbAlsaMidiDevice_open},
|
||||
{"nativeClose", "([Ljava/io/FileDescriptor;)V",
|
||||
diff --git a/services/core/jni/com_android_server_companion_virtual_InputController.cpp b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
||||
index 4cd018b0269e..039258cf983c 100644
|
||||
--- a/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
||||
+++ b/services/core/jni/com_android_server_companion_virtual_InputController.cpp
|
||||
@@ -287,7 +287,7 @@ static bool nativeWriteScrollEvent(JNIEnv* env, jobject thiz, jlong ptr, jfloat
|
||||
std::chrono::nanoseconds(eventTimeNanos));
|
||||
}
|
||||
|
||||
-static JNINativeMethod methods[] = {
|
||||
+static const JNINativeMethod methods[] = {
|
||||
{"nativeOpenUinputDpad", "(Ljava/lang/String;IILjava/lang/String;)J",
|
||||
(void*)nativeOpenUinputDpad},
|
||||
{"nativeOpenUinputKeyboard", "(Ljava/lang/String;IILjava/lang/String;)J",
|
||||
diff --git a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
||||
index 99deab4fd652..2cb1aaef13fa 100644
|
||||
--- a/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
||||
+++ b/services/core/jni/com_android_server_tv_TvUinputBridge.cpp
|
||||
@@ -534,7 +534,7 @@ static void nativeClear(JNIEnv* env, jclass clazz, jlong ptr) {
|
||||
* JNI registration
|
||||
*/
|
||||
|
||||
-static JNINativeMethod gUinputBridgeMethods[] = {
|
||||
+static const JNINativeMethod gUinputBridgeMethods[] = {
|
||||
{"nativeOpen", "(Ljava/lang/String;Ljava/lang/String;III)J", (void*)nativeOpen},
|
||||
{"nativeGamepadOpen", "(Ljava/lang/String;Ljava/lang/String;)J", (void*)nativeGamepadOpen},
|
||||
{"nativeClose", "(J)V", (void*)nativeClose},
|
||||
diff --git a/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp b/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
||||
index 27f4bae9e65a..b5620251d41b 100644
|
||||
--- a/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
||||
+++ b/tests/ChoreographerTests/jni/android_view_tests_ChoreographerNativeTest.cpp
|
||||
@@ -151,7 +151,7 @@ static void android_view_ChoreographerNativeTest_testPostVsyncCallbackAtFrameRat
|
||||
endTest(env, clazz);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"nativeSurfaceControl_getChoreographer", "(Landroid/view/SurfaceControl;)J",
|
||||
(void*)SurfaceControl_getChoreographer},
|
||||
{"nativeTestPostVsyncCallbackAtFrameRate", "(JF)V",
|
@ -0,0 +1,181 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sat, 14 Mar 2015 18:10:20 -0400
|
||||
Subject: [PATCH] add exec-based spawning support
|
||||
|
||||
---
|
||||
.../com/android/internal/os/ExecInit.java | 115 ++++++++++++++++++
|
||||
.../com/android/internal/os/WrapperInit.java | 2 +-
|
||||
.../android/internal/os/ZygoteConnection.java | 10 +-
|
||||
3 files changed, 125 insertions(+), 2 deletions(-)
|
||||
create mode 100644 core/java/com/android/internal/os/ExecInit.java
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ExecInit.java b/core/java/com/android/internal/os/ExecInit.java
|
||||
new file mode 100644
|
||||
index 000000000000..2adcab7fdbe6
|
||||
--- /dev/null
|
||||
+++ b/core/java/com/android/internal/os/ExecInit.java
|
||||
@@ -0,0 +1,115 @@
|
||||
+package com.android.internal.os;
|
||||
+
|
||||
+import android.os.Trace;
|
||||
+import android.system.ErrnoException;
|
||||
+import android.system.Os;
|
||||
+import android.util.Slog;
|
||||
+import android.util.TimingsTraceLog;
|
||||
+import dalvik.system.VMRuntime;
|
||||
+
|
||||
+/**
|
||||
+ * Startup class for the process.
|
||||
+ * @hide
|
||||
+ */
|
||||
+public class ExecInit {
|
||||
+ /**
|
||||
+ * Class not instantiable.
|
||||
+ */
|
||||
+ private ExecInit() {
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The main function called when starting a runtime application.
|
||||
+ *
|
||||
+ * The first argument is the target SDK version for the app.
|
||||
+ *
|
||||
+ * The remaining arguments are passed to the runtime.
|
||||
+ *
|
||||
+ * @param args The command-line arguments.
|
||||
+ */
|
||||
+ public static void main(String[] args) {
|
||||
+ // Parse our mandatory argument.
|
||||
+ int targetSdkVersion = Integer.parseInt(args[0], 10);
|
||||
+
|
||||
+ // Mimic system Zygote preloading.
|
||||
+ ZygoteInit.preload(new TimingsTraceLog("ExecInitTiming",
|
||||
+ Trace.TRACE_TAG_DALVIK));
|
||||
+
|
||||
+ // Launch the application.
|
||||
+ String[] runtimeArgs = new String[args.length - 1];
|
||||
+ System.arraycopy(args, 1, runtimeArgs, 0, runtimeArgs.length);
|
||||
+ Runnable r = execInit(targetSdkVersion, runtimeArgs);
|
||||
+
|
||||
+ r.run();
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Executes a runtime application with exec-based spawning.
|
||||
+ * This method never returns.
|
||||
+ *
|
||||
+ * @param niceName The nice name for the application, or null if none.
|
||||
+ * @param targetSdkVersion The target SDK version for the app.
|
||||
+ * @param args Arguments for {@link RuntimeInit#main}.
|
||||
+ */
|
||||
+ public static void execApplication(String niceName, int targetSdkVersion,
|
||||
+ String instructionSet, String[] args) {
|
||||
+ int niceArgs = niceName == null ? 0 : 1;
|
||||
+ int baseArgs = 5 + niceArgs;
|
||||
+ String[] argv = new String[baseArgs + args.length];
|
||||
+ if (VMRuntime.is64BitInstructionSet(instructionSet)) {
|
||||
+ argv[0] = "/system/bin/app_process64";
|
||||
+ } else {
|
||||
+ argv[0] = "/system/bin/app_process32";
|
||||
+ }
|
||||
+ argv[1] = "/system/bin";
|
||||
+ argv[2] = "--application";
|
||||
+ if (niceName != null) {
|
||||
+ argv[3] = "--nice-name=" + niceName;
|
||||
+ }
|
||||
+ argv[3 + niceArgs] = "com.android.internal.os.ExecInit";
|
||||
+ argv[4 + niceArgs] = Integer.toString(targetSdkVersion);
|
||||
+ System.arraycopy(args, 0, argv, baseArgs, args.length);
|
||||
+
|
||||
+ WrapperInit.preserveCapabilities();
|
||||
+ try {
|
||||
+ Os.execv(argv[0], argv);
|
||||
+ } catch (ErrnoException e) {
|
||||
+ throw new RuntimeException(e);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * The main function called when an application is started with exec-based spawning.
|
||||
+ *
|
||||
+ * When the app starts, the runtime starts {@link RuntimeInit#main}
|
||||
+ * which calls {@link main} which then calls this method.
|
||||
+ * So we don't need to call commonInit() here.
|
||||
+ *
|
||||
+ * @param targetSdkVersion target SDK version
|
||||
+ * @param argv arg strings
|
||||
+ */
|
||||
+ private static Runnable execInit(int targetSdkVersion, String[] argv) {
|
||||
+ if (RuntimeInit.DEBUG) {
|
||||
+ Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from exec");
|
||||
+ }
|
||||
+
|
||||
+ // Check whether the first argument is a "-cp" in argv, and assume the next argument is the
|
||||
+ // classpath. If found, create a PathClassLoader and use it for applicationInit.
|
||||
+ ClassLoader classLoader = null;
|
||||
+ if (argv != null && argv.length > 2 && argv[0].equals("-cp")) {
|
||||
+ classLoader = ZygoteInit.createPathClassLoader(argv[1], targetSdkVersion);
|
||||
+
|
||||
+ // Install this classloader as the context classloader, too.
|
||||
+ Thread.currentThread().setContextClassLoader(classLoader);
|
||||
+
|
||||
+ // Remove the classpath from the arguments.
|
||||
+ String removedArgs[] = new String[argv.length - 2];
|
||||
+ System.arraycopy(argv, 2, removedArgs, 0, argv.length - 2);
|
||||
+ argv = removedArgs;
|
||||
+ }
|
||||
+
|
||||
+ // Perform the same initialization that would happen after the Zygote forks.
|
||||
+ Zygote.nativePreApplicationInit();
|
||||
+ return RuntimeInit.applicationInit(targetSdkVersion, /*disabledCompatChanges*/ null, argv, classLoader);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/core/java/com/android/internal/os/WrapperInit.java b/core/java/com/android/internal/os/WrapperInit.java
|
||||
index 6860759eea8a..a2eef62f80be 100644
|
||||
--- a/core/java/com/android/internal/os/WrapperInit.java
|
||||
+++ b/core/java/com/android/internal/os/WrapperInit.java
|
||||
@@ -186,7 +186,7 @@ public class WrapperInit {
|
||||
* This is acceptable here as failure will leave the wrapped app with strictly less
|
||||
* capabilities, which may make it crash, but not exceed its allowances.
|
||||
*/
|
||||
- private static void preserveCapabilities() {
|
||||
+ public static void preserveCapabilities() {
|
||||
StructCapUserHeader header = new StructCapUserHeader(
|
||||
OsConstants._LINUX_CAPABILITY_VERSION_3, 0);
|
||||
StructCapUserData[] data;
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index cbe070048811..9e78c3a8b16c 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -29,6 +29,7 @@ import android.net.Credentials;
|
||||
import android.net.LocalSocket;
|
||||
import android.os.Parcel;
|
||||
import android.os.Process;
|
||||
+import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
@@ -247,7 +248,7 @@ class ZygoteConnection {
|
||||
fdsToClose[1] = zygoteFd.getInt$();
|
||||
}
|
||||
|
||||
- if (parsedArgs.mInvokeWith != null || parsedArgs.mStartChildZygote
|
||||
+ if (parsedArgs.mInvokeWith != null || SystemProperties.getBoolean("sys.spawn.exec", false) || parsedArgs.mStartChildZygote
|
||||
|| !multipleOK || peer.getUid() != Process.SYSTEM_UID) {
|
||||
// Continue using old code for now. TODO: Handle these cases in the other path.
|
||||
pid = Zygote.forkAndSpecialize(parsedArgs.mUid, parsedArgs.mGid,
|
||||
@@ -535,6 +536,13 @@ class ZygoteConnection {
|
||||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
+
|
||||
+ // Should not get here.
|
||||
+ throw new IllegalStateException("ExecInit.execApplication unexpectedly returned");
|
||||
+ }
|
||||
return ZygoteInit.zygoteInit(parsedArgs.mTargetSdkVersion,
|
||||
parsedArgs.mDisabledCompatChanges,
|
||||
parsedArgs.mRemainingArgs, null /* classLoader */);
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 11 Sep 2019 06:57:24 -0400
|
||||
Subject: [PATCH] disable preloading classloaders for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 55c68981f919..699899e02f85 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -132,9 +132,11 @@ public class ZygoteInit {
|
||||
preloadClasses();
|
||||
bootTimingsTraceLog.traceEnd(); // PreloadClasses
|
||||
}
|
||||
- bootTimingsTraceLog.traceBegin("CacheNonBootClasspathClassLoaders");
|
||||
- cacheNonBootClasspathClassLoaders();
|
||||
- bootTimingsTraceLog.traceEnd(); // CacheNonBootClasspathClassLoaders
|
||||
+ if (fullPreload) {
|
||||
+ bootTimingsTraceLog.traceBegin("CacheNonBootClasspathClassLoaders");
|
||||
+ cacheNonBootClasspathClassLoaders();
|
||||
+ bootTimingsTraceLog.traceEnd(); // CacheNonBootClasspathClassLoaders
|
||||
+ }
|
||||
if (fullPreload) {
|
||||
bootTimingsTraceLog.traceBegin("PreloadResources");
|
||||
Resources.preloadResources();
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 11 Sep 2019 06:58:51 -0400
|
||||
Subject: [PATCH] disable preloading HALs for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 699899e02f85..da2f93d4539c 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -142,9 +142,11 @@ public class ZygoteInit {
|
||||
Resources.preloadResources();
|
||||
bootTimingsTraceLog.traceEnd(); // PreloadResources
|
||||
}
|
||||
- Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadAppProcessHALs");
|
||||
- nativePreloadAppProcessHALs();
|
||||
- Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
+ if (fullPreload) {
|
||||
+ Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadAppProcessHALs");
|
||||
+ nativePreloadAppProcessHALs();
|
||||
+ Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
+ }
|
||||
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadGraphicsDriver");
|
||||
maybePreloadGraphicsDriver();
|
||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
@ -0,0 +1,289 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
Date: Sat, 31 Oct 2020 00:26:09 +0200
|
||||
Subject: [PATCH] pass through runtime flags for exec spawning and implement
|
||||
them in the child
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
.../com/android/internal/os/ExecInit.java | 14 +-
|
||||
core/java/com/android/internal/os/Zygote.java | 9 +
|
||||
.../android/internal/os/ZygoteConnection.java | 2 +-
|
||||
core/jni/com_android_internal_os_Zygote.cpp | 164 ++++++++++--------
|
||||
4 files changed, 107 insertions(+), 82 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ExecInit.java b/core/java/com/android/internal/os/ExecInit.java
|
||||
index 830e5b562a91..749c67abf389 100644
|
||||
--- a/core/java/com/android/internal/os/ExecInit.java
|
||||
+++ b/core/java/com/android/internal/os/ExecInit.java
|
||||
@@ -31,15 +31,20 @@ public class ExecInit {
|
||||
// Parse our mandatory argument.
|
||||
int targetSdkVersion = Integer.parseInt(args[0], 10);
|
||||
|
||||
+ // Parse the runtime_flags.
|
||||
+ int runtimeFlags = Integer.parseInt(args[1], 10);
|
||||
+
|
||||
// Mimic system Zygote preloading.
|
||||
ZygoteInit.preload(new TimingsTraceLog("ExecInitTiming",
|
||||
Trace.TRACE_TAG_DALVIK), false);
|
||||
|
||||
// Launch the application.
|
||||
- String[] runtimeArgs = new String[args.length - 1];
|
||||
- System.arraycopy(args, 1, runtimeArgs, 0, runtimeArgs.length);
|
||||
+ String[] runtimeArgs = new String[args.length - 2];
|
||||
+ System.arraycopy(args, 2, runtimeArgs, 0, runtimeArgs.length);
|
||||
Runnable r = execInit(targetSdkVersion, runtimeArgs);
|
||||
|
||||
+ Zygote.nativeHandleRuntimeFlags(runtimeFlags);
|
||||
+
|
||||
r.run();
|
||||
}
|
||||
|
||||
@@ -52,9 +57,9 @@ public class ExecInit {
|
||||
* @param args Arguments for {@link RuntimeInit#main}.
|
||||
*/
|
||||
public static void execApplication(String niceName, int targetSdkVersion,
|
||||
- String instructionSet, String[] args) {
|
||||
+ String instructionSet, int runtimeFlags, String[] args) {
|
||||
int niceArgs = niceName == null ? 0 : 1;
|
||||
- int baseArgs = 5 + niceArgs;
|
||||
+ int baseArgs = 6 + niceArgs;
|
||||
String[] argv = new String[baseArgs + args.length];
|
||||
if (VMRuntime.is64BitInstructionSet(instructionSet)) {
|
||||
argv[0] = "/system/bin/app_process64";
|
||||
@@ -68,6 +73,7 @@ public class ExecInit {
|
||||
}
|
||||
argv[3 + niceArgs] = "com.android.internal.os.ExecInit";
|
||||
argv[4 + niceArgs] = Integer.toString(targetSdkVersion);
|
||||
+ argv[5 + niceArgs] = Integer.toString(runtimeFlags);
|
||||
System.arraycopy(args, 0, argv, baseArgs, args.length);
|
||||
|
||||
WrapperInit.preserveCapabilities();
|
||||
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
|
||||
index cab84bb01f70..07691fcec545 100644
|
||||
--- a/core/java/com/android/internal/os/Zygote.java
|
||||
+++ b/core/java/com/android/internal/os/Zygote.java
|
||||
@@ -1497,4 +1497,13 @@ public final class Zygote {
|
||||
}
|
||||
return runtimeFlags;
|
||||
}
|
||||
+
|
||||
+ /**
|
||||
+ * Used on GrapheneOS to set up runtime flags
|
||||
+ *
|
||||
+ * @param runtimeFlags flags to be passed to the native method
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ public static native void nativeHandleRuntimeFlags(int runtimeFlags);
|
||||
}
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index cc936ccefb91..eea7b1e57b37 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -539,7 +539,7 @@ class ZygoteConnection {
|
||||
if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
(parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
- VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
+ VMRuntime.getCurrentInstructionSet(), parsedArgs.mRuntimeFlags, parsedArgs.mRemainingArgs);
|
||||
|
||||
// Should not get here.
|
||||
throw new IllegalStateException("ExecInit.execApplication unexpectedly returned");
|
||||
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
|
||||
index 7c5885adb220..9fc92a480e1e 100644
|
||||
--- a/core/jni/com_android_internal_os_Zygote.cpp
|
||||
+++ b/core/jni/com_android_internal_os_Zygote.cpp
|
||||
@@ -1872,6 +1872,86 @@ static void BindMountStorageDirs(JNIEnv* env, jobjectArray pkg_data_info_list,
|
||||
}
|
||||
}
|
||||
|
||||
+static void HandleRuntimeFlags(JNIEnv* env, jint& runtime_flags, const char* process_name, const char* nice_name_ptr) {
|
||||
+ // Set process properties to enable debugging if required.
|
||||
+ if ((runtime_flags & RuntimeFlags::DEBUG_ENABLE_PTRACE) != 0) {
|
||||
+ EnableDebugger();
|
||||
+ // Don't pass unknown flag to the ART runtime.
|
||||
+ runtime_flags &= ~RuntimeFlags::DEBUG_ENABLE_PTRACE;
|
||||
+ }
|
||||
+ if ((runtime_flags & RuntimeFlags::PROFILE_FROM_SHELL) != 0) {
|
||||
+ // simpleperf needs the process to be dumpable to profile it.
|
||||
+ if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
|
||||
+ ALOGE("prctl(PR_SET_DUMPABLE) failed: %s", strerror(errno));
|
||||
+ RuntimeAbort(env, __LINE__, "prctl(PR_SET_DUMPABLE, 1) failed");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ HeapTaggingLevel heap_tagging_level;
|
||||
+ switch (runtime_flags & RuntimeFlags::MEMORY_TAG_LEVEL_MASK) {
|
||||
+ case RuntimeFlags::MEMORY_TAG_LEVEL_TBI:
|
||||
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
|
||||
+ break;
|
||||
+ case RuntimeFlags::MEMORY_TAG_LEVEL_ASYNC:
|
||||
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
|
||||
+ break;
|
||||
+ case RuntimeFlags::MEMORY_TAG_LEVEL_SYNC:
|
||||
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_SYNC;
|
||||
+ break;
|
||||
+ default:
|
||||
+ heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
|
||||
+ break;
|
||||
+ }
|
||||
+ mallopt(M_BIONIC_SET_HEAP_TAGGING_LEVEL, heap_tagging_level);
|
||||
+
|
||||
+ // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
+ // runtime.
|
||||
+ runtime_flags &= ~RuntimeFlags::MEMORY_TAG_LEVEL_MASK;
|
||||
+
|
||||
+ // Avoid heap zero initialization for applications without MTE. Zero init may
|
||||
+ // cause app compat problems, use more memory, or reduce performance. While it
|
||||
+ // would be nice to have them for apps, we will have to wait until they are
|
||||
+ // proven out, have more efficient hardware, and/or apply them only to new
|
||||
+ // applications.
|
||||
+ if (!(runtime_flags & RuntimeFlags::NATIVE_HEAP_ZERO_INIT_ENABLED)) {
|
||||
+ mallopt(M_BIONIC_ZERO_INIT, 0);
|
||||
+ }
|
||||
+
|
||||
+ // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
+ // runtime.
|
||||
+ runtime_flags &= ~RuntimeFlags::NATIVE_HEAP_ZERO_INIT_ENABLED;
|
||||
+
|
||||
+ android_mallopt_gwp_asan_options_t gwp_asan_options;
|
||||
+ const char* kGwpAsanAppRecoverableSysprop =
|
||||
+ "persist.device_config.memory_safety_native.gwp_asan_recoverable_apps";
|
||||
+ // The system server doesn't have its nice name set by the time SpecializeCommon is called.
|
||||
+ gwp_asan_options.program_name = nice_name_ptr ?: process_name;
|
||||
+ switch (runtime_flags & RuntimeFlags::GWP_ASAN_LEVEL_MASK) {
|
||||
+ default:
|
||||
+ case RuntimeFlags::GWP_ASAN_LEVEL_DEFAULT:
|
||||
+ gwp_asan_options.desire = GetBoolProperty(kGwpAsanAppRecoverableSysprop, true)
|
||||
+ ? Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING
|
||||
+ : Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
|
||||
+ android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
+ break;
|
||||
+ case RuntimeFlags::GWP_ASAN_LEVEL_NEVER:
|
||||
+ gwp_asan_options.desire = Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
|
||||
+ android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
+ break;
|
||||
+ case RuntimeFlags::GWP_ASAN_LEVEL_ALWAYS:
|
||||
+ gwp_asan_options.desire = Action::TURN_ON_FOR_APP;
|
||||
+ android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
+ break;
|
||||
+ case RuntimeFlags::GWP_ASAN_LEVEL_LOTTERY:
|
||||
+ gwp_asan_options.desire = Action::TURN_ON_WITH_SAMPLING;
|
||||
+ android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
+ break;
|
||||
+ }
|
||||
+ // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
+ // runtime.
|
||||
+ runtime_flags &= ~RuntimeFlags::GWP_ASAN_LEVEL_MASK;
|
||||
+}
|
||||
+
|
||||
// Utility routine to specialize a zygote child process.
|
||||
static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids, jint runtime_flags,
|
||||
jobjectArray rlimits, jlong permitted_capabilities,
|
||||
@@ -2019,84 +2099,9 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
|
||||
}
|
||||
}
|
||||
|
||||
- // Set process properties to enable debugging if required.
|
||||
- if ((runtime_flags & RuntimeFlags::DEBUG_ENABLE_PTRACE) != 0) {
|
||||
- EnableDebugger();
|
||||
- // Don't pass unknown flag to the ART runtime.
|
||||
- runtime_flags &= ~RuntimeFlags::DEBUG_ENABLE_PTRACE;
|
||||
- }
|
||||
- if ((runtime_flags & RuntimeFlags::PROFILE_FROM_SHELL) != 0) {
|
||||
- // simpleperf needs the process to be dumpable to profile it.
|
||||
- if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
|
||||
- ALOGE("prctl(PR_SET_DUMPABLE) failed: %s", strerror(errno));
|
||||
- RuntimeAbort(env, __LINE__, "prctl(PR_SET_DUMPABLE, 1) failed");
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- HeapTaggingLevel heap_tagging_level;
|
||||
- switch (runtime_flags & RuntimeFlags::MEMORY_TAG_LEVEL_MASK) {
|
||||
- case RuntimeFlags::MEMORY_TAG_LEVEL_TBI:
|
||||
- heap_tagging_level = M_HEAP_TAGGING_LEVEL_TBI;
|
||||
- break;
|
||||
- case RuntimeFlags::MEMORY_TAG_LEVEL_ASYNC:
|
||||
- heap_tagging_level = M_HEAP_TAGGING_LEVEL_ASYNC;
|
||||
- break;
|
||||
- case RuntimeFlags::MEMORY_TAG_LEVEL_SYNC:
|
||||
- heap_tagging_level = M_HEAP_TAGGING_LEVEL_SYNC;
|
||||
- break;
|
||||
- default:
|
||||
- heap_tagging_level = M_HEAP_TAGGING_LEVEL_NONE;
|
||||
- break;
|
||||
- }
|
||||
- mallopt(M_BIONIC_SET_HEAP_TAGGING_LEVEL, heap_tagging_level);
|
||||
-
|
||||
- // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
- // runtime.
|
||||
- runtime_flags &= ~RuntimeFlags::MEMORY_TAG_LEVEL_MASK;
|
||||
-
|
||||
- // Avoid heap zero initialization for applications without MTE. Zero init may
|
||||
- // cause app compat problems, use more memory, or reduce performance. While it
|
||||
- // would be nice to have them for apps, we will have to wait until they are
|
||||
- // proven out, have more efficient hardware, and/or apply them only to new
|
||||
- // applications.
|
||||
- if (!(runtime_flags & RuntimeFlags::NATIVE_HEAP_ZERO_INIT_ENABLED)) {
|
||||
- mallopt(M_BIONIC_ZERO_INIT, 0);
|
||||
- }
|
||||
-
|
||||
- // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
- // runtime.
|
||||
- runtime_flags &= ~RuntimeFlags::NATIVE_HEAP_ZERO_INIT_ENABLED;
|
||||
-
|
||||
const char* nice_name_ptr = nice_name.has_value() ? nice_name.value().c_str() : nullptr;
|
||||
- android_mallopt_gwp_asan_options_t gwp_asan_options;
|
||||
- const char* kGwpAsanAppRecoverableSysprop =
|
||||
- "persist.device_config.memory_safety_native.gwp_asan_recoverable_apps";
|
||||
- // The system server doesn't have its nice name set by the time SpecializeCommon is called.
|
||||
- gwp_asan_options.program_name = nice_name_ptr ?: process_name;
|
||||
- switch (runtime_flags & RuntimeFlags::GWP_ASAN_LEVEL_MASK) {
|
||||
- default:
|
||||
- case RuntimeFlags::GWP_ASAN_LEVEL_DEFAULT:
|
||||
- gwp_asan_options.desire = GetBoolProperty(kGwpAsanAppRecoverableSysprop, true)
|
||||
- ? Action::TURN_ON_FOR_APP_SAMPLED_NON_CRASHING
|
||||
- : Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
|
||||
- android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
- break;
|
||||
- case RuntimeFlags::GWP_ASAN_LEVEL_NEVER:
|
||||
- gwp_asan_options.desire = Action::DONT_TURN_ON_UNLESS_OVERRIDDEN;
|
||||
- android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
- break;
|
||||
- case RuntimeFlags::GWP_ASAN_LEVEL_ALWAYS:
|
||||
- gwp_asan_options.desire = Action::TURN_ON_FOR_APP;
|
||||
- android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
- break;
|
||||
- case RuntimeFlags::GWP_ASAN_LEVEL_LOTTERY:
|
||||
- gwp_asan_options.desire = Action::TURN_ON_WITH_SAMPLING;
|
||||
- android_mallopt(M_INITIALIZE_GWP_ASAN, &gwp_asan_options, sizeof(gwp_asan_options));
|
||||
- break;
|
||||
- }
|
||||
- // Now that we've used the flag, clear it so that we don't pass unknown flags to the ART
|
||||
- // runtime.
|
||||
- runtime_flags &= ~RuntimeFlags::GWP_ASAN_LEVEL_MASK;
|
||||
+
|
||||
+ HandleRuntimeFlags(env, runtime_flags, process_name, nice_name_ptr);
|
||||
|
||||
SetCapabilities(permitted_capabilities, effective_capabilities, permitted_capabilities,
|
||||
fail_fn);
|
||||
@@ -3004,6 +3009,10 @@ static void com_android_internal_os_Zygote_nativeAllowFilesOpenedByPreload(JNIEn
|
||||
gPreloadFdsExtracted = true;
|
||||
}
|
||||
|
||||
+static void nativeHandleRuntimeFlagsWrapper(JNIEnv* env, jclass, jint runtime_flags) {
|
||||
+ HandleRuntimeFlags(env, runtime_flags, nullptr, nullptr);
|
||||
+}
|
||||
+
|
||||
static const JNINativeMethod gMethods[] = {
|
||||
{"nativeForkAndSpecialize",
|
||||
"(II[II[[IILjava/lang/String;Ljava/lang/String;[I[IZLjava/lang/String;Ljava/lang/"
|
||||
@@ -3056,6 +3065,7 @@ static const JNINativeMethod gMethods[] = {
|
||||
(void*)com_android_internal_os_Zygote_nativeMarkOpenedFilesBeforePreload},
|
||||
{"nativeAllowFilesOpenedByPreload", "()V",
|
||||
(void*)com_android_internal_os_Zygote_nativeAllowFilesOpenedByPreload},
|
||||
+ {"nativeHandleRuntimeFlags", "(I)V", (void*)nativeHandleRuntimeFlagsWrapper},
|
||||
};
|
||||
|
||||
int register_com_android_internal_os_Zygote(JNIEnv* env) {
|
@ -0,0 +1,34 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 8 Aug 2022 18:42:19 +0300
|
||||
Subject: [PATCH] exec spawning: don't close the binder connection when the app
|
||||
crashes
|
||||
|
||||
When an unhandled exception occured, binder connections were closed with
|
||||
IPCThreadState::stopProcess() before the invocation of java.lang.Thread#dispatchUncaughtException().
|
||||
By default, that method tries to report the crash via ActivityManager#handleApplicationCrash(),
|
||||
which always failed due to the closed binder connection.
|
||||
This meant that the crash dialog was never shown and additional crash handling was skipped.
|
||||
|
||||
Zygote-based spawning never calls IPCThreadState::stopProcess().
|
||||
---
|
||||
cmds/app_process/app_main.cpp | 6 ++++--
|
||||
1 file changed, 4 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
|
||||
index 4e41f2c1ac35..9ce4bef5bb6c 100644
|
||||
--- a/cmds/app_process/app_main.cpp
|
||||
+++ b/cmds/app_process/app_main.cpp
|
||||
@@ -85,8 +85,10 @@ public:
|
||||
AndroidRuntime* ar = AndroidRuntime::getRuntime();
|
||||
ar->callMain(mClassName, mClass, mArgs);
|
||||
|
||||
- IPCThreadState::self()->stopProcess();
|
||||
- hardware::IPCThreadState::self()->stopProcess();
|
||||
+ if (mClassName != "com.android.internal.os.ExecInit") {
|
||||
+ IPCThreadState::self()->stopProcess();
|
||||
+ hardware::IPCThreadState::self()->stopProcess();
|
||||
+ }
|
||||
}
|
||||
|
||||
virtual void onZygoteInit()
|
@ -0,0 +1,125 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Thu, 30 Mar 2023 17:42:56 +0300
|
||||
Subject: [PATCH] exec spawning: support runtime resource overlays
|
||||
|
||||
---
|
||||
core/java/android/app/IActivityManager.aidl | 2 ++
|
||||
.../android/content/res/AssetManager.java | 33 +++++++++++++++++--
|
||||
.../com/android/internal/os/ExecInit.java | 4 +++
|
||||
.../server/am/ActivityManagerService.java | 6 ++++
|
||||
4 files changed, 43 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/app/IActivityManager.aidl b/core/java/android/app/IActivityManager.aidl
|
||||
index 260e9859c72d..c3fdad0624d4 100644
|
||||
--- a/core/java/android/app/IActivityManager.aidl
|
||||
+++ b/core/java/android/app/IActivityManager.aidl
|
||||
@@ -950,4 +950,6 @@ interface IActivityManager {
|
||||
*/
|
||||
oneway void frozenBinderTransactionDetected(int debugPid, int code, int flags, int err);
|
||||
int getBindingUidProcessState(int uid, in String callingPackage);
|
||||
+
|
||||
+ String[] getSystemIdmapPaths();
|
||||
}
|
||||
diff --git a/core/java/android/content/res/AssetManager.java b/core/java/android/content/res/AssetManager.java
|
||||
index 0399995540e7..3885f0fe3dd4 100644
|
||||
--- a/core/java/android/content/res/AssetManager.java
|
||||
+++ b/core/java/android/content/res/AssetManager.java
|
||||
@@ -26,6 +26,7 @@ import android.annotation.Nullable;
|
||||
import android.annotation.StringRes;
|
||||
import android.annotation.StyleRes;
|
||||
import android.annotation.TestApi;
|
||||
+import android.app.ActivityManager;
|
||||
import android.compat.annotation.UnsupportedAppUsage;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.res.Configuration.NativeConfig;
|
||||
@@ -40,6 +41,7 @@ import android.util.TypedValue;
|
||||
import com.android.internal.annotations.GuardedBy;
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.content.om.OverlayConfig;
|
||||
+import com.android.internal.os.ExecInit;
|
||||
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
@@ -235,6 +237,9 @@ public final class AssetManager implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
+ /** @hide */
|
||||
+ public static volatile String[] systemIdmapPaths_;
|
||||
+
|
||||
/**
|
||||
* This must be called from Zygote so that system assets are shared by all applications.
|
||||
* @hide
|
||||
@@ -251,8 +256,32 @@ public final class AssetManager implements AutoCloseable {
|
||||
final ArrayList<ApkAssets> apkAssets = new ArrayList<>();
|
||||
apkAssets.add(ApkAssets.loadFromPath(frameworkPath, ApkAssets.PROPERTY_SYSTEM));
|
||||
|
||||
- final String[] systemIdmapPaths =
|
||||
- OverlayConfig.getZygoteInstance().createImmutableFrameworkIdmapsInZygote();
|
||||
+ // createImmutableFrameworkIdmapsInZygote() should be called only in zygote, it fails
|
||||
+ // in regular processes and is unnecessary there.
|
||||
+ // When it's called in zygote, overlay state is cached in /data/resource-cache/*@idmap
|
||||
+ // files. These files are readable by regular app processes.
|
||||
+ //
|
||||
+ // When exec-based spawning in used, in-memory cache of assets is lost, and the spawned
|
||||
+ // process is unable to recreate it, since it's not allowed to create idmaps.
|
||||
+ //
|
||||
+ // As a workaround, ask the ActivityManager to return paths of cached idmaps and use
|
||||
+ // them directly. ActivityManager runs in system_server, which always uses zygote-based
|
||||
+ // spawning.
|
||||
+
|
||||
+ String[] systemIdmapPaths;
|
||||
+ if (ExecInit.isExecSpawned) {
|
||||
+ try {
|
||||
+ systemIdmapPaths = ActivityManager.getService().getSystemIdmapPaths();
|
||||
+ Objects.requireNonNull(systemIdmapPaths);
|
||||
+ } catch (Throwable t) {
|
||||
+ Log.e(TAG, "unable to retrieve systemIdmapPaths", t);
|
||||
+ systemIdmapPaths = new String[0];
|
||||
+ }
|
||||
+ } else {
|
||||
+ systemIdmapPaths = OverlayConfig.getZygoteInstance().createImmutableFrameworkIdmapsInZygote();
|
||||
+ systemIdmapPaths_ = systemIdmapPaths;
|
||||
+ }
|
||||
+
|
||||
for (String idmapPath : systemIdmapPaths) {
|
||||
apkAssets.add(ApkAssets.loadOverlayFromPath(idmapPath, ApkAssets.PROPERTY_SYSTEM));
|
||||
}
|
||||
diff --git a/core/java/com/android/internal/os/ExecInit.java b/core/java/com/android/internal/os/ExecInit.java
|
||||
index 749c67abf389..39f08b6a0f15 100644
|
||||
--- a/core/java/com/android/internal/os/ExecInit.java
|
||||
+++ b/core/java/com/android/internal/os/ExecInit.java
|
||||
@@ -84,6 +84,8 @@ public class ExecInit {
|
||||
}
|
||||
}
|
||||
|
||||
+ public static boolean isExecSpawned;
|
||||
+
|
||||
/**
|
||||
* The main function called when an application is started with exec-based spawning.
|
||||
*
|
||||
@@ -99,6 +101,8 @@ public class ExecInit {
|
||||
Slog.d(RuntimeInit.TAG, "RuntimeInit: Starting application from exec");
|
||||
}
|
||||
|
||||
+ isExecSpawned = true;
|
||||
+
|
||||
// Check whether the first argument is a "-cp" in argv, and assume the next argument is the
|
||||
// classpath. If found, create a PathClassLoader and use it for applicationInit.
|
||||
ClassLoader classLoader = null;
|
||||
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
index 0d95e615911d..ba6d5a027c9d 100644
|
||||
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
|
||||
@@ -20673,4 +20673,10 @@ public class ActivityManagerService extends IActivityManager.Stub
|
||||
}
|
||||
mOomAdjuster.mCachedAppOptimizer.binderError(debugPid, app, code, flags, err);
|
||||
}
|
||||
+
|
||||
+ @Override
|
||||
+ public String[] getSystemIdmapPaths() {
|
||||
+ // see comment in AssetManager#createSystemAssetsInZygoteLocked()
|
||||
+ return android.content.res.AssetManager.systemIdmapPaths_;
|
||||
+ }
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 9 Apr 2024 14:06:27 +0300
|
||||
Subject: [PATCH] exec spawning: add workaround for late init of ART
|
||||
userfaultfd GC
|
||||
|
||||
Chromium browser and its derivatives setup a seccomp syscall filter in their isolated processes,
|
||||
which blocks creation of new userfaultfds.
|
||||
|
||||
Since 14 QPR2, ART uses a new userfaultfd-based GC.
|
||||
|
||||
When zygote-based process spawning is used, userfaultfd GC is initialized before any of app's code
|
||||
is executed, i.e. before Chromium's seccomp syscall filter is installed.
|
||||
|
||||
When exec spawning is used, userfaultfd GC initialization is delayed until first garbage collection.
|
||||
Chromium's seccomp syscall filter is already installed at that point.
|
||||
|
||||
This leads to crashes of isolated Chromium processes (both browser and WebView), with the following
|
||||
log messages:
|
||||
E cr_seccomp: ../../sandbox/linux/seccomp-bpf-helpers/sigsys_handlers.cc:**CRASHING**:seccomp-bpf failure in syscall
|
||||
E cr_seccomp: nr=0x11a arg1=0x80001 arg2=0xc arg3=0xffffffffffffffff arg4=0xc
|
||||
|
||||
As a workaround, perform early initialization of ART userfaultfd GC in isolated processes by calling
|
||||
System.gc() before executing app's code. On Pixel 8, this increases startup latency by around 4 to
|
||||
10 milliseconds.
|
||||
---
|
||||
core/java/com/android/internal/os/ExecInit.java | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ExecInit.java b/core/java/com/android/internal/os/ExecInit.java
|
||||
index 39f08b6a0f15..b4b135cde18f 100644
|
||||
--- a/core/java/com/android/internal/os/ExecInit.java
|
||||
+++ b/core/java/com/android/internal/os/ExecInit.java
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.android.internal.os;
|
||||
|
||||
+import android.os.Process;
|
||||
import android.os.Trace;
|
||||
import android.system.ErrnoException;
|
||||
import android.system.Os;
|
||||
@@ -120,6 +121,9 @@ public class ExecInit {
|
||||
|
||||
// Perform the same initialization that would happen after the Zygote forks.
|
||||
Zygote.nativePreApplicationInit();
|
||||
+ if (Process.isIsolated()) {
|
||||
+ System.gc();
|
||||
+ }
|
||||
return RuntimeInit.applicationInit(targetSdkVersion, /*disabledCompatChanges*/ null, argv, classLoader);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 21 May 2019 23:54:20 -0400
|
||||
Subject: [PATCH] disable exec spawning when using debugging options
|
||||
|
||||
The debugging options are not yet supported probably, so disable exec
|
||||
spawning when doing debugging.
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteConnection.java | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
index 9e78c3a8b16c..cc936ccefb91 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
|
||||
@@ -536,7 +536,8 @@ class ZygoteConnection {
|
||||
throw new IllegalStateException("WrapperInit.execApplication unexpectedly returned");
|
||||
} else {
|
||||
if (!isZygote) {
|
||||
- if (SystemProperties.getBoolean("sys.spawn.exec", false)) {
|
||||
+ if (SystemProperties.getBoolean("sys.spawn.exec", false) &&
|
||||
+ (parsedArgs.mRuntimeFlags & ApplicationInfo.FLAG_DEBUGGABLE) == 0) {
|
||||
ExecInit.execApplication(parsedArgs.mNiceName, parsedArgs.mTargetSdkVersion,
|
||||
VMRuntime.getCurrentInstructionSet(), parsedArgs.mRemainingArgs);
|
||||
|
@ -0,0 +1,47 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:24:21 -0400
|
||||
Subject: [PATCH] add parameter for avoiding full preload with exec
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ExecInit.java | 2 +-
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 6 +++++-
|
||||
2 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ExecInit.java b/core/java/com/android/internal/os/ExecInit.java
|
||||
index 2adcab7fdbe6..830e5b562a91 100644
|
||||
--- a/core/java/com/android/internal/os/ExecInit.java
|
||||
+++ b/core/java/com/android/internal/os/ExecInit.java
|
||||
@@ -33,7 +33,7 @@ public class ExecInit {
|
||||
|
||||
// Mimic system Zygote preloading.
|
||||
ZygoteInit.preload(new TimingsTraceLog("ExecInitTiming",
|
||||
- Trace.TRACE_TAG_DALVIK));
|
||||
+ Trace.TRACE_TAG_DALVIK), false);
|
||||
|
||||
// Launch the application.
|
||||
String[] runtimeArgs = new String[args.length - 1];
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 7af196513cae..1675d41580d6 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -122,7 +122,7 @@ public class ZygoteInit {
|
||||
*/
|
||||
private static ClassLoader sCachedSystemServerClassLoader = null;
|
||||
|
||||
- static void preload(TimingsTraceLog bootTimingsTraceLog) {
|
||||
+ static void preload(TimingsTraceLog bootTimingsTraceLog, boolean fullPreload) {
|
||||
Log.d(TAG, "begin preload");
|
||||
bootTimingsTraceLog.traceBegin("BeginPreload");
|
||||
beginPreload();
|
||||
@@ -154,6 +154,10 @@ public class ZygoteInit {
|
||||
sPreloadComplete = true;
|
||||
}
|
||||
|
||||
+ static void preload(TimingsTraceLog bootTimingsTraceLog) {
|
||||
+ preload(bootTimingsTraceLog, true);
|
||||
+ }
|
||||
+
|
||||
static void lazyPreload() {
|
||||
Preconditions.checkState(!sPreloadComplete);
|
||||
Log.i(TAG, "Lazily preloading resources.");
|
@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 11 Sep 2019 06:43:55 -0400
|
||||
Subject: [PATCH] pass through fullPreload to libcore
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 1675d41580d6..87d393d97d14 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -125,7 +125,7 @@ public class ZygoteInit {
|
||||
static void preload(TimingsTraceLog bootTimingsTraceLog, boolean fullPreload) {
|
||||
Log.d(TAG, "begin preload");
|
||||
bootTimingsTraceLog.traceBegin("BeginPreload");
|
||||
- beginPreload();
|
||||
+ beginPreload(fullPreload);
|
||||
bootTimingsTraceLog.traceEnd(); // BeginPreload
|
||||
bootTimingsTraceLog.traceBegin("PreloadClasses");
|
||||
preloadClasses();
|
||||
@@ -147,7 +147,7 @@ public class ZygoteInit {
|
||||
// Ask the WebViewFactory to do any initialization that must run in the zygote process,
|
||||
// for memory sharing purposes.
|
||||
WebViewFactory.prepareWebViewInZygote();
|
||||
- endPreload();
|
||||
+ endPreload(fullPreload);
|
||||
warmUpJcaProviders();
|
||||
Log.d(TAG, "end preload");
|
||||
|
||||
@@ -165,14 +165,14 @@ public class ZygoteInit {
|
||||
preload(new TimingsTraceLog("ZygoteInitTiming_lazy", Trace.TRACE_TAG_DALVIK));
|
||||
}
|
||||
|
||||
- private static void beginPreload() {
|
||||
+ private static void beginPreload(boolean fullPreload) {
|
||||
Log.i(TAG, "Calling ZygoteHooks.beginPreload()");
|
||||
|
||||
- ZygoteHooks.onBeginPreload();
|
||||
+ ZygoteHooks.onBeginPreload(fullPreload);
|
||||
}
|
||||
|
||||
- private static void endPreload() {
|
||||
- ZygoteHooks.onEndPreload();
|
||||
+ private static void endPreload(boolean fullPreload) {
|
||||
+ ZygoteHooks.onEndPreload(fullPreload);
|
||||
|
||||
Log.i(TAG, "Called ZygoteHooks.endPreload()");
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:28:27 -0400
|
||||
Subject: [PATCH] disable OpenGL preloading for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 87d393d97d14..f30e17183fca 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -139,9 +139,11 @@ public class ZygoteInit {
|
||||
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadAppProcessHALs");
|
||||
nativePreloadAppProcessHALs();
|
||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
- Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadGraphicsDriver");
|
||||
- maybePreloadGraphicsDriver();
|
||||
- Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
+ if (fullPreload) {
|
||||
+ Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadGraphicsDriver");
|
||||
+ maybePreloadGraphicsDriver();
|
||||
+ Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
+ }
|
||||
preloadSharedLibraries();
|
||||
preloadTextResources();
|
||||
// Ask the WebViewFactory to do any initialization that must run in the zygote process,
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:28:52 -0400
|
||||
Subject: [PATCH] disable resource preloading for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 87d393d97d14..5cd919d49014 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -133,9 +133,11 @@ public class ZygoteInit {
|
||||
bootTimingsTraceLog.traceBegin("CacheNonBootClasspathClassLoaders");
|
||||
cacheNonBootClasspathClassLoaders();
|
||||
bootTimingsTraceLog.traceEnd(); // CacheNonBootClasspathClassLoaders
|
||||
- bootTimingsTraceLog.traceBegin("PreloadResources");
|
||||
- Resources.preloadResources();
|
||||
- bootTimingsTraceLog.traceEnd(); // PreloadResources
|
||||
+ if (fullPreload) {
|
||||
+ bootTimingsTraceLog.traceBegin("PreloadResources");
|
||||
+ Resources.preloadResources();
|
||||
+ bootTimingsTraceLog.traceEnd(); // PreloadResources
|
||||
+ }
|
||||
Trace.traceBegin(Trace.TRACE_TAG_DALVIK, "PreloadAppProcessHALs");
|
||||
nativePreloadAppProcessHALs();
|
||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:30:59 -0400
|
||||
Subject: [PATCH] disable class preloading for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 5cd919d49014..21d412a3f9ec 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -127,9 +127,11 @@ public class ZygoteInit {
|
||||
bootTimingsTraceLog.traceBegin("BeginPreload");
|
||||
beginPreload(fullPreload);
|
||||
bootTimingsTraceLog.traceEnd(); // BeginPreload
|
||||
- bootTimingsTraceLog.traceBegin("PreloadClasses");
|
||||
- preloadClasses();
|
||||
- bootTimingsTraceLog.traceEnd(); // PreloadClasses
|
||||
+ if (fullPreload) {
|
||||
+ bootTimingsTraceLog.traceBegin("PreloadClasses");
|
||||
+ preloadClasses();
|
||||
+ bootTimingsTraceLog.traceEnd(); // PreloadClasses
|
||||
+ }
|
||||
bootTimingsTraceLog.traceBegin("CacheNonBootClasspathClassLoaders");
|
||||
cacheNonBootClasspathClassLoaders();
|
||||
bootTimingsTraceLog.traceEnd(); // CacheNonBootClasspathClassLoaders
|
@ -0,0 +1,28 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:31:29 -0400
|
||||
Subject: [PATCH] disable WebView reservation for exec spawning
|
||||
|
||||
---
|
||||
core/java/com/android/internal/os/ZygoteInit.java | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 21d412a3f9ec..2ced52d06a17 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -148,9 +148,11 @@ public class ZygoteInit {
|
||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
preloadSharedLibraries();
|
||||
preloadTextResources();
|
||||
- // Ask the WebViewFactory to do any initialization that must run in the zygote process,
|
||||
- // for memory sharing purposes.
|
||||
- WebViewFactory.prepareWebViewInZygote();
|
||||
+ if (fullPreload) {
|
||||
+ // Ask the WebViewFactory to do any initialization that must run in the zygote process,
|
||||
+ // for memory sharing purposes.
|
||||
+ WebViewFactory.prepareWebViewInZygote();
|
||||
+ }
|
||||
endPreload(fullPreload);
|
||||
warmUpJcaProviders();
|
||||
Log.d(TAG, "end preload");
|
@ -0,0 +1,57 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 14 May 2019 14:34:32 -0400
|
||||
Subject: [PATCH] disable JCA provider warm up for exec spawning
|
||||
|
||||
---
|
||||
.../com/android/internal/os/ZygoteInit.java | 22 ++++++++++---------
|
||||
1 file changed, 12 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
index 2ced52d06a17..55c68981f919 100644
|
||||
--- a/core/java/com/android/internal/os/ZygoteInit.java
|
||||
+++ b/core/java/com/android/internal/os/ZygoteInit.java
|
||||
@@ -154,7 +154,7 @@ public class ZygoteInit {
|
||||
WebViewFactory.prepareWebViewInZygote();
|
||||
}
|
||||
endPreload(fullPreload);
|
||||
- warmUpJcaProviders();
|
||||
+ warmUpJcaProviders(fullPreload);
|
||||
Log.d(TAG, "end preload");
|
||||
|
||||
sPreloadComplete = true;
|
||||
@@ -223,7 +223,7 @@ public class ZygoteInit {
|
||||
* By doing it here we avoid that each app does it when requesting a service from the provider
|
||||
* for the first time.
|
||||
*/
|
||||
- private static void warmUpJcaProviders() {
|
||||
+ private static void warmUpJcaProviders(boolean fullPreload) {
|
||||
long startTime = SystemClock.uptimeMillis();
|
||||
Trace.traceBegin(
|
||||
Trace.TRACE_TAG_DALVIK, "Starting installation of AndroidKeyStoreProvider");
|
||||
@@ -233,15 +233,17 @@ public class ZygoteInit {
|
||||
+ (SystemClock.uptimeMillis() - startTime) + "ms.");
|
||||
Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
|
||||
- startTime = SystemClock.uptimeMillis();
|
||||
- Trace.traceBegin(
|
||||
- Trace.TRACE_TAG_DALVIK, "Starting warm up of JCA providers");
|
||||
- for (Provider p : Security.getProviders()) {
|
||||
- p.warmUpServiceProvision();
|
||||
+ if (fullPreload) {
|
||||
+ startTime = SystemClock.uptimeMillis();
|
||||
+ Trace.traceBegin(
|
||||
+ Trace.TRACE_TAG_DALVIK, "Starting warm up of JCA providers");
|
||||
+ for (Provider p : Security.getProviders()) {
|
||||
+ p.warmUpServiceProvision();
|
||||
+ }
|
||||
+ Log.i(TAG, "Warmed up JCA providers in "
|
||||
+ + (SystemClock.uptimeMillis() - startTime) + "ms.");
|
||||
+ Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
}
|
||||
- Log.i(TAG, "Warmed up JCA providers in "
|
||||
- + (SystemClock.uptimeMillis() - startTime) + "ms.");
|
||||
- Trace.traceEnd(Trace.TRACE_TAG_DALVIK);
|
||||
}
|
||||
|
||||
private static boolean isExperimentEnabled(String experiment) {
|
@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Danny Lin <danny@kdrag0n.dev>
|
||||
Date: Tue, 12 Oct 2021 01:03:59 +0300
|
||||
Subject: [PATCH] SystemUI: Use new privacy indicators for location
|
||||
|
||||
Android has had location indicators for a while, but let's use the new
|
||||
privacy indicator infrastructure for displaying them. This makes them
|
||||
integrate better with the new camera and microphone indicators.
|
||||
|
||||
Change-Id: Ie457bb2dad17bddbf9dc3a818e3ec586023ce918
|
||||
---
|
||||
core/java/android/permission/PermissionUsageHelper.java | 2 +-
|
||||
.../src/com/android/systemui/privacy/PrivacyItemController.kt | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/permission/PermissionUsageHelper.java b/core/java/android/permission/PermissionUsageHelper.java
|
||||
index 1f798baf1bd6..20502cdc81c3 100644
|
||||
--- a/core/java/android/permission/PermissionUsageHelper.java
|
||||
+++ b/core/java/android/permission/PermissionUsageHelper.java
|
||||
@@ -108,7 +108,7 @@ public class PermissionUsageHelper implements AppOpsManager.OnOpActiveChangedLis
|
||||
|
||||
private static boolean shouldShowLocationIndicator() {
|
||||
return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
|
||||
- PROPERTY_LOCATION_INDICATORS_ENABLED, false);
|
||||
+ PROPERTY_LOCATION_INDICATORS_ENABLED, true);
|
||||
}
|
||||
|
||||
private static long getRecentThreshold(Long now) {
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
|
||||
index eb8ef9bf3e50..4b406f76300a 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/privacy/PrivacyItemController.kt
|
||||
@@ -63,7 +63,7 @@ class PrivacyItemController @Inject constructor(
|
||||
val micCameraAvailable
|
||||
get() = privacyConfig.micCameraAvailable
|
||||
val locationAvailable
|
||||
- get() = privacyConfig.locationAvailable
|
||||
+ get() = true
|
||||
val allIndicatorsAvailable
|
||||
get() = micCameraAvailable && locationAvailable && privacyConfig.mediaProjectionAvailable
|
||||
|
||||
@@ -274,4 +274,4 @@ class PrivacyItemController @Inject constructor(
|
||||
listeningCanceller = delegate.executeDelayed({ setListeningState() }, 0L)
|
||||
}
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 20 Oct 2021 19:40:42 -0400
|
||||
Subject: [PATCH] core/config: [temporary] don't report statementservice
|
||||
crashes
|
||||
|
||||
There's a known issue in AOSP 12 caused by it creating overly large
|
||||
intents for the work manager. It's not caused by anything done by end
|
||||
users and they can't work around it so avoid reporting it to them since
|
||||
they get a message each time it tries again.
|
||||
---
|
||||
core/res/res/values/config.xml | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
|
||||
index 3bc33bac37bc..be714871ad0f 100644
|
||||
--- a/core/res/res/values/config.xml
|
||||
+++ b/core/res/res/values/config.xml
|
||||
@@ -4211,7 +4211,7 @@
|
||||
|
||||
<!-- List of comma separated package names for which we the system will not show crash, ANR,
|
||||
etc. dialogs. -->
|
||||
- <string translatable="false" name="config_appsNotReportingCrashes"></string>
|
||||
+ <string translatable="false" name="config_appsNotReportingCrashes">com.android.statementservice</string>
|
||||
|
||||
<!-- Inactivity threshold (in milliseconds) used in JobScheduler. JobScheduler will consider
|
||||
the device to be "idle" after being inactive for this long. -->
|
@ -0,0 +1,317 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Park Ju Hyung <qkrwngud825@gmail.com>
|
||||
Date: Sun, 15 Jan 2017 03:33:04 +0900
|
||||
Subject: [PATCH] SystemUI: add burnIn protection
|
||||
|
||||
Devices with AMOLED display suffer from
|
||||
status-bar's notification items and nagivation bar's software keys
|
||||
causing permanent burn-ins when used long-term.
|
||||
|
||||
Moving all items in the area
|
||||
both horizontally and vertically workarounds this problem.
|
||||
|
||||
jrizzoli: integrate with runtime cmsdk preference
|
||||
|
||||
Linux4: Removed toggle from settings - the burnIn protection is always
|
||||
enabled if the corresponding AOSP overlay is set to true
|
||||
Updated for T
|
||||
|
||||
Change-Id: I35b04d1edff86a556adb3ad349569e5d82653f16
|
||||
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
|
||||
Signed-off-by: Alex Naidis <alex.naidis@linux.com>
|
||||
Signed-off-by: Thecrazyskull <anaskarbila@gmail.com>
|
||||
Signed-off-by: Joey Rizzoli <joey@lineageos.org>
|
||||
---
|
||||
.../SystemUI/res/values/lineage_dimens.xml | 3 +
|
||||
.../navigationbar/NavigationBarView.java | 26 +++++
|
||||
.../statusbar/phone/CentralSurfacesImpl.java | 14 +++
|
||||
.../statusbar/phone/PhoneStatusBarView.java | 27 +++++
|
||||
.../policy/BurnInProtectionController.java | 105 ++++++++++++++++++
|
||||
5 files changed, 175 insertions(+)
|
||||
create mode 100644 packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
|
||||
|
||||
diff --git a/packages/SystemUI/res/values/lineage_dimens.xml b/packages/SystemUI/res/values/lineage_dimens.xml
|
||||
index ca6e7db4c5b1..c0acba502cc2 100644
|
||||
--- a/packages/SystemUI/res/values/lineage_dimens.xml
|
||||
+++ b/packages/SystemUI/res/values/lineage_dimens.xml
|
||||
@@ -24,4 +24,7 @@
|
||||
|
||||
<!-- Screen Record -->
|
||||
<dimen name="screenrecord_dot_size">48dp</dimen>
|
||||
+
|
||||
+ <dimen name="burnin_protection_horizontal_shift">3dp</dimen>
|
||||
+ <dimen name="burnin_protection_vertical_shift">1dp</dimen>
|
||||
</resources>
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
|
||||
index aae1aa9a6698..90bcd525b32f 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/navigationbar/NavigationBarView.java
|
||||
@@ -159,6 +159,13 @@ public class NavigationBarView extends FrameLayout {
|
||||
private FloatingRotationButton mFloatingRotationButton;
|
||||
private RotationButtonController mRotationButtonController;
|
||||
|
||||
+ private int mBasePaddingBottom;
|
||||
+ private int mBasePaddingLeft;
|
||||
+ private int mBasePaddingRight;
|
||||
+ private int mBasePaddingTop;
|
||||
+
|
||||
+ private ViewGroup mNavigationBarContents;
|
||||
+
|
||||
/**
|
||||
* Helper that is responsible for showing the right toast when a disallowed activity operation
|
||||
* occurred. In pinned mode, we show instructions on how to break out of this mode, whilst in
|
||||
@@ -889,12 +896,31 @@ public class NavigationBarView extends FrameLayout {
|
||||
mContextualButtonGroup.setButtonVisibility(R.id.accessibility_button, visible);
|
||||
}
|
||||
|
||||
+ public void shiftNavigationBarItems(int horizontalShift, int verticalShift) {
|
||||
+ if (mNavigationBarContents == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mNavigationBarContents.setPaddingRelative(mBasePaddingLeft + horizontalShift,
|
||||
+ mBasePaddingTop + verticalShift,
|
||||
+ mBasePaddingRight + horizontalShift,
|
||||
+ mBasePaddingBottom - verticalShift);
|
||||
+ invalidate();
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mNavigationInflaterView = findViewById(R.id.navigation_inflater);
|
||||
mNavigationInflaterView.setButtonDispatchers(mButtonDispatchers);
|
||||
|
||||
+
|
||||
+ mNavigationBarContents = (ViewGroup) findViewById(R.id.nav_buttons);
|
||||
+
|
||||
+ mBasePaddingLeft = mNavigationBarContents.getPaddingStart();
|
||||
+ mBasePaddingTop = mNavigationBarContents.getPaddingTop();
|
||||
+ mBasePaddingRight = mNavigationBarContents.getPaddingEnd();
|
||||
+ mBasePaddingBottom = mNavigationBarContents.getPaddingBottom();
|
||||
updateOrientationViews();
|
||||
reloadNavIcons();
|
||||
}
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
|
||||
index 73b95114b005..b943444676f6 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
|
||||
@@ -216,6 +216,7 @@ import com.android.systemui.statusbar.notification.stack.NotificationStackScroll
|
||||
import com.android.systemui.statusbar.phone.dagger.StatusBarPhoneModule;
|
||||
import com.android.systemui.statusbar.policy.BatteryController;
|
||||
import com.android.systemui.statusbar.policy.BrightnessMirrorController;
|
||||
+import com.android.systemui.statusbar.policy.BurnInProtectionController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController;
|
||||
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
|
||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||
@@ -379,6 +380,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
private BiometricUnlockController mBiometricUnlockController;
|
||||
private final LightBarController mLightBarController;
|
||||
private final AutoHideController mAutoHideController;
|
||||
+ private BurnInProtectionController mBurnInProtectionController;
|
||||
|
||||
private final Point mCurrentDisplaySize = new Point();
|
||||
|
||||
@@ -1223,6 +1225,12 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
mShadeSurface.updateExpansionAndVisibility();
|
||||
setBouncerShowingForStatusBarComponents(mBouncerShowing);
|
||||
checkBarModes();
|
||||
+
|
||||
+ if (mContext.getResources().getBoolean(
|
||||
+ com.android.internal.R.bool.config_enableBurnInProtection)) {
|
||||
+ mBurnInProtectionController = new BurnInProtectionController(mContext,
|
||||
+ this, mStatusBarView);
|
||||
+ }
|
||||
});
|
||||
mStatusBarInitializer.initializeStatusBar();
|
||||
|
||||
@@ -2494,6 +2502,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
|
||||
updateNotificationPanelTouchState();
|
||||
getNotificationShadeWindowViewController().cancelCurrentTouch();
|
||||
+ if (mBurnInProtectionController != null) {
|
||||
+ mBurnInProtectionController.stopShiftTimer(true);
|
||||
+ }
|
||||
if (mLaunchCameraOnFinishedGoingToSleep) {
|
||||
mLaunchCameraOnFinishedGoingToSleep = false;
|
||||
|
||||
@@ -2659,6 +2670,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
|
||||
}
|
||||
}
|
||||
updateScrimController();
|
||||
+ if (mBurnInProtectionController != null) {
|
||||
+ mBurnInProtectionController.startShiftTimer(true);
|
||||
+ }
|
||||
}
|
||||
};
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
index 1207388b4389..3015dfa7768f 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
|
||||
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.phone;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
+import android.content.res.Resources;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
@@ -65,6 +66,13 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
|
||||
private final CommandQueue mCommandQueue;
|
||||
private final StatusBarContentInsetsProvider mContentInsetsProvider;
|
||||
|
||||
+ private int mBasePaddingBottom;
|
||||
+ private int mBasePaddingLeft;
|
||||
+ private int mBasePaddingRight;
|
||||
+ private int mBasePaddingTop;
|
||||
+
|
||||
+ private ViewGroup mStatusBarContents;
|
||||
+
|
||||
private DarkReceiver mBattery;
|
||||
private ClockController mClockController;
|
||||
private int mRotationOrientation = -1;
|
||||
@@ -143,6 +151,18 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
|
||||
StatusBarUserChipViewBinder.bind(container, viewModel);
|
||||
}
|
||||
|
||||
+ public void shiftStatusBarItems(int horizontalShift, int verticalShift) {
|
||||
+ if (mStatusBarContents == null) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ mStatusBarContents.setPaddingRelative(mBasePaddingLeft + horizontalShift,
|
||||
+ mBasePaddingTop + verticalShift,
|
||||
+ mBasePaddingRight + horizontalShift,
|
||||
+ mBasePaddingBottom - verticalShift);
|
||||
+ invalidate();
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
@@ -150,6 +170,13 @@ public class PhoneStatusBarView extends FrameLayout implements Callbacks {
|
||||
mClockController = new ClockController(getContext(), this);
|
||||
mCutoutSpace = findViewById(R.id.cutout_space_view);
|
||||
|
||||
+ mStatusBarContents = (ViewGroup) findViewById(R.id.status_bar_contents);
|
||||
+
|
||||
+ mBasePaddingLeft = mStatusBarContents.getPaddingStart();
|
||||
+ mBasePaddingTop = mStatusBarContents.getPaddingTop();
|
||||
+ mBasePaddingRight = mStatusBarContents.getPaddingEnd();
|
||||
+ mBasePaddingBottom = mStatusBarContents.getPaddingBottom();
|
||||
+
|
||||
updateResources();
|
||||
}
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
|
||||
new file mode 100644
|
||||
index 000000000000..864d86ffd6a3
|
||||
--- /dev/null
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/BurnInProtectionController.java
|
||||
@@ -0,0 +1,105 @@
|
||||
+/*
|
||||
+ * Copyright 2017 Paranoid Android
|
||||
+ * Copyright 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.
|
||||
+ */
|
||||
+
|
||||
+package com.android.systemui.statusbar.policy;
|
||||
+
|
||||
+import android.content.Context;
|
||||
+import android.content.res.Resources;
|
||||
+import android.os.Handler;
|
||||
+import android.os.Looper;
|
||||
+import android.util.Log;
|
||||
+
|
||||
+import com.android.systemui.R;
|
||||
+import com.android.systemui.navigationbar.NavigationBarView;
|
||||
+import com.android.systemui.statusbar.phone.PhoneStatusBarView;
|
||||
+import com.android.systemui.statusbar.phone.CentralSurfacesImpl;
|
||||
+
|
||||
+public class BurnInProtectionController {
|
||||
+ private static final String TAG = "BurnInProtectionController";
|
||||
+ private static final boolean DEBUG = false;
|
||||
+ private static final long INTERVAL = 60000; // Milliseconds
|
||||
+
|
||||
+ private int mHorizontalShift = 0;
|
||||
+ private int mVerticalShift = 0;
|
||||
+ private int mHorizontalDirection = 1;
|
||||
+ private int mVerticalDirection = 1;
|
||||
+ private int mNavigationBarHorizontalMaxShift;
|
||||
+ private int mNavigationBarVerticalMaxShift;
|
||||
+ private int mHorizontalMaxShift;
|
||||
+ private int mVerticalMaxShift;
|
||||
+ private long mShiftInterval;
|
||||
+
|
||||
+ private final Handler mHandler = new Handler();
|
||||
+ private final Runnable mRunnable = () -> {
|
||||
+ shiftItems();
|
||||
+ mHandler.postDelayed(this.mRunnable, INTERVAL);
|
||||
+ };
|
||||
+
|
||||
+ private PhoneStatusBarView mPhoneStatusBarView;
|
||||
+ private CentralSurfacesImpl mStatusBar;
|
||||
+
|
||||
+ private Context mContext;
|
||||
+
|
||||
+ public BurnInProtectionController(Context context, CentralSurfacesImpl statusBar,
|
||||
+ PhoneStatusBarView phoneStatusBarView) {
|
||||
+ mContext = context;
|
||||
+
|
||||
+ mPhoneStatusBarView = phoneStatusBarView;
|
||||
+ mStatusBar = statusBar;
|
||||
+
|
||||
+ mHorizontalMaxShift = mContext.getResources()
|
||||
+ .getDimensionPixelSize(R.dimen.burnin_protection_horizontal_shift);
|
||||
+ // total of ((vertical_max_shift - 1) * 2) pixels can be moved
|
||||
+ mVerticalMaxShift = mContext.getResources()
|
||||
+ .getDimensionPixelSize(R.dimen.burnin_protection_vertical_shift) - 1;
|
||||
+ }
|
||||
+
|
||||
+ public void startShiftTimer(boolean enabled) {
|
||||
+ if (!enabled) return;
|
||||
+ mHandler.removeCallbacks(mRunnable);
|
||||
+ mHandler.postDelayed(mRunnable, INTERVAL);
|
||||
+ if (DEBUG) Log.d(TAG, "Started shift timer");
|
||||
+ }
|
||||
+
|
||||
+ public void stopShiftTimer(boolean enabled) {
|
||||
+ if (!enabled) return;
|
||||
+ mHandler.removeCallbacks(mRunnable);
|
||||
+ if (DEBUG) Log.d(TAG, "Canceled shift timer");
|
||||
+ }
|
||||
+
|
||||
+ private void shiftItems() {
|
||||
+ mHorizontalShift += mHorizontalDirection;
|
||||
+ if ((mHorizontalShift >= mHorizontalMaxShift) ||
|
||||
+ (mHorizontalShift <= -mHorizontalMaxShift)) {
|
||||
+ mHorizontalDirection *= -1;
|
||||
+ }
|
||||
+
|
||||
+ mVerticalShift += mVerticalDirection;
|
||||
+ if ((mVerticalShift >= mVerticalMaxShift) ||
|
||||
+ (mVerticalShift <= -mVerticalMaxShift)) {
|
||||
+ mVerticalDirection *= -1;
|
||||
+ }
|
||||
+
|
||||
+ mPhoneStatusBarView.shiftStatusBarItems(mHorizontalShift, mVerticalShift);
|
||||
+ NavigationBarView navigationBarView = mStatusBar.getNavigationBarView();
|
||||
+
|
||||
+ if (navigationBarView != null) {
|
||||
+ navigationBarView.shiftNavigationBarItems(mHorizontalShift, mVerticalShift);
|
||||
+ }
|
||||
+ if (DEBUG) Log.d(TAG, "Shifting items\u2026");
|
||||
+ }
|
||||
+}
|
@ -0,0 +1,194 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 8 Aug 2022 19:03:37 +0300
|
||||
Subject: [PATCH] add an option to show the details of an application error to
|
||||
the user
|
||||
|
||||
Adds a "Show details" item to crash and ANR (app not responding) dialogs that takes the user to a
|
||||
SystemUI activity which shows the error details and allows to copy them to the clipboard or to
|
||||
export them via the standard sharing UI.
|
||||
---
|
||||
.../android/app/ApplicationErrorReport.java | 29 +++++++++++++++++--
|
||||
core/res/res/layout/app_anr_dialog.xml | 4 +--
|
||||
core/res/res/layout/app_error_dialog.xml | 4 +--
|
||||
core/res/res/values/strings.xml | 2 ++
|
||||
core/res/res/values/symbols.xml | 3 ++
|
||||
.../java/com/android/server/am/AppErrors.java | 1 +
|
||||
6 files changed, 37 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/core/java/android/app/ApplicationErrorReport.java b/core/java/android/app/ApplicationErrorReport.java
|
||||
index 9cea5e8ef4cf..a8f51104d0fa 100644
|
||||
--- a/core/java/android/app/ApplicationErrorReport.java
|
||||
+++ b/core/java/android/app/ApplicationErrorReport.java
|
||||
@@ -25,6 +25,8 @@ import android.content.pm.ResolveInfo;
|
||||
import android.os.Binder;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
+import android.os.Process;
|
||||
+import android.os.SystemClock;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
import android.util.Printer;
|
||||
@@ -98,6 +100,9 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
*/
|
||||
public String packageName;
|
||||
|
||||
+ /** @hide */
|
||||
+ public long packageVersion;
|
||||
+
|
||||
/**
|
||||
* Package name of the application which installed the application this
|
||||
* report pertains to.
|
||||
@@ -162,13 +167,19 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
String packageName, int appFlags) {
|
||||
// check if error reporting is enabled in secure settings
|
||||
int enabled = Settings.Global.getInt(context.getContentResolver(),
|
||||
- Settings.Global.SEND_ACTION_APP_ERROR, 0);
|
||||
+ Settings.Global.SEND_ACTION_APP_ERROR, 1);
|
||||
if (enabled == 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PackageManager pm = context.getPackageManager();
|
||||
|
||||
+ ComponentName logViewerApp = getErrorReportReceiver(pm, packageName,
|
||||
+ android.ext.LogViewerApp.getPackageName());
|
||||
+ if (logViewerApp != null) {
|
||||
+ return logViewerApp;
|
||||
+ }
|
||||
+
|
||||
// look for receiver in the installer package
|
||||
String candidate = null;
|
||||
ComponentName result = null;
|
||||
@@ -233,6 +244,7 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(type);
|
||||
dest.writeString(packageName);
|
||||
+ dest.writeLong(packageVersion);
|
||||
dest.writeString(installerPackageName);
|
||||
dest.writeString(processName);
|
||||
dest.writeLong(time);
|
||||
@@ -260,6 +272,7 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
public void readFromParcel(Parcel in) {
|
||||
type = in.readInt();
|
||||
packageName = in.readString();
|
||||
+ packageVersion = in.readLong();
|
||||
installerPackageName = in.readString();
|
||||
processName = in.readString();
|
||||
time = in.readLong();
|
||||
@@ -345,6 +358,11 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
*/
|
||||
public String crashTag;
|
||||
|
||||
+ /** @hide */
|
||||
+ public long processUptimeMs;
|
||||
+ /** @hide */
|
||||
+ public long processStartupLatencyMs;
|
||||
+
|
||||
/**
|
||||
* Create an uninitialized instance of CrashInfo.
|
||||
*/
|
||||
@@ -398,6 +416,9 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
}
|
||||
|
||||
exceptionMessage = sanitizeString(exceptionMessage);
|
||||
+
|
||||
+ processUptimeMs = SystemClock.elapsedRealtime() - Process.getStartElapsedRealtime();
|
||||
+ processStartupLatencyMs = Process.getStartElapsedRealtime() - Process.getStartRequestedElapsedRealtime();
|
||||
}
|
||||
|
||||
/** {@hide} */
|
||||
@@ -439,6 +460,8 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
throwLineNumber = in.readInt();
|
||||
stackTrace = in.readString();
|
||||
crashTag = in.readString();
|
||||
+ processUptimeMs = in.readLong();
|
||||
+ processStartupLatencyMs = in.readLong();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,6 +478,8 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
dest.writeInt(throwLineNumber);
|
||||
dest.writeString(stackTrace);
|
||||
dest.writeString(crashTag);
|
||||
+ dest.writeLong(processUptimeMs);
|
||||
+ dest.writeLong(processStartupLatencyMs);
|
||||
int total = dest.dataPosition()-start;
|
||||
if (Binder.CHECK_PARCEL_SIZE && total > 20*1024) {
|
||||
Slog.d("Error", "ERR: exHandler=" + exceptionHandlerClassName);
|
||||
@@ -704,7 +729,7 @@ public class ApplicationErrorReport implements Parcelable {
|
||||
*/
|
||||
public void dump(Printer pw, String prefix) {
|
||||
pw.println(prefix + "type: " + type);
|
||||
- pw.println(prefix + "packageName: " + packageName);
|
||||
+ pw.println(prefix + "packageName: " + packageName + ":" + packageVersion);
|
||||
pw.println(prefix + "installerPackageName: " + installerPackageName);
|
||||
pw.println(prefix + "processName: " + processName);
|
||||
pw.println(prefix + "time: " + time);
|
||||
diff --git a/core/res/res/layout/app_anr_dialog.xml b/core/res/res/layout/app_anr_dialog.xml
|
||||
index 5ad0f4c0f6cc..ad3a2d2991de 100644
|
||||
--- a/core/res/res/layout/app_anr_dialog.xml
|
||||
+++ b/core/res/res/layout/app_anr_dialog.xml
|
||||
@@ -41,8 +41,8 @@
|
||||
android:id="@+id/aerr_report"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
- android:text="@string/aerr_report"
|
||||
- android:drawableStart="@drawable/ic_feedback"
|
||||
+ android:text="@string/aerr_show_details"
|
||||
+ android:drawableStart="@drawable/ic_info_outline_24"
|
||||
style="@style/aerr_list_item" />
|
||||
|
||||
</LinearLayout>
|
||||
diff --git a/core/res/res/layout/app_error_dialog.xml b/core/res/res/layout/app_error_dialog.xml
|
||||
index c3b149a1e295..a47b82018377 100644
|
||||
--- a/core/res/res/layout/app_error_dialog.xml
|
||||
+++ b/core/res/res/layout/app_error_dialog.xml
|
||||
@@ -52,8 +52,8 @@
|
||||
android:id="@+id/aerr_report"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
- android:text="@string/aerr_report"
|
||||
- android:drawableStart="@drawable/ic_feedback"
|
||||
+ android:text="@string/aerr_show_details"
|
||||
+ android:drawableStart="@drawable/ic_info_outline_24"
|
||||
style="@style/aerr_list_item" />
|
||||
|
||||
<Button
|
||||
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
|
||||
index 4596ca74bf8f..c52255b62748 100644
|
||||
--- a/core/res/res/values/strings.xml
|
||||
+++ b/core/res/res/values/strings.xml
|
||||
@@ -6363,4 +6363,6 @@ ul.</string>
|
||||
<!-- Communal profile label on a screen. This can be used as a tab label for this profile in tabbed views and can be used to represent the profile in sharing surfaces, etc. [CHAR LIMIT=20] -->
|
||||
<string name="profile_label_communal">Communal</string>
|
||||
|
||||
+ <!-- Button that opens the screen with details of an application error -->
|
||||
+ <string name="aerr_show_details">Show details</string>
|
||||
</resources>
|
||||
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
|
||||
index fd6158d02b8f..6c3c6c1f4e46 100644
|
||||
--- a/core/res/res/values/symbols.xml
|
||||
+++ b/core/res/res/values/symbols.xml
|
||||
@@ -5129,6 +5129,9 @@
|
||||
<java-symbol type="id" name="language_picker_item" />
|
||||
<java-symbol type="id" name="language_picker_header" />
|
||||
|
||||
+ <!-- Button that opens the screen with details of an application error -->
|
||||
+ <java-symbol type="string" name="aerr_show_details" />
|
||||
+
|
||||
<java-symbol type="dimen" name="status_bar_height_default" />
|
||||
|
||||
<java-symbol type="string" name="default_card_name"/>
|
||||
diff --git a/services/core/java/com/android/server/am/AppErrors.java b/services/core/java/com/android/server/am/AppErrors.java
|
||||
index 061bcd740f6b..937b0eacff66 100644
|
||||
--- a/services/core/java/com/android/server/am/AppErrors.java
|
||||
+++ b/services/core/java/com/android/server/am/AppErrors.java
|
||||
@@ -838,6 +838,7 @@ class AppErrors {
|
||||
|
||||
ApplicationErrorReport report = new ApplicationErrorReport();
|
||||
report.packageName = r.info.packageName;
|
||||
+ report.packageVersion = r.info.longVersionCode;
|
||||
report.installerPackageName = errState.getErrorReportReceiver().getPackageName();
|
||||
report.processName = r.processName;
|
||||
report.time = timeMillis;
|
@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Sat, 5 Nov 2022 12:54:52 +0200
|
||||
Subject: [PATCH] don't leak device-wide package list to apps when work profile
|
||||
is present
|
||||
|
||||
If the primary user had a work profile, then apps installed in primary user could see packages that
|
||||
were installed only in secondary user(s). They couldn't see which secondary user had which apps,
|
||||
only presence of such packages was revealed.
|
||||
|
||||
This special handling of MATCH_UNINSTALLED_PACKAGES flag was added in October 2016 for compatibility
|
||||
with legacy launchers. It is not needed anymore, at least for popular third party launchers.
|
||||
|
||||
Note that apps in owner user can still see apps in work profile of owner user, it's part of a public
|
||||
API. Also, apps that are not installed in primary user are visible in Settings -> Apps, with
|
||||
"Not installed for this user" subtitle.
|
||||
|
||||
See commit 0d1fd8d09163566d2c7eb72037f63b6404ada642 and issue report
|
||||
https://github.com/GrapheneOS/os-issue-tracker/issues/1634 for more details.
|
||||
---
|
||||
.../java/com/android/server/pm/ComputerEngine.java | 12 ------------
|
||||
1 file changed, 12 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/ComputerEngine.java b/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
index 3cb2420cd223..063fc92dddb8 100644
|
||||
--- a/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
+++ b/services/core/java/com/android/server/pm/ComputerEngine.java
|
||||
@@ -2711,24 +2711,12 @@ public class ComputerEngine implements Computer {
|
||||
* Update given flags when being used to request {@link PackageInfo}.
|
||||
*/
|
||||
public final long updateFlagsForPackage(long flags, int userId) {
|
||||
- final boolean isCallerSystemUser = UserHandle.getCallingUserId()
|
||||
- == UserHandle.USER_SYSTEM;
|
||||
if ((flags & PackageManager.MATCH_ANY_USER) != 0) {
|
||||
// require the permission to be held; the calling uid and given user id referring
|
||||
// to the same user is not sufficient
|
||||
enforceCrossUserPermission(Binder.getCallingUid(), userId, false, false,
|
||||
!isRecentsAccessingChildProfiles(Binder.getCallingUid(), userId),
|
||||
"MATCH_ANY_USER flag requires INTERACT_ACROSS_USERS permission");
|
||||
- } else if ((flags & PackageManager.MATCH_UNINSTALLED_PACKAGES) != 0
|
||||
- && isCallerSystemUser
|
||||
- && mUserManager.hasProfile(UserHandle.USER_SYSTEM)) {
|
||||
- // If the caller wants all packages and has a profile associated with it,
|
||||
- // then match all users. This is to make sure that launchers that need to access
|
||||
- //work
|
||||
- // profile apps don't start breaking. TODO: Remove this hack when launchers stop
|
||||
- //using
|
||||
- // MATCH_UNINSTALLED_PACKAGES to query apps in other profiles. b/31000380
|
||||
- flags |= PackageManager.MATCH_ANY_USER;
|
||||
}
|
||||
return updateFlags(flags, userId);
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 30 Jan 2023 19:04:30 +0200
|
||||
Subject: [PATCH] disable package parser cache
|
||||
|
||||
This is needed for properly verifying updates of system packages.
|
||||
---
|
||||
.../java/com/android/server/pm/PackageManagerServiceUtils.java | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
|
||||
index 40591fcf4c98..6c71f54d6d74 100644
|
||||
--- a/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
|
||||
+++ b/services/core/java/com/android/server/pm/PackageManagerServiceUtils.java
|
||||
@@ -200,7 +200,7 @@ public class PackageManagerServiceUtils {
|
||||
/**
|
||||
* The initial enabled state of the cache before other checks are done.
|
||||
*/
|
||||
- private static final boolean DEFAULT_PACKAGE_PARSER_CACHE_ENABLED = true;
|
||||
+ private static final boolean DEFAULT_PACKAGE_PARSER_CACHE_ENABLED = false;
|
||||
|
||||
/**
|
||||
* Whether to skip all other checks and force the cache to be enabled.
|
||||
@@ -1440,6 +1440,7 @@ public class PackageManagerServiceUtils {
|
||||
boolean isUserDebugBuild, String incrementalVersion) {
|
||||
if (!FORCE_PACKAGE_PARSED_CACHE_ENABLED) {
|
||||
if (!DEFAULT_PACKAGE_PARSER_CACHE_ENABLED) {
|
||||
+ FileUtils.deleteContentsAndDir(Environment.getPackageCacheDirectory());
|
||||
return null;
|
||||
}
|
||||
|
@ -0,0 +1,195 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 31 Jan 2023 17:55:11 +0200
|
||||
Subject: [PATCH] perform additional boot-time checks on system package updates
|
||||
|
||||
---
|
||||
.../server/pm/InstallPackageHelper.java | 7 +
|
||||
.../android/server/pm/PackageVerityExt.java | 160 ++++++++++++++++++
|
||||
2 files changed, 167 insertions(+)
|
||||
create mode 100644 services/core/java/com/android/server/pm/PackageVerityExt.java
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
index 2ed4dfa4e8db..8ebfc9c4bb74 100644
|
||||
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
@@ -3960,6 +3960,13 @@ final class InstallPackageHelper {
|
||||
@Nullable UserHandle user) throws PackageManagerException {
|
||||
final boolean scanSystemPartition =
|
||||
(parseFlags & ParsingPackageUtils.PARSE_IS_SYSTEM_DIR) != 0;
|
||||
+ if ((scanFlags & SCAN_BOOTING) != 0) {
|
||||
+ if (scanSystemPartition) {
|
||||
+ PackageVerityExt.addSystemPackage(parsedPackage);
|
||||
+ } else {
|
||||
+ PackageVerityExt.checkSystemPackageUpdate(parsedPackage);
|
||||
+ }
|
||||
+ }
|
||||
final ScanRequest initialScanRequest = prepareInitialScanRequest(parsedPackage, parseFlags,
|
||||
scanFlags, user, null);
|
||||
final PackageSetting installedPkgSetting = initialScanRequest.mPkgSetting;
|
||||
diff --git a/services/core/java/com/android/server/pm/PackageVerityExt.java b/services/core/java/com/android/server/pm/PackageVerityExt.java
|
||||
new file mode 100644
|
||||
index 000000000000..955eefcdae64
|
||||
--- /dev/null
|
||||
+++ b/services/core/java/com/android/server/pm/PackageVerityExt.java
|
||||
@@ -0,0 +1,160 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2022 GrapheneOS
|
||||
+ * SPDX-License-Identifier: Apache-2.0
|
||||
+ */
|
||||
+
|
||||
+package com.android.server.pm;
|
||||
+
|
||||
+import android.annotation.Nullable;
|
||||
+import android.content.pm.SigningDetails;
|
||||
+import android.content.pm.parsing.result.ParseResult;
|
||||
+import android.content.pm.parsing.result.ParseTypeImpl;
|
||||
+import android.os.Build;
|
||||
+import android.os.SystemProperties;
|
||||
+import android.util.ArrayMap;
|
||||
+import android.util.Slog;
|
||||
+
|
||||
+import com.android.internal.pm.parsing.pkg.ParsedPackage;
|
||||
+import com.android.internal.pm.pkg.parsing.ParsingPackageUtils;
|
||||
+import com.android.internal.security.VerityUtils;
|
||||
+import com.android.server.pm.pkg.AndroidPackage;
|
||||
+import com.android.server.pm.pkg.AndroidPackageSplit;
|
||||
+
|
||||
+import static android.content.pm.PackageManager.INSTALL_FAILED_BAD_SIGNATURE;
|
||||
+import static android.content.pm.PackageManager.INSTALL_FAILED_INVALID_APK;
|
||||
+import static android.content.pm.PackageManager.INSTALL_FAILED_UPDATE_INCOMPATIBLE;
|
||||
+
|
||||
+// Performs additional checks on system package updates
|
||||
+public class PackageVerityExt {
|
||||
+ private static final String TAG = PackageVerityExt.class.getSimpleName();
|
||||
+
|
||||
+ // Parsed packages from immutable partitions. Static shared libraries are handled separately
|
||||
+ // due to a different policy that OS uses for their replacement
|
||||
+ private static final ArrayMap<String, AndroidPackage> packages = new ArrayMap<>();
|
||||
+ private static final ArrayMap<String, AndroidPackage> staticSharedLibraries = new ArrayMap<>();
|
||||
+
|
||||
+ // Called when PackageManager scans a package from immutable system image partition during OS boot.
|
||||
+ // All packages from immutable partitions are scanned before any packages from mutable partitions.
|
||||
+ public static void addSystemPackage(AndroidPackage pkg) {
|
||||
+ if (pkg.isStaticSharedLibrary()) {
|
||||
+ String name = pkg.getStaticSharedLibraryName();
|
||||
+ AndroidPackage prev;
|
||||
+ synchronized (staticSharedLibraries) {
|
||||
+ prev = staticSharedLibraries.put(name, pkg);
|
||||
+ }
|
||||
+ if (prev != null) {
|
||||
+ Slog.w(TAG, "duplicate static shared lib " + name
|
||||
+ + ": prev " + prev.getPath() + " -> new " + pkg.getPath());
|
||||
+ }
|
||||
+ } else {
|
||||
+ String name = pkg.getManifestPackageName();
|
||||
+ AndroidPackage prev;
|
||||
+ synchronized (packages) {
|
||||
+ prev = packages.put(name, pkg);
|
||||
+ }
|
||||
+ if (prev != null) {
|
||||
+ Slog.w(TAG, "duplicate system package " + name + ": prev " + prev.getPath() +
|
||||
+ " -> new " + pkg.getPath());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // If pkg is a system package update, returns its matching system image package
|
||||
+ @Nullable public static AndroidPackage getSystemPackage(AndroidPackage pkg) {
|
||||
+ if (pkg.isStaticSharedLibrary()) {
|
||||
+ String name = pkg.getStaticSharedLibraryName();
|
||||
+ synchronized (staticSharedLibraries) {
|
||||
+ return staticSharedLibraries.get(name);
|
||||
+ }
|
||||
+ } else {
|
||||
+ String name = pkg.getManifestPackageName();
|
||||
+ synchronized (packages) {
|
||||
+ return packages.get(name);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Called when PackageManager scans a package from mutable partition (ie /data) during OS boot.
|
||||
+ // PackageManagerException thrown from here will prevent this package from replacing its system
|
||||
+ // image version.
|
||||
+ public static void checkSystemPackageUpdate(AndroidPackage maybeSystemPackageUpdate) throws PackageManagerException {
|
||||
+ final AndroidPackage systemPkg = getSystemPackage(maybeSystemPackageUpdate);
|
||||
+
|
||||
+ if (systemPkg == null) {
|
||||
+ // not a system package update
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final AndroidPackage systemPkgUpdate = maybeSystemPackageUpdate;
|
||||
+
|
||||
+ Slog.d(TAG, "Performing verification of system package update "
|
||||
+ + systemPkgUpdate.getManifestPackageName());
|
||||
+
|
||||
+ if (systemPkg.getLongVersionCode() >= systemPkgUpdate.getLongVersionCode()) {
|
||||
+ throw new PackageManagerException(INSTALL_FAILED_UPDATE_INCOMPATIBLE,
|
||||
+ "versionCode of system image package (" + systemPkg.getLongVersionCode()
|
||||
+ + ") is >= versionCode of system package update ("
|
||||
+ + systemPkgUpdate.getLongVersionCode() + ")");
|
||||
+ }
|
||||
+
|
||||
+ boolean checkFsVerity = true;
|
||||
+ if (Build.IS_DEBUGGABLE) {
|
||||
+ if (SystemProperties.getBoolean("persist.disable_boot_time_fsverity_check", false)) {
|
||||
+ checkFsVerity = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (checkFsVerity) {
|
||||
+ checkFsVerity(systemPkgUpdate);
|
||||
+ }
|
||||
+
|
||||
+ final SigningDetails updatePkgSigningDetails = parseSigningDetails(systemPkgUpdate,
|
||||
+ // verify APK against its signature
|
||||
+ false);
|
||||
+
|
||||
+ final SigningDetails systemPkgSigningDetails = parseSigningDetails(systemPkg,
|
||||
+ // skip signature verification, system image APKs are protected by verified boot
|
||||
+ true);
|
||||
+
|
||||
+ final boolean valid = updatePkgSigningDetails.checkCapability(systemPkgSigningDetails,
|
||||
+ SigningDetails.CertCapabilities.INSTALLED_DATA)
|
||||
+ || systemPkgSigningDetails.checkCapability(updatePkgSigningDetails,
|
||||
+ SigningDetails.CertCapabilities.ROLLBACK);
|
||||
+
|
||||
+ if (!valid) {
|
||||
+ String msg = "System package update " + systemPkgUpdate.getManifestPackageName()
|
||||
+ + " signature doesn't match the signature of system image package";
|
||||
+ throw new PackageManagerException(INSTALL_FAILED_BAD_SIGNATURE, msg);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void checkFsVerity(AndroidPackage pkg) throws PackageManagerException {
|
||||
+ // base APK is considered to be a split too
|
||||
+ for (AndroidPackageSplit split : pkg.getSplits()) {
|
||||
+ String apkPath = split.getPath();
|
||||
+ if (!VerityUtils.hasFsverity(apkPath)) {
|
||||
+ throw new PackageManagerException(INSTALL_FAILED_BAD_SIGNATURE,
|
||||
+ "APK doesn't have fs-verity: " + apkPath);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private static SigningDetails parseSigningDetails(AndroidPackage pkg, boolean skipVerify) throws PackageManagerException {
|
||||
+ final ParseTypeImpl input = ParseTypeImpl.forDefaultParsing();
|
||||
+ final ParseResult<SigningDetails> result = ParsingPackageUtils.getSigningDetails(
|
||||
+ input, (ParsedPackage) pkg, skipVerify);
|
||||
+
|
||||
+ if (result.isError()) {
|
||||
+ throw new PackageManagerException(
|
||||
+ result.getErrorCode(), result.getErrorMessage(), result.getException());
|
||||
+ }
|
||||
+
|
||||
+ final SigningDetails sd = result.getResult();
|
||||
+ if (sd == null) {
|
||||
+ throw new PackageManagerException(INSTALL_FAILED_INVALID_APK,
|
||||
+ "Null signing details of package " + pkg.getManifestPackageName());
|
||||
+ }
|
||||
+
|
||||
+ return sd;
|
||||
+ }
|
||||
+}
|
@ -0,0 +1,52 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 31 Jan 2023 19:32:46 +0200
|
||||
Subject: [PATCH] require fs-verity when installing system package updates
|
||||
|
||||
---
|
||||
.../server/pm/InstallPackageHelper.java | 25 +++++++++++++++++++
|
||||
1 file changed, 25 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
index 8ebfc9c4bb74..a7def2c273ad 100644
|
||||
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
@@ -135,6 +135,7 @@ import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SELinux;
|
||||
+import android.os.SystemProperties;
|
||||
import android.os.Trace;
|
||||
import android.os.UserHandle;
|
||||
import android.os.UserManager;
|
||||
@@ -1603,6 +1604,30 @@ final class InstallPackageHelper {
|
||||
parsedPackage.setBaseApkPath(request.getApexInfo().modulePath);
|
||||
}
|
||||
|
||||
+ final AndroidPackage systemPackage = PackageVerityExt.getSystemPackage(parsedPackage);
|
||||
+
|
||||
+ if (systemPackage != null) {
|
||||
+ // this is an update to a system package
|
||||
+
|
||||
+ try {
|
||||
+ PackageVerityExt.checkFsVerity(parsedPackage);
|
||||
+ } catch (PackageManagerException e) {
|
||||
+ String message = "fs-verity not set up for system package update " + e;
|
||||
+ boolean abortInstall = true;
|
||||
+
|
||||
+ if (Build.IS_DEBUGGABLE) {
|
||||
+ if (SystemProperties.getBoolean("persist.disable_install_time_fsverity_check", false)) {
|
||||
+ Slog.d(TAG, message);
|
||||
+ abortInstall = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (abortInstall) {
|
||||
+ throw new PrepareFailure(INSTALL_FAILED_INTERNAL_ERROR, message);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
final PackageFreezer freezer =
|
||||
freezePackageForInstall(pkgName, UserHandle.USER_ALL, installFlags,
|
||||
"installPackageLI", ApplicationExitInfo.REASON_PACKAGE_UPDATED, request);
|
@ -0,0 +1,40 @@
|
||||
From 66d463347a80617e13f5c5f26b4be07380421876 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 27 Dec 2022 11:40:14 +0200
|
||||
Subject: [PATCH] don't allow updating system packages to the same versionCode
|
||||
|
||||
versionCode of many system packages, including privileged ones, is set to the current SDK version
|
||||
and is thus not incremented during non-major OS upgrades.
|
||||
This allowed to downgrade them to the older version that had the same versionCode.
|
||||
---
|
||||
.../android/server/pm/InstallPackageHelper.java | 17 ++++++++++++++++-
|
||||
1 file changed, 16 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
index 4d58218b0cc7..71abd7fd1f89 100644
|
||||
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
|
||||
@@ -1624,7 +1624,22 @@ && cannotInstallWithBadPermissionGroups(parsedPackage)) {
|
||||
}
|
||||
|
||||
if (abortInstall) {
|
||||
- throw new PrepareFailure(INSTALL_FAILED_INTERNAL_ERROR, message);
|
||||
+ throw new PrepareFailure(PackageManager.INSTALL_FAILED_INTERNAL_ERROR, message);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (parsedPackage.getLongVersionCode() == systemPackage.getLongVersionCode()) {
|
||||
+ String message = "Not allowed to update system package to the same versionCode";
|
||||
+ boolean abortInstall = true;
|
||||
+
|
||||
+ if (Build.IS_DEBUGGABLE) {
|
||||
+ if (SystemProperties.getBoolean("persist.disable_same_versionCode_sys_pkg_update_check", false)) {
|
||||
+ Slog.d(TAG, message + ": " + parsedPackage.getManifestPackageName());
|
||||
+ abortInstall = false;
|
||||
+ }
|
||||
+ }
|
||||
+ if (abortInstall) {
|
||||
+ throw new PrepareFailure(PackageManager.INSTALL_FAILED_INTERNAL_ERROR, message);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Fri, 20 Jan 2023 21:45:50 -0500
|
||||
Subject: [PATCH] Replace agnss.goog with the Broadcom PSDS server
|
||||
|
||||
This is heavily based off of the GrapheneOS patch for their server handling:
|
||||
https://github.com/GrapheneOS/platform_frameworks_base/commit/f29bedd2aad471b27d1eb6ec3b49e9751d8e0c5a
|
||||
|
||||
Change-Id: Idd867bcd55d65d4aae7f9744de4807db46cf4374
|
||||
Signed-off-by: Tad <tad@spotco.us>
|
||||
---
|
||||
.../location/gnss/GnssPsdsDownloader.java | 45 ++++++++++++++-----
|
||||
1 file changed, 35 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java b/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
|
||||
index 243910dd9541..f111d5190340 100644
|
||||
--- a/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
|
||||
+++ b/services/core/java/com/android/server/location/gnss/GnssPsdsDownloader.java
|
||||
@@ -18,6 +18,7 @@ package com.android.server.location.gnss;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.net.TrafficStats;
|
||||
+import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.android.internal.util.TrafficStatsConstants;
|
||||
@@ -53,20 +54,39 @@ class GnssPsdsDownloader {
|
||||
private static final int REALTIME_PSDS_SERVER_INDEX = 3;
|
||||
private static final int MAX_PSDS_TYPE_INDEX = 3;
|
||||
|
||||
+ // Broadcom GNSS almanac server URLs
|
||||
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_1 = "https://gllto.glpals.com/7day/v5/latest/lto2.dat";
|
||||
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_2 = null;
|
||||
+ private static final String BROADCOM_LONGTERM_PSDS_SERVER_3 = null;
|
||||
+ private static final String BROADCOM_NORMAL_PSDS_SERVER = "https://gllto.glpals.com/rto/v1/latest/rto.dat";
|
||||
+ private static final String BROADCOM_REALTIME_PSDS_SERVER = "https://gllto.glpals.com/rtistatus4.dat";
|
||||
+
|
||||
private final String[] mLongTermPsdsServers;
|
||||
private final String[] mPsdsServers;
|
||||
// to load balance our server requests
|
||||
private int mNextServerIndex;
|
||||
|
||||
+ private static boolean shouldUseBroadcomServer() {
|
||||
+ boolean supportedDevice = Build.DEVICE.equals("cheetah") || Build.DEVICE.equals("panther") || Build.DEVICE.equals("raven") || Build.DEVICE.equals("oriole") || Build.DEVICE.equals("bluejay") || Build.DEVICE.equals("lynx") || Build.DEVICE.equals("tangorpro") || Build.DEVICE.equals("felix");
|
||||
+ return supportedDevice;
|
||||
+ }
|
||||
+
|
||||
GnssPsdsDownloader(Properties properties) {
|
||||
// read PSDS servers from the Properties object
|
||||
int count = 0;
|
||||
- String longTermPsdsServer1 = properties.getProperty(
|
||||
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_1);
|
||||
- String longTermPsdsServer2 = properties.getProperty(
|
||||
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_2);
|
||||
- String longTermPsdsServer3 = properties.getProperty(
|
||||
- GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_3);
|
||||
+ String longTermPsdsServer1;
|
||||
+ String longTermPsdsServer2;
|
||||
+ String longTermPsdsServer3;
|
||||
+
|
||||
+ if (shouldUseBroadcomServer()) {
|
||||
+ longTermPsdsServer1 = BROADCOM_LONGTERM_PSDS_SERVER_1;
|
||||
+ longTermPsdsServer2 = BROADCOM_LONGTERM_PSDS_SERVER_2;
|
||||
+ longTermPsdsServer3 = BROADCOM_LONGTERM_PSDS_SERVER_3;
|
||||
+ } else {
|
||||
+ longTermPsdsServer1 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_1);
|
||||
+ longTermPsdsServer2 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_2);
|
||||
+ longTermPsdsServer3 = properties.getProperty(GnssConfiguration.CONFIG_LONGTERM_PSDS_SERVER_3);
|
||||
+ }
|
||||
if (longTermPsdsServer1 != null) count++;
|
||||
if (longTermPsdsServer2 != null) count++;
|
||||
if (longTermPsdsServer3 != null) count++;
|
||||
@@ -86,10 +106,15 @@ class GnssPsdsDownloader {
|
||||
mNextServerIndex = random.nextInt(count);
|
||||
}
|
||||
|
||||
- String normalPsdsServer = properties.getProperty(
|
||||
- GnssConfiguration.CONFIG_NORMAL_PSDS_SERVER);
|
||||
- String realtimePsdsServer = properties.getProperty(
|
||||
- GnssConfiguration.CONFIG_REALTIME_PSDS_SERVER);
|
||||
+ String normalPsdsServer;
|
||||
+ String realtimePsdsServer;
|
||||
+ if (shouldUseBroadcomServer()) {
|
||||
+ normalPsdsServer = BROADCOM_NORMAL_PSDS_SERVER;
|
||||
+ realtimePsdsServer = BROADCOM_REALTIME_PSDS_SERVER;
|
||||
+ } else {
|
||||
+ normalPsdsServer = properties.getProperty(GnssConfiguration.CONFIG_NORMAL_PSDS_SERVER);
|
||||
+ realtimePsdsServer = properties.getProperty(GnssConfiguration.CONFIG_REALTIME_PSDS_SERVER);
|
||||
+ }
|
||||
mPsdsServers = new String[MAX_PSDS_TYPE_INDEX + 1];
|
||||
mPsdsServers[NORMAL_PSDS_SERVER_INDEX] = normalPsdsServer;
|
||||
mPsdsServers[REALTIME_PSDS_SERVER_INDEX] = realtimePsdsServer;
|
@ -0,0 +1,62 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Fri, 6 Jan 2023 17:20:46 +0200
|
||||
Subject: [PATCH] Revert "Null safe package name in AppOps writeState"
|
||||
|
||||
This reverts commit 0b925d4f46ef9d0f25fa5fd56e996280e9a98c71.
|
||||
|
||||
Reverted commit introduced a bug:
|
||||
it skipped the "pkg" tag for ops with null package name.
|
||||
This meant that ops with null package name were serialized differently than ops with non-null
|
||||
package name.
|
||||
Tag hierarchy became the following:
|
||||
for non-null package name ops: "pkg" -> "uid" -> "op" -> "st"
|
||||
for null package name ops: "uid" -> "op" -> "st"
|
||||
|
||||
Uid ops have the same first two tags as null package name ops started to have:
|
||||
"uid" -> "op". (refer to the loop over uidStatesClone elements above).
|
||||
|
||||
This led to type confusion during deserialization that happens in readState():
|
||||
null package name ops were deserialized as uid ops, through readUidOps() instead of through
|
||||
readPackage().
|
||||
|
||||
Uid ops are serialized differently than uid element inside package ops, specifically the latter
|
||||
skips the op mode ("m") attribute when the op mode is at its default value.
|
||||
|
||||
Op mode attribute is read unconditionally in readUidOps(), which led to
|
||||
XmlPullParserException: Missing attribute "m"
|
||||
exception.
|
||||
|
||||
This exception is caught in readState(), and is handled by discarding all deserialized state,
|
||||
which meant that all appops got reset to their default values.
|
||||
|
||||
Subsequent commit adds skipping of ops with null package name during serialization:
|
||||
they are invalid, package name is defined and treated as @NonNull in multiple places.
|
||||
Such ops are being constructed due to another bug.
|
||||
---
|
||||
.../core/java/com/android/server/appop/AppOpsService.java | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
index 8e8b9956f3cc..4040e7d31a3c 100644
|
||||
--- a/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
@@ -4715,15 +4715,13 @@ public class AppOpsService extends IAppOpsService.Stub {
|
||||
String lastPkg = null;
|
||||
for (int i=0; i<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
- if (!Objects.equals(pkg.getPackageName(), lastPkg)) {
|
||||
+ if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
||||
}
|
||||
lastPkg = pkg.getPackageName();
|
||||
- if (lastPkg != null) {
|
||||
- out.startTag(null, "pkg");
|
||||
- out.attribute(null, "n", lastPkg);
|
||||
- }
|
||||
+ out.startTag(null, "pkg");
|
||||
+ out.attribute(null, "n", lastPkg);
|
||||
}
|
||||
out.startTag(null, "uid");
|
||||
out.attributeInt(null, "n", pkg.getUid());
|
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Fri, 6 Jan 2023 17:22:29 +0200
|
||||
Subject: [PATCH] appops: skip ops for invalid null package during state
|
||||
serialization
|
||||
|
||||
There's a bug that leads to construction of ops for invalid null package name.
|
||||
Package name should always be non-null, it's defined and treated as such in AppOpsService.
|
||||
It being null leads to crashes in system_server when appops state is serialized.
|
||||
|
||||
Previous commit reverted a buggy workaround for this bug, add a new workaround to prevent these
|
||||
crashes.
|
||||
---
|
||||
services/core/java/com/android/server/appop/AppOpsService.java | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/appop/AppOpsService.java b/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
index 4040e7d31a3c..ed36f9bf6f8a 100644
|
||||
--- a/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
+++ b/services/core/java/com/android/server/appop/AppOpsService.java
|
||||
@@ -4715,6 +4715,9 @@ public class AppOpsService extends IAppOpsService.Stub {
|
||||
String lastPkg = null;
|
||||
for (int i=0; i<allOps.size(); i++) {
|
||||
AppOpsManager.PackageOps pkg = allOps.get(i);
|
||||
+ if (pkg.getPackageName() == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
if (!pkg.getPackageName().equals(lastPkg)) {
|
||||
if (lastPkg != null) {
|
||||
out.endTag(null, "pkg");
|
@ -0,0 +1,89 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Oliver Scott <olivercscott@gmail.com>
|
||||
Date: Thu, 5 Jan 2023 19:42:40 -0500
|
||||
Subject: [PATCH] Always add Briar and Tor Browser to Orbot's lockdown
|
||||
allowlist
|
||||
|
||||
[tad@spotco.us]: fixup arraylist handling, add logging, ignore missing package
|
||||
lockdownAllowlist can be either null or immutable, the latter case wasn't handled
|
||||
|
||||
Change-Id: I62c2553c8877b946d7e7e1ca4ef113f963d3f8eb
|
||||
---
|
||||
.../com/android/server/connectivity/Vpn.java | 40 +++++++++++++++++++
|
||||
1 file changed, 40 insertions(+)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
|
||||
index c5170585a1b3..f430b7b7c7a1 100644
|
||||
--- a/services/core/java/com/android/server/connectivity/Vpn.java
|
||||
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
|
||||
@@ -50,9 +50,11 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
+import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.content.pm.ResolveInfo;
|
||||
+import android.content.pm.Signature;
|
||||
import android.content.pm.UserInfo;
|
||||
import android.net.ConnectivityDiagnosticsManager;
|
||||
import android.net.ConnectivityManager;
|
||||
@@ -133,6 +135,7 @@ import android.util.ArraySet;
|
||||
import android.util.IndentingPrintWriter;
|
||||
import android.util.LocalLog;
|
||||
import android.util.Log;
|
||||
+import android.util.Pair;
|
||||
import android.util.Range;
|
||||
import android.util.SparseArray;
|
||||
|
||||
@@ -155,6 +158,7 @@ import com.android.server.vcn.util.PersistableBundleUtils;
|
||||
|
||||
import libcore.io.IoUtils;
|
||||
|
||||
+import java.io.ByteArrayOutputStream;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.net.Inet4Address;
|
||||
@@ -979,6 +983,42 @@ public class Vpn {
|
||||
return false;
|
||||
}
|
||||
|
||||
+ final String ORBOT_PACKAGE_NAME = "org.torproject.android";
|
||||
+ if (ORBOT_PACKAGE_NAME.equals(packageName)) {
|
||||
+ if (lockdownAllowlist == null) {
|
||||
+ lockdownAllowlist = new ArrayList<>();
|
||||
+ Log.i(TAG, "lockdown allowlist was null, created");
|
||||
+ } else {
|
||||
+ lockdownAllowlist = new ArrayList<>(lockdownAllowlist);
|
||||
+ Log.i(TAG, "lockdown allowlist existed, recreated");
|
||||
+ }
|
||||
+ final Set<Pair<String, String>> ORBOT_LOCKDOWN_ALLOWLIST = Set.of(
|
||||
+ new Pair<>("org.torproject.torbrowser", "308205953082037DA003020102020900BA2DF613084D2BFD300D06092A864886F70D01010B0500305C3114301206035504030C0B546F722042726F7773657231183016060355040A0C0F54686520546F722050726F6A6563743110300E06035504070C0753656174746C65310B300906035504080C025741310B3009060355040613025553301E170D3139303531383231353834325A170D3334303531343231353834325A305C3114301206035504030C0B546F722042726F7773657231183016060355040A0C0F54686520546F722050726F6A6563743110300E06035504070C0753656174746C65310B300906035504080C025741310B300906035504061302555330820222300D06092A864886F70D01010105000382020F003082020A0282020100F3EE231D69CE435F324AD4AA398AEF3131876AE74563428B61F6AD8C65C522FDDF6EDCC24F6E615AD978598F8C595C632F2D51DF8225EC26742AF7479D8B45EEA379AC7C21E8665BDFB2AC8F0008C0B47A2BA89CAA39C581C0827D35599DA3D6E0FD4045DD4EBDEEDE39790BE6DD630B6BA7908BEB39E20EAA9C42DBCC5BB7B4F7A43F0E2F9DD91E076E2C7CDCC2F8F9B626628F366831EB917D2E54DEF859DF042084460AADCB1D53FF8114F8D666494992B260AF2B7F4CDD80B7733296B79E8831CBC8BA54B028CF3202DFDA84855540567C62AED813F32BAEE137CE3FC149A109B0A36E32FCB28A2A8D2E7C2F67D9B189FFD2E53FFF8EDDADE9D05D3E33560E73ECBF1F8C582077272AE7B5E9D16E0376A0AB39606B2089E78CBC4A37DA4D85F5965DB420CB6D77717348A21B49358F0C34742DA74B69F6746A2988EB815E2910A7F492F52E14DCC17414BE735594E6B6AD62BF0A701D3A3DD27457050101E568CF32536A4E7FD069908BACCF2197BB9C4C2585446DF2BDA23C4EDDA671CF1A881803959951071F8D03AC8DFF38AB00ABF88C87CD3783815032F9288169194EAD8EA0A28A518CD8EC0A0CD5C60800DE1683A0436B09A026524ABEDFF94E0D7AC6EF3E06F8865C780BC1818C64134389FF30D4331053EA2591D65808215C6878D1FB3E4FE7627B926FB9C1031A778F6FFE87BBFE35141B36F271B05075E75F0203010001A35A305830090603551D1304023000300B0603551D0F040403020780301D0603551D0E041604146D96FBE7BED0BD62CBB0C2607B6EDA93EDB69455301F0603551D230418301680146D96FBE7BED0BD62CBB0C2607B6EDA93EDB69455300D06092A864886F70D01010B0500038202010027C7E940533A854AEFCE955438A5344BD366CD2DD8C24E8DDC990D31D3AD5C5331EABCB2F01ED5517A19CC5AD5439DD8193F94D5474D76131762647DAE91EDB59EE90A84CEC2DFC61DDAEB12B88BCC58ED6736AA650AE0DB72372BC70E2651029D240D8993A18482B88881920FD50E023F7FFDE705B723CEB6F5E6AFA969A96B1C9531C9443694BFE504610E208C852E7C0B2CCD063E39DD5CCA83B3E901B1A3372DA55E4C854607D4C35673348A511B5929B825BF058F8BD3ABA2961C4C273AA124D24144D9A24961A6135B3BB8CDE2290A54271BECE02E0CBAF6ABD4AF13FF1D7C4A5192CF577A1DE47A51030308940F900BFBACACAB85F0D08B0606364415070CF851E630C8516656E8324B86DAACF482D571C1FD3865264E091D189D07171695E424E78FE91ABD25A993B6014C5A97647CC963C2A2602632299C471C8E29312592CDBC84E6DD275E8F008651192F197B969701A276DAF0672FCD3B5D734328D53B910F0931FA11A176EC00EAB73C813F30C33BF4E2E347F15BFD30701FBB0353410F991AE2C5B4492E51E0C439F517F4F34791D4CED1A362F3D1FB47AD3EDE2B41C1D038A2DD79B2AB344B2F1C7BEF3E339BA6DCED49461EF7DF58B18090FC1A50DFA3F6F058F561B2C909F61F0FBB351B79ABFFD7553D14B568284A863B5CD373F0F69C23DB81456F3F2F9DCEADDE55670E9D04D870E5A06BEC2BCAEE5D"),
|
||||
+ new Pair<>("org.briarproject.briar.android", "308202D5308201BDA00302010202040B7BA025300D06092A864886F70D01010B0500301B31193017060355040A1310627269617270726F6A6563742E6F7267301E170D3138303432353135323735365A170D3435303931303135323735365A301B31193017060355040A1310627269617270726F6A6563742E6F726730820122300D06092A864886F70D01010105000382010F003082010A0282010100887D49815638C3E01B08FA5CD80A62FE2640DAB155E848EBC0CF18ABD61618CE1B17632143D612D3AF282DC6B477E43286E5CD559E0DEB5AE951532A1347E95C2A9BC064FBE06E21528A0DDD3AB734679FEF9E31A49042694BF8C4E2DA66F820F6D2BF1F9D5180C409152F80FFD5EAB39B5423F8F09127A8B89D92B0F588284F783356B8812FC35893A526671573B8DDC3A85BAB46DC60DEA13351A2091728C037F20929DD668E757E905F98CC31D7B8B95E9E5D103A33320C71282CD0C797961C99B65CD33F478551FB28F51D5D2A3D636897AC87C1EB5D25323831526424014719136A7104BF8B60A6A30882C526056FB7D5372EA79371CAEAC7C92BC14B050203010001A321301F301D0603551D0E04160414E76D3580725F8DBD28912FF4DF18375F60B49211300D06092A864886F70D01010B050003820101002BAAA21FDF7301562EC3597705B4989B77114428619E84A8288032DB95251CFBB938DDE28BEACBFC63C6A52DE1520973EF19E8355534732139C374B320BEF56E8EF2CA2129307C589D99912317F57CA8639427B7B20225DAB64D12112B57510081A3E6B33EBEE96CAC80E13CDBC73C41BD1F4E0125B6376B95A71411223C15DD8AA1A5734029713097C27073EBCC325688991EF3A46D4CD03E48FD46749937F641C618B783AC7FF0D428E0443EBE36A3D23D82014EA95758344EBFA2A041253CEB7EE6B687857956EE69840E0DA71A6529D33F3674C78C3BAFFBD9724858EA82CB651B58D4D8A0607E763BD0F37D145C3EE705F7D41322AA1A00D5A36F1275EA")
|
||||
+ );
|
||||
+ for (Pair<String, String> pair : ORBOT_LOCKDOWN_ALLOWLIST) {
|
||||
+ try {
|
||||
+ PackageInfo packageInfo = mUserIdContext.getPackageManager()
|
||||
+ .getPackageInfo(pair.first, PackageManager.PackageInfoFlags.of(
|
||||
+ PackageManager.GET_SIGNING_CERTIFICATES));
|
||||
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
+ for (Signature signature : packageInfo.signingInfo.getApkContentsSigners()) {
|
||||
+ outputStream.write(signature.toByteArray());
|
||||
+ }
|
||||
+ if (Signature.areEffectiveMatch(new Signature(outputStream.toByteArray()), new Signature(pair.second))) {
|
||||
+ if (!lockdownAllowlist.contains(pair.first)) {
|
||||
+ lockdownAllowlist.add(pair.first);
|
||||
+ Log.i(TAG, "Added " + pair.first + " to lockdown allowlist");
|
||||
+ }
|
||||
+ } else {
|
||||
+ Log.w(TAG, "Not adding " + pair.first + " to lockdown allowlist due to signature mismatch");
|
||||
+ }
|
||||
+ } catch (NameNotFoundException ignore) { } catch (Exception e) {
|
||||
+ Log.w(TAG, "Failed to add " + pair.first + " to lockdown allowlist", e);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if (lockdownAllowlist != null) {
|
||||
for (String pkg : lockdownAllowlist) {
|
||||
if (pkg.contains(",")) {
|
@ -0,0 +1,30 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Renlord <me@renlord.com>
|
||||
Date: Tue, 30 Jun 2020 11:52:43 +1000
|
||||
Subject: [PATCH] dont ping server when nitz time update is toggled off
|
||||
|
||||
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
|
||||
---
|
||||
core/java/android/util/NtpTrustedTime.java | 9 +++++++++
|
||||
1 file changed, 9 insertions(+)
|
||||
|
||||
diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java
|
||||
index 3adbd686cd2c..6221541473d3 100644
|
||||
--- a/core/java/android/util/NtpTrustedTime.java
|
||||
+++ b/core/java/android/util/NtpTrustedTime.java
|
||||
@@ -272,6 +272,15 @@ public abstract class NtpTrustedTime implements TrustedTime {
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public boolean forceRefresh() {
|
||||
synchronized (mRefreshLock) {
|
||||
+ final ContentResolver resolver = mContext.getContentResolver();
|
||||
+
|
||||
+ final boolean networkPollTime = Settings.Global.getInt(resolver,
|
||||
+ Settings.Global.AUTO_TIME, 1) != 0;
|
||||
+ if (!networkPollTime) {
|
||||
+ Log.d(TAG, "forceRefresh: nitzTimeUpdate disabled bailing early");
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
Network network = getDefaultNetwork();
|
||||
if (network == null) {
|
||||
if (LOGD) Log.d(TAG, "forceRefresh: no network available");
|
@ -0,0 +1,129 @@
|
||||
From 51fe11d1639de60bafebc32e6b77428eb0b2628e Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Thu, 7 Jul 2022 09:28:40 +0300
|
||||
Subject: [PATCH] DeviceIdleJobsController: don't ignore whitelisted system
|
||||
apps
|
||||
|
||||
Only user app IDs were written to `mDeviceIdleWhitelistAppIds`, both initially and when
|
||||
`PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED` broadcast was received. All other places that
|
||||
listen to that broadcast retrieve both user and system app IDs.
|
||||
|
||||
The only place where `mDeviceIdleWhitelistAppIds` array is checked is in `isWhitelistedLocked()`,
|
||||
which is called only by `updateTaskStateLocked()` to check whether the app is on the device idle whitelist.
|
||||
|
||||
It's not clear why DeviceIdleJobsController ignores system apps.
|
||||
File level comment doesn't mention the distinction between system and user apps:
|
||||
"When device is dozing, set constraint for all jobs, except whitelisted apps, as not satisfied."
|
||||
Comment for isWhitelistedLocked() does, however:
|
||||
"Checks if the given job's scheduling app id exists in the device idle user whitelist."
|
||||
However, that method is called for both system and user apps, and returns false for system apps
|
||||
because only whitelist of user apps is checked. This leads to long delays for jobs that were
|
||||
submitted by whitelisted system apps when device is in the Doze mode. No such delays happen with
|
||||
whitelisted user apps.
|
||||
|
||||
Other places use a different naming for array of app IDs that includes only user apps,
|
||||
eg `mDeviceIdleWhitelistUserAppIds`, not `mDeviceIdleWhitelistAppIds`.
|
||||
|
||||
I've looked through the Git history of DeviceIdleJobsController and JobSchedulerService, but didn't
|
||||
find a reason for this behavior. Perhaps, system apps were exempted from device idle JobScheduler
|
||||
restricitions in some other place previously, or this was a bug from the start.
|
||||
|
||||
Tested on an emulator with the Messaging app, which uses JobScheduler
|
||||
during processing of incoming SMS:
|
||||
1. Check that Messaging app is on system deviceidle whitelist:
|
||||
```
|
||||
$ dumpsys deviceidle whitelist | grep com.android.messaging
|
||||
system-excidle,com.android.messaging,10090
|
||||
system,com.android.messaging,10090
|
||||
```
|
||||
2. Simulate sending an SMS: it appears immediately
|
||||
3. Simulate Doze mode: `$ dumpsys deviceidle force-idle`
|
||||
4. Simulate sending an SMS again. Message doesn't appear, even if the Messaging app is open
|
||||
5. Exit Doze mode: `$ dumpsys deviceidle unforce`. All pending messages appear immediately
|
||||
6. Add Messaging app to the user whitelist:
|
||||
```
|
||||
$ dumpsys deviceidle whitelist +com.android.messaging
|
||||
$ dumpsys deviceidle whitelist | grep com.android.messaging
|
||||
system-excidle,com.android.messaging,10090
|
||||
system,com.android.messaging,10090
|
||||
user,com.android.messaging,10090
|
||||
```
|
||||
7. Simulate Doze mode again: `$ dumpsys deviceidle force-idle`
|
||||
8. Simulate sending an SMS, note that it appears immediately this time
|
||||
|
||||
Also made a test system app to make sure that this issue isn't caused by low targetSdk of the
|
||||
Messaging app (it targets SDK 24). Same issue with targetSdk 32 app.
|
||||
|
||||
In both cases, applying this patch fixes the issue.
|
||||
---
|
||||
.../java/com/android/server/DeviceIdleInternal.java | 2 +-
|
||||
.../java/com/android/server/DeviceIdleController.java | 6 +++---
|
||||
.../server/job/controllers/DeviceIdleJobsController.java | 6 +++---
|
||||
3 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java b/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
|
||||
index caf7e7f4a4ed..1b1d2252dae1 100644
|
||||
--- a/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
|
||||
+++ b/apex/jobscheduler/framework/java/com/android/server/DeviceIdleInternal.java
|
||||
@@ -73,7 +73,7 @@ void addPowerSaveTempWhitelistAppDirect(int uid, long duration,
|
||||
|
||||
boolean isAppOnWhitelist(int appid);
|
||||
|
||||
- int[] getPowerSaveWhitelistUserAppIds();
|
||||
+ int[] getPowerSaveWhitelistAppIds();
|
||||
|
||||
int[] getPowerSaveTempWhitelistAppIds();
|
||||
|
||||
diff --git a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
|
||||
index 6383ed873e59..f5289001cc32 100644
|
||||
--- a/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
|
||||
+++ b/apex/jobscheduler/service/java/com/android/server/DeviceIdleController.java
|
||||
@@ -2375,14 +2375,14 @@ public boolean isAppOnWhitelist(int appid) {
|
||||
}
|
||||
|
||||
/**
|
||||
- * Returns the array of app ids whitelisted by user. Take care not to
|
||||
+ * Returns the array of whitelisted app ids. Take care not to
|
||||
* modify this, as it is a reference to the original copy. But the reference
|
||||
* can change when the list changes, so it needs to be re-acquired when
|
||||
* {@link PowerManager#ACTION_POWER_SAVE_WHITELIST_CHANGED} is sent.
|
||||
*/
|
||||
@Override
|
||||
- public int[] getPowerSaveWhitelistUserAppIds() {
|
||||
- return DeviceIdleController.this.getPowerSaveWhitelistUserAppIds();
|
||||
+ public int[] getPowerSaveWhitelistAppIds() {
|
||||
+ return DeviceIdleController.this.getAppIdWhitelistInternal();
|
||||
}
|
||||
|
||||
@Override
|
||||
diff --git a/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java b/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
|
||||
index d5c9ae615486..9e3ebb9cf6bc 100644
|
||||
--- a/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
|
||||
+++ b/apex/jobscheduler/service/java/com/android/server/job/controllers/DeviceIdleJobsController.java
|
||||
@@ -90,7 +90,7 @@ public void onReceive(Context context, Intent intent) {
|
||||
case PowerManager.ACTION_POWER_SAVE_WHITELIST_CHANGED:
|
||||
synchronized (mLock) {
|
||||
mDeviceIdleWhitelistAppIds =
|
||||
- mLocalDeviceIdleController.getPowerSaveWhitelistUserAppIds();
|
||||
+ mLocalDeviceIdleController.getPowerSaveWhitelistAppIds();
|
||||
if (DEBUG) {
|
||||
Slog.d(TAG, "Got whitelist "
|
||||
+ Arrays.toString(mDeviceIdleWhitelistAppIds));
|
||||
@@ -133,7 +133,7 @@ public DeviceIdleJobsController(JobSchedulerService service) {
|
||||
mPowerManager = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
|
||||
mLocalDeviceIdleController =
|
||||
LocalServices.getService(DeviceIdleInternal.class);
|
||||
- mDeviceIdleWhitelistAppIds = mLocalDeviceIdleController.getPowerSaveWhitelistUserAppIds();
|
||||
+ mDeviceIdleWhitelistAppIds = mLocalDeviceIdleController.getPowerSaveWhitelistAppIds();
|
||||
mPowerSaveTempWhitelistAppIds =
|
||||
mLocalDeviceIdleController.getPowerSaveTempWhitelistAppIds();
|
||||
mDeviceIdleUpdateFunctor = new DeviceIdleUpdateFunctor();
|
||||
@@ -194,7 +194,7 @@ public void setUidActiveLocked(int uid, boolean active) {
|
||||
}
|
||||
|
||||
/**
|
||||
- * Checks if the given job's scheduling app id exists in the device idle user whitelist.
|
||||
+ * Checks if the given job's scheduling app id exists in the device idle whitelist.
|
||||
*/
|
||||
boolean isWhitelistedLocked(JobStatus job) {
|
||||
return Arrays.binarySearch(mDeviceIdleWhitelistAppIds,
|
@ -0,0 +1,26 @@
|
||||
From ff9f020cf0b63d68ac6377c16bef1697eb7bad9a Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Sun, 19 Mar 2023 17:57:26 +0200
|
||||
Subject: [PATCH] do not auto-grant Camera permission to the eUICC LPA UI app
|
||||
|
||||
Google's LPA that is shipped on GrapheneOS handles requesting the Camera permission at runtime,
|
||||
which allows the user to give it a one-time grant.
|
||||
|
||||
13: 7bb7df2d2b13
|
||||
---
|
||||
.../server/pm/permission/DefaultPermissionGrantPolicy.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
index 7f786dbdc60b..674a19d35b2b 100644
|
||||
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
|
||||
@@ -1097,7 +1097,7 @@ public void revokeDefaultPermissionsFromDisabledTelephonyDataServices(
|
||||
public void grantDefaultPermissionsToActiveLuiApp(String packageName, int userId) {
|
||||
Log.i(TAG, "Granting permissions to active LUI app for user:" + userId);
|
||||
grantSystemFixedPermissionsToSystemPackage(NO_PM_CACHE, packageName, userId,
|
||||
- CAMERA_PERMISSIONS, NOTIFICATION_PERMISSIONS);
|
||||
+ NOTIFICATION_PERMISSIONS);
|
||||
}
|
||||
|
||||
public void revokeDefaultPermissionsFromLuiApps(String[] packageNames, int userId) {
|
@ -0,0 +1,153 @@
|
||||
From e289ce2b276805111724881c242eb0eba058caa1 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 11 Mar 2024 19:40:18 +0200
|
||||
Subject: [PATCH] SystemUI: require unlocking to use QS tiles by default
|
||||
|
||||
---
|
||||
.../src/com/android/systemui/qs/QSHost.java | 1 +
|
||||
.../com/android/systemui/qs/QSHostAdapter.kt | 2 ++
|
||||
.../com/android/systemui/qs/QSTileHost.java | 9 +++++
|
||||
.../systemui/qs/tileimpl/QSTileImpl.java | 36 +++++++++++++++++--
|
||||
4 files changed, 45 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSHost.java
|
||||
index 1ab64b76b0dc..69fb741550bd 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/QSHost.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSHost.java
|
||||
@@ -55,6 +55,7 @@ static List<String> getDefaultSpecs(Resources res) {
|
||||
Context getUserContext();
|
||||
int getUserId();
|
||||
Collection<QSTile> getTiles();
|
||||
+ com.android.systemui.statusbar.policy.KeyguardStateController getKeyguardStateController();
|
||||
void addCallback(Callback callback);
|
||||
void removeCallback(Callback callback);
|
||||
void removeTile(String tileSpec);
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt b/packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt
|
||||
index c77233eb1737..32c6ffd86a64 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSHostAdapter.kt
|
||||
@@ -78,6 +78,8 @@ constructor(
|
||||
}
|
||||
}
|
||||
|
||||
+ override fun getKeyguardStateController() = qsTileHost.keyguardStateController
|
||||
+
|
||||
override fun getSpecs(): List<String> {
|
||||
return if (useNewHost) {
|
||||
interactor.currentTilesSpecs.map { it.spec }
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
|
||||
index 828d6ed6ab89..0038fe7da7f4 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSTileHost.java
|
||||
@@ -53,6 +53,7 @@
|
||||
import com.android.systemui.settings.UserTracker;
|
||||
import com.android.systemui.shade.ShadeController;
|
||||
import com.android.systemui.statusbar.phone.AutoTileManager;
|
||||
+import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
import com.android.systemui.tuner.TunerService;
|
||||
import com.android.systemui.tuner.TunerService.Tunable;
|
||||
import com.android.systemui.util.settings.SecureSettings;
|
||||
@@ -94,6 +95,7 @@ public class QSTileHost implements QSHost, Tunable, PluginListener<QSFactory>, P
|
||||
static final String TILES = "tiles_prefs";
|
||||
|
||||
private final Context mContext;
|
||||
+ private final KeyguardStateController mKeyguardStateController;
|
||||
private final LinkedHashMap<String, QSTile> mTiles = new LinkedHashMap<>();
|
||||
private final ArrayList<String> mTileSpecs = new ArrayList<>();
|
||||
private final TunerService mTunerService;
|
||||
@@ -127,6 +129,7 @@ public QSTileHost(Context context,
|
||||
Lazy<NewQSTileFactory> newQsTileFactoryProvider,
|
||||
QSFactory defaultFactory,
|
||||
@Main Executor mainExecutor,
|
||||
+ KeyguardStateController keyguardStateController,
|
||||
PluginManager pluginManager,
|
||||
TunerService tunerService,
|
||||
Provider<AutoTileManager> autoTiles,
|
||||
@@ -140,6 +143,7 @@ public QSTileHost(Context context,
|
||||
QSPipelineFlagsRepository featureFlags
|
||||
) {
|
||||
mContext = context;
|
||||
+ mKeyguardStateController = keyguardStateController;
|
||||
mUserContext = context;
|
||||
mTunerService = tunerService;
|
||||
mPluginManager = pluginManager;
|
||||
@@ -209,6 +213,11 @@ public void removeCallback(Callback callback) {
|
||||
mCallbacks.remove(callback);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public KeyguardStateController getKeyguardStateController() {
|
||||
+ return mKeyguardStateController;
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public Collection<QSTile> getTiles() {
|
||||
return mTiles.values();
|
||||
diff --git a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
|
||||
index 529d68407ce9..5cb51840bb52 100644
|
||||
--- a/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
|
||||
+++ b/packages/SystemUI/src/com/android/systemui/qs/tileimpl/QSTileImpl.java
|
||||
@@ -68,6 +68,7 @@
|
||||
import com.android.systemui.qs.QsEventLogger;
|
||||
import com.android.systemui.qs.SideLabelTileLayout;
|
||||
import com.android.systemui.qs.logging.QSLogger;
|
||||
+import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
@@ -269,6 +270,32 @@ public boolean isAvailable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
+ public enum Action {
|
||||
+ CLICK,
|
||||
+ SECONDARY_CLICK,
|
||||
+ LONG_CLICK,
|
||||
+ }
|
||||
+
|
||||
+ public boolean isAllowedWhenLocked(Action action) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ void handleAction(Action action, Runnable handler) {
|
||||
+ if (isAllowedWhenLocked(action)) {
|
||||
+ handler.run();
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ KeyguardStateController ksc = mHost.getKeyguardStateController();
|
||||
+ boolean hasSecureKeyguard = ksc.isMethodSecure() && ksc.isShowing();
|
||||
+
|
||||
+ if (hasSecureKeyguard) {
|
||||
+ mActivityStarter.postQSRunnableDismissingKeyguard(handler);
|
||||
+ } else {
|
||||
+ handler.run();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
// safe to call from any thread
|
||||
|
||||
public void addCallback(Callback callback) {
|
||||
@@ -592,16 +619,19 @@ public void handleMessage(Message msg) {
|
||||
mActivityStarter.postStartActivityDismissingKeyguard(intent, 0);
|
||||
} else {
|
||||
mQSLogger.logHandleClick(mTileSpec, msg.arg1);
|
||||
- handleClick((View) msg.obj);
|
||||
+ View view = (View) msg.obj;
|
||||
+ handleAction(Action.CLICK, () -> handleClick(view));
|
||||
}
|
||||
} else if (msg.what == SECONDARY_CLICK) {
|
||||
name = "handleSecondaryClick";
|
||||
mQSLogger.logHandleSecondaryClick(mTileSpec, msg.arg1);
|
||||
- handleSecondaryClick((View) msg.obj);
|
||||
+ View view = (View) msg.obj;
|
||||
+ handleAction(Action.SECONDARY_CLICK, () -> handleSecondaryClick(view));
|
||||
} else if (msg.what == LONG_CLICK) {
|
||||
name = "handleLongClick";
|
||||
mQSLogger.logHandleLongClick(mTileSpec, msg.arg1);
|
||||
- handleLongClick((View) msg.obj);
|
||||
+ View view = (View) msg.obj;
|
||||
+ handleAction(Action.LONG_CLICK, () -> handleLongClick(view));
|
||||
} else if (msg.what == REFRESH_STATE) {
|
||||
name = "handleRefreshState";
|
||||
handleRefreshState(msg.obj);
|
@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Mon, 4 Jan 2021 19:56:14 -0500
|
||||
Subject: [PATCH] constify JNINativeMethod table
|
||||
|
||||
---
|
||||
framesequence/jni/FrameSequenceJNI.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/framesequence/jni/FrameSequenceJNI.cpp b/framesequence/jni/FrameSequenceJNI.cpp
|
||||
index c701f033..4041733d 100644
|
||||
--- a/framesequence/jni/FrameSequenceJNI.cpp
|
||||
+++ b/framesequence/jni/FrameSequenceJNI.cpp
|
||||
@@ -141,7 +141,7 @@ static jlong JNICALL nativeGetFrame(
|
||||
return delayMs;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{ "nativeDecodeByteArray",
|
||||
"([BII)L" JNI_PACKAGE "/FrameSequence;",
|
||||
(void*) nativeDecodeByteArray
|
@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Tue, 2 Nov 2021 14:44:13 -0400
|
||||
Subject: [PATCH] invalidate icon cache between OS releases
|
||||
|
||||
---
|
||||
.../src/com/android/launcher3/icons/cache/BaseIconCache.java | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
|
||||
index d6cd0f2..acb5d9f 100644
|
||||
--- a/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
|
||||
+++ b/iconloaderlib/src/com/android/launcher3/icons/cache/BaseIconCache.java
|
||||
@@ -273,7 +273,7 @@ public abstract class BaseIconCache {
|
||||
*/
|
||||
private void updateSystemState() {
|
||||
mLocaleList = mContext.getResources().getConfiguration().getLocales();
|
||||
- mSystemState = mLocaleList.toLanguageTags() + "," + Build.VERSION.SDK_INT;
|
||||
+ mSystemState = mLocaleList.toLanguageTags() + "," + Build.VERSION.INCREMENTAL;
|
||||
mUserFormatString.clear();
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sat, 7 Oct 2017 16:28:57 -0400
|
||||
Subject: [PATCH] require OTHER_SENSORS permission for sensors
|
||||
|
||||
Ported from 10: ff005a6b6a38baef95c4a01d7e1fc75aac651a58
|
||||
---
|
||||
libs/sensor/Sensor.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/libs/sensor/Sensor.cpp b/libs/sensor/Sensor.cpp
|
||||
index a1549ea385..526e59ccfe 100644
|
||||
--- a/libs/sensor/Sensor.cpp
|
||||
+++ b/libs/sensor/Sensor.cpp
|
||||
@@ -59,6 +59,7 @@ Sensor::Sensor(struct sensor_t const& hwSensor, const uuid_t& uuid, int halVersi
|
||||
mMinDelay = hwSensor.minDelay;
|
||||
mFlags = 0;
|
||||
mUuid = uuid;
|
||||
+ mRequiredPermission = "android.permission.OTHER_SENSORS";
|
||||
|
||||
// Set fifo event count zero for older devices which do not support batching. Fused
|
||||
// sensors also have their fifo counts set to zero.
|
@ -0,0 +1,54 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Sun, 24 Jul 2022 13:07:00 +0300
|
||||
Subject: [PATCH] protect step sensors with OTHER_SENSORS permission for
|
||||
targetSdk<29 apps
|
||||
|
||||
---
|
||||
services/sensorservice/SensorService.cpp | 24 +++++++++++++++---------
|
||||
1 file changed, 15 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
|
||||
index 85043c9038..fbf4facbc6 100644
|
||||
--- a/services/sensorservice/SensorService.cpp
|
||||
+++ b/services/sensorservice/SensorService.cpp
|
||||
@@ -2249,17 +2249,9 @@ bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,
|
||||
}
|
||||
|
||||
const int32_t opCode = sensor.getRequiredAppOp();
|
||||
- int targetSdkVersion = getTargetSdkVersion(opPackageName);
|
||||
|
||||
bool canAccess = false;
|
||||
- if (targetSdkVersion > 0 && targetSdkVersion <= __ANDROID_API_P__ &&
|
||||
- (sensor.getType() == SENSOR_TYPE_STEP_COUNTER ||
|
||||
- sensor.getType() == SENSOR_TYPE_STEP_DETECTOR)) {
|
||||
- // Allow access to step sensors if the application targets pre-Q, which is before the
|
||||
- // requirement to hold the AR permission to access Step Counter and Step Detector events
|
||||
- // was introduced.
|
||||
- canAccess = true;
|
||||
- } else if (hasPermissionForSensor(sensor)) {
|
||||
+ if (hasPermissionForSensor(sensor)) {
|
||||
// Ensure that the AppOp is allowed, or that there is no necessary app op for the sensor
|
||||
if (opCode >= 0) {
|
||||
const int32_t appOpMode = sAppOpsManager.checkOp(opCode,
|
||||
@@ -2268,6 +2260,20 @@ bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,
|
||||
} else {
|
||||
canAccess = true;
|
||||
}
|
||||
+ } else {
|
||||
+ int targetSdkVersion = getTargetSdkVersion(opPackageName);
|
||||
+ if (targetSdkVersion > 0 && targetSdkVersion <= __ANDROID_API_P__ &&
|
||||
+ (sensor.getType() == SENSOR_TYPE_STEP_COUNTER ||
|
||||
+ sensor.getType() == SENSOR_TYPE_STEP_DETECTOR)) {
|
||||
+
|
||||
+ // upstream allows access to these sensors without the ACTIVITY_RECOGNITION permission
|
||||
+ // for targetSdk < 29 apps, enforce the OTHER_SENSORS permission instead
|
||||
+ const String16 requiredPermission("android.permission.OTHER_SENSORS");
|
||||
+
|
||||
+ // copied from hasPermissionForSensor() below
|
||||
+ canAccess = checkPermission(requiredPermission,
|
||||
+ IPCThreadState::self()->getCallingPid(), IPCThreadState::self()->getCallingUid());
|
||||
+ }
|
||||
}
|
||||
|
||||
if (!canAccess) {
|
@ -0,0 +1,31 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 26 Dec 2023 21:59:58 +0200
|
||||
Subject: [PATCH] exempt system processes from OTHER_SENSORS permission
|
||||
enforcement
|
||||
|
||||
---
|
||||
services/sensorservice/SensorService.cpp | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
|
||||
index fbf4facbc6..e454033675 100644
|
||||
--- a/services/sensorservice/SensorService.cpp
|
||||
+++ b/services/sensorservice/SensorService.cpp
|
||||
@@ -2261,6 +2261,16 @@ bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation,
|
||||
canAccess = true;
|
||||
}
|
||||
} else {
|
||||
+ if (sensor.getRequiredPermission() == "android.permission.OTHER_SENSORS") {
|
||||
+ if (IPCThreadState::self()->getCallingUid() < AID_APP_START) {
|
||||
+ // System processes do not expect that sensors that are protected by OTHER_SENSORS
|
||||
+ // on GrapheneOS require a permission.
|
||||
+ //
|
||||
+ // The lack of this check led to crashes of the closed-source gpsd daemon.
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
int targetSdkVersion = getTargetSdkVersion(opPackageName);
|
||||
if (targetSdkVersion > 0 && targetSdkVersion <= __ANDROID_API_P__ &&
|
||||
(sensor.getType() == SENSOR_TYPE_STEP_COUNTER ||
|
@ -0,0 +1,55 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Tue, 14 Apr 2020 16:59:46 -0400
|
||||
Subject: [PATCH] Fix calling after VoLTE is removed from devices that had it
|
||||
previously enabled
|
||||
|
||||
Change-Id: Id5e3b8f7793d0783104b8b59581688c8ef821396
|
||||
---
|
||||
src/java/com/android/ims/ImsManager.java | 26 +-----------------------
|
||||
1 file changed, 1 insertion(+), 25 deletions(-)
|
||||
|
||||
diff --git a/src/java/com/android/ims/ImsManager.java b/src/java/com/android/ims/ImsManager.java
|
||||
index c9252f24..d822cf1d 100644
|
||||
--- a/src/java/com/android/ims/ImsManager.java
|
||||
+++ b/src/java/com/android/ims/ImsManager.java
|
||||
@@ -549,13 +549,6 @@ public class ImsManager implements FeatureUpdates {
|
||||
*/
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public static boolean isEnhanced4gLteModeSettingEnabledByUser(Context context) {
|
||||
- DefaultSubscriptionManagerProxy p = new DefaultSubscriptionManagerProxy(context);
|
||||
- ImsManager mgr = ImsManager.getInstance(context, p.getDefaultVoicePhoneId());
|
||||
- if (mgr != null) {
|
||||
- return mgr.isEnhanced4gLteModeSettingEnabledByUser();
|
||||
- }
|
||||
- Rlog.e(TAG, "isEnhanced4gLteModeSettingEnabledByUser: ImsManager null, returning default"
|
||||
- + " value.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -570,24 +563,7 @@ public class ImsManager implements FeatureUpdates {
|
||||
* return the default value.
|
||||
*/
|
||||
public boolean isEnhanced4gLteModeSettingEnabledByUser() {
|
||||
- int setting = mSubscriptionManagerProxy.getIntegerSubscriptionProperty(
|
||||
- getSubId(), SubscriptionManager.ENHANCED_4G_MODE_ENABLED,
|
||||
- SUB_PROPERTY_NOT_INITIALIZED);
|
||||
- boolean onByDefault = getBooleanCarrierConfig(
|
||||
- CarrierConfigManager.KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL);
|
||||
- boolean isUiUnEditable =
|
||||
- !getBooleanCarrierConfig(CarrierConfigManager.KEY_EDITABLE_ENHANCED_4G_LTE_BOOL)
|
||||
- || getBooleanCarrierConfig(CarrierConfigManager.KEY_HIDE_ENHANCED_4G_LTE_BOOL);
|
||||
- boolean isSettingNotInitialized = setting == SUB_PROPERTY_NOT_INITIALIZED;
|
||||
-
|
||||
- // If Enhanced 4G LTE Mode is uneditable, hidden, not initialized and VoIMS opt-in disabled
|
||||
- // we use the default value. If VoIMS opt-in is enabled, we will always allow the user to
|
||||
- // change the IMS enabled setting.
|
||||
- if ((isUiUnEditable || isSettingNotInitialized) && !isVoImsOptInEnabled()) {
|
||||
- return onByDefault;
|
||||
- } else {
|
||||
- return (setting == ProvisioningManager.PROVISIONING_VALUE_ENABLED);
|
||||
- }
|
||||
+ return false;
|
||||
}
|
||||
|
||||
/**
|
@ -0,0 +1,88 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: renlord <me@renlord.com>
|
||||
Date: Fri, 15 Oct 2021 19:11:18 +0530
|
||||
Subject: [PATCH] add support for always generating new random MAC
|
||||
|
||||
To trigger re-generation of randomized MAC addressed for an already
|
||||
connected AP. User simply has to toggle on/off wifi. Otherwise, on
|
||||
re-connection, a new randomized MAC address also gets generated.
|
||||
|
||||
based on https://github.com/GrapheneOS/platform_frameworks_opt_net_wifi/commit/a0d9bda06b71694f38fe02bbe24628ee21a7d270
|
||||
---
|
||||
.../wifitrackerlib/StandardWifiEntry.java | 32 ++++++++++++++-----
|
||||
.../com/android/wifitrackerlib/WifiEntry.java | 1 +
|
||||
2 files changed, 25 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
|
||||
index 246c7b36a..86e17c570 100644
|
||||
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
|
||||
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/StandardWifiEntry.java
|
||||
@@ -260,7 +260,7 @@ public class StandardWifiEntry extends WifiEntry {
|
||||
return wifiInfoMac;
|
||||
}
|
||||
}
|
||||
- if (mTargetWifiConfig == null || getPrivacy() != PRIVACY_RANDOMIZED_MAC) {
|
||||
+ if (mTargetWifiConfig == null || getPrivacy() == PRIVACY_DEVICE_MAC) {
|
||||
final String[] factoryMacs = mWifiManager.getFactoryMacAddresses();
|
||||
if (factoryMacs.length > 0) {
|
||||
return factoryMacs[0];
|
||||
@@ -553,12 +553,18 @@ public class StandardWifiEntry extends WifiEntry {
|
||||
@Override
|
||||
@Privacy
|
||||
public synchronized int getPrivacy() {
|
||||
- if (mTargetWifiConfig != null
|
||||
- && mTargetWifiConfig.macRandomizationSetting
|
||||
- == WifiConfiguration.RANDOMIZATION_NONE) {
|
||||
- return PRIVACY_DEVICE_MAC;
|
||||
+ if (mTargetWifiConfig != null) {
|
||||
+ switch (mTargetWifiConfig.macRandomizationSetting) {
|
||||
+ case WifiConfiguration.RANDOMIZATION_NONE:
|
||||
+ return PRIVACY_DEVICE_MAC;
|
||||
+ case WifiConfiguration.RANDOMIZATION_ALWAYS:
|
||||
+ return PRIVACY_RANDOMIZATION_ALWAYS;
|
||||
+ default:
|
||||
+ // WifiConfiguration.RANDOMIZATION_AUTO and WifiConfiguration.RANDOMIZATION_PERSISTENT
|
||||
+ return PRIVACY_RANDOMIZED_MAC;
|
||||
+ }
|
||||
} else {
|
||||
- return PRIVACY_RANDOMIZED_MAC;
|
||||
+ return PRIVACY_RANDOMIZATION_ALWAYS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,11 +576,21 @@ public class StandardWifiEntry extends WifiEntry {
|
||||
// Refresh the current config so we don't overwrite any changes that we haven't gotten
|
||||
// the CONFIGURED_NETWORKS_CHANGED broadcast for yet.
|
||||
refreshTargetWifiConfig();
|
||||
- mTargetWifiConfig.macRandomizationSetting = privacy == PRIVACY_RANDOMIZED_MAC
|
||||
- ? WifiConfiguration.RANDOMIZATION_AUTO : WifiConfiguration.RANDOMIZATION_NONE;
|
||||
+ mTargetWifiConfig.macRandomizationSetting = translatePrivacyToWifiConfigurationValues(privacy);
|
||||
mWifiManager.save(mTargetWifiConfig, null /* listener */);
|
||||
}
|
||||
|
||||
+ private static int translatePrivacyToWifiConfigurationValues(int privacyValue) {
|
||||
+ switch (privacyValue) {
|
||||
+ case PRIVACY_RANDOMIZED_MAC:
|
||||
+ return WifiConfiguration.RANDOMIZATION_PERSISTENT;
|
||||
+ case PRIVACY_DEVICE_MAC:
|
||||
+ return WifiConfiguration.RANDOMIZATION_NONE;
|
||||
+ default:
|
||||
+ return WifiConfiguration.RANDOMIZATION_ALWAYS;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@Override
|
||||
public synchronized boolean isAutoJoinEnabled() {
|
||||
if (mTargetWifiConfig == null) {
|
||||
diff --git a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
|
||||
index 09dfd89e3..358b534db 100644
|
||||
--- a/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
|
||||
+++ b/libs/WifiTrackerLib/src/com/android/wifitrackerlib/WifiEntry.java
|
||||
@@ -142,6 +142,7 @@ public class WifiEntry {
|
||||
public static final int PRIVACY_DEVICE_MAC = 0;
|
||||
public static final int PRIVACY_RANDOMIZED_MAC = 1;
|
||||
public static final int PRIVACY_UNKNOWN = 2;
|
||||
+ public static final int PRIVACY_RANDOMIZATION_ALWAYS = 100;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(value = {
|
@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: codeworkx <daniel.hillenbrand@codeworkx.de>
|
||||
Date: Sun, 20 Jan 2019 17:48:20 +0100
|
||||
Subject: [PATCH] audio_extn: Fix unused parameter warning in utils.c
|
||||
|
||||
The unused parameter warning appears if we are not building with
|
||||
at least one of the following cflags enabled:
|
||||
|
||||
* DEV_ARBI_ENABLED
|
||||
* SOUND_TRIGGER_ENABLED
|
||||
* AUDIO_LISTEN_ENABLED
|
||||
|
||||
hardware/qcom/audio/hal/audio_extn/utils.c:2522:55: error: unused parameter 'snd_device'
|
||||
[-Werror,-Wunused-parameter]
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
^
|
||||
|
||||
Change-Id: I694c683c9bfde60343f0f6ea8d806bc5e24437e6
|
||||
(cherry picked from commit 12981fb9f3c8a67bcc362c7badfb9189bc181cda)
|
||||
---
|
||||
hal/audio_extn/audio_extn.h | 5 +++++
|
||||
hal/audio_extn/utils.c | 2 ++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
|
||||
index 1187642d1f..38ae1aed53 100644
|
||||
--- a/hal/audio_extn/audio_extn.h
|
||||
+++ b/hal/audio_extn/audio_extn.h
|
||||
@@ -688,7 +688,12 @@ bool audio_extn_utils_is_dolby_format(audio_format_t format);
|
||||
int audio_extn_utils_get_bit_width_from_string(const char *);
|
||||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
+
|
||||
+#if !defined(DEV_ARBI_ENABLED) && !defined(SOUND_TRIGGER_ENABLED) && !defined(AUDIO_LISTEN_ENABLED)
|
||||
+#define audio_extn_utils_release_snd_device(snd_device) (0)
|
||||
+#else
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
+#endif
|
||||
int audio_extn_utils_get_app_sample_rate_for_device(struct audio_device *adev,
|
||||
struct audio_usecase *usecase, int snd_device);
|
||||
|
||||
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
|
||||
index cd788542f1..10f1eb2161 100644
|
||||
--- a/hal/audio_extn/utils.c
|
||||
+++ b/hal/audio_extn/utils.c
|
||||
@@ -2520,6 +2520,7 @@ int audio_extn_utils_get_channels_from_string(const char *id_string)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#if defined(DEV_ARBI_ENABLED) || defined(SOUND_TRIGGER_ENABLED) || defined(AUDIO_LISTEN_ENABLED)
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
{
|
||||
audio_extn_dev_arbi_release(snd_device);
|
||||
@@ -2528,3 +2529,4 @@ void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
audio_extn_listen_update_device_status(snd_device,
|
||||
LISTEN_EVENT_SND_DEVICE_FREE);
|
||||
}
|
||||
+#endif
|
@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: codeworkx <daniel.hillenbrand@codeworkx.de>
|
||||
Date: Sun, 20 Jan 2019 17:48:20 +0100
|
||||
Subject: [PATCH] audio_extn: Fix unused parameter warning in utils.c
|
||||
|
||||
The unused parameter warning appears if we are not building with
|
||||
at least one of the following cflags enabled:
|
||||
|
||||
* DEV_ARBI_ENABLED
|
||||
* SOUND_TRIGGER_ENABLED
|
||||
* AUDIO_LISTEN_ENABLED
|
||||
|
||||
hardware/qcom/audio/hal/audio_extn/utils.c:2522:55: error: unused parameter 'snd_device'
|
||||
[-Werror,-Wunused-parameter]
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
^
|
||||
|
||||
Change-Id: I694c683c9bfde60343f0f6ea8d806bc5e24437e6
|
||||
Signed-off-by: Atman <masteratman@gmail.com>
|
||||
---
|
||||
hal/audio_extn/audio_extn.h | 4 ++++
|
||||
hal/audio_extn/utils.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
|
||||
index f37c948ec6..c6b2051a71 100644
|
||||
--- a/hal/audio_extn/audio_extn.h
|
||||
+++ b/hal/audio_extn/audio_extn.h
|
||||
@@ -815,7 +815,11 @@ bool audio_extn_utils_is_dolby_format(audio_format_t format);
|
||||
int audio_extn_utils_get_bit_width_from_string(const char *);
|
||||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
+#if !defined(DEV_ARBI_ENABLED) && !defined(SOUND_TRIGGER_ENABLED) && !defined(AUDIO_LISTEN_ENABLED)
|
||||
+#define audio_extn_utils_release_snd_device(snd_device) (0)
|
||||
+#else
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
+#endif
|
||||
bool audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
int audio_extn_utils_get_vendor_enhanced_info();
|
||||
int audio_extn_utils_get_app_sample_rate_for_device(struct audio_device *adev,
|
||||
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
|
||||
index 4675fc39c2..4a5d91a974 100644
|
||||
--- a/hal/audio_extn/utils.c
|
||||
+++ b/hal/audio_extn/utils.c
|
||||
@@ -2917,6 +2917,7 @@ int audio_extn_utils_get_channels_from_string(const char *id_string)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#if defined(DEV_ARBI_ENABLED) || defined(SOUND_TRIGGER_ENABLED) || defined(AUDIO_LISTEN_ENABLED)
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
{
|
||||
audio_extn_dev_arbi_release(snd_device);
|
||||
@@ -2925,6 +2926,7 @@ void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
audio_extn_listen_update_device_status(snd_device,
|
||||
LISTEN_EVENT_SND_DEVICE_FREE);
|
||||
}
|
||||
+#endif
|
||||
|
||||
int audio_extn_utils_get_license_params(
|
||||
const struct audio_device *adev,
|
@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: codeworkx <daniel.hillenbrand@codeworkx.de>
|
||||
Date: Sun, 20 Jan 2019 17:48:20 +0100
|
||||
Subject: [PATCH] audio_extn: Fix unused parameter warning in utils.c
|
||||
|
||||
The unused parameter warning appears if we are not building with
|
||||
at least one of the following cflags enabled:
|
||||
|
||||
* DEV_ARBI_ENABLED
|
||||
* SOUND_TRIGGER_ENABLED
|
||||
* AUDIO_LISTEN_ENABLED
|
||||
|
||||
hardware/qcom/audio/hal/audio_extn/utils.c:2522:55: error: unused parameter 'snd_device'
|
||||
[-Werror,-Wunused-parameter]
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
^
|
||||
|
||||
Change-Id: I694c683c9bfde60343f0f6ea8d806bc5e24437e6
|
||||
Signed-off-by: Atman <masteratman@gmail.com>
|
||||
---
|
||||
hal/audio_extn/audio_extn.h | 4 ++++
|
||||
hal/audio_extn/utils.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
|
||||
index 85502ad91d..95890ab12e 100755
|
||||
--- a/hal/audio_extn/audio_extn.h
|
||||
+++ b/hal/audio_extn/audio_extn.h
|
||||
@@ -860,7 +860,11 @@ bool audio_extn_utils_is_dolby_format(audio_format_t format);
|
||||
int audio_extn_utils_get_bit_width_from_string(const char *);
|
||||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
+#if !defined(DEV_ARBI_ENABLED) && !defined(SOUND_TRIGGER_ENABLED) && !defined(AUDIO_LISTEN_ENABLED)
|
||||
+#define audio_extn_utils_release_snd_device(snd_device) (0)
|
||||
+#else
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
+#endif
|
||||
bool audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
int audio_extn_utils_get_vendor_enhanced_info();
|
||||
int audio_extn_utils_get_app_sample_rate_for_device(struct audio_device *adev,
|
||||
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
|
||||
index 756faf544c..0e25d3a396 100755
|
||||
--- a/hal/audio_extn/utils.c
|
||||
+++ b/hal/audio_extn/utils.c
|
||||
@@ -3272,6 +3272,7 @@ int audio_extn_utils_get_channels_from_string(const char *id_string)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#if defined(DEV_ARBI_ENABLED) || defined(SOUND_TRIGGER_ENABLED) || defined(AUDIO_LISTEN_ENABLED)
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
{
|
||||
audio_extn_dev_arbi_release(snd_device);
|
||||
@@ -3280,6 +3281,7 @@ void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
audio_extn_listen_update_device_status(snd_device,
|
||||
LISTEN_EVENT_SND_DEVICE_FREE);
|
||||
}
|
||||
+#endif
|
||||
|
||||
int audio_extn_utils_get_license_params(
|
||||
const struct audio_device *adev,
|
@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: codeworkx <daniel.hillenbrand@codeworkx.de>
|
||||
Date: Mon, 1 Jul 2019 06:36:30 +0000
|
||||
Subject: [PATCH] audio_extn: Fix unused parameter warning in utils.c
|
||||
|
||||
The unused parameter warning appears if we are not building with
|
||||
at least one of the following cflags enabled:
|
||||
|
||||
* DEV_ARBI_ENABLED
|
||||
* SOUND_TRIGGER_ENABLED
|
||||
* AUDIO_LISTEN_ENABLED
|
||||
|
||||
hardware/qcom/audio/hal/audio_extn/utils.c:2522:55: error: unused parameter 'snd_device'
|
||||
[-Werror,-Wunused-parameter]
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
|
||||
Change-Id: I694c683c9bfde60343f0f6ea8d806bc5e24437e6
|
||||
---
|
||||
hal/audio_extn/audio_extn.h | 4 ++++
|
||||
hal/audio_extn/utils.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
|
||||
index 175715f1e3..b70e24f7e3 100644
|
||||
--- a/hal/audio_extn/audio_extn.h
|
||||
+++ b/hal/audio_extn/audio_extn.h
|
||||
@@ -873,7 +873,11 @@ bool audio_extn_utils_is_dolby_format(audio_format_t format);
|
||||
int audio_extn_utils_get_bit_width_from_string(const char *);
|
||||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
+#if !defined(DEV_ARBI_ENABLED) && !defined(SOUND_TRIGGER_ENABLED) && !defined(AUDIO_LISTEN_ENABLED)
|
||||
+#define audio_extn_utils_release_snd_device(snd_device) (0)
|
||||
+#else
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
+#endif
|
||||
bool audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
int audio_extn_utils_get_vendor_enhanced_info();
|
||||
int audio_extn_utils_get_app_sample_rate_for_device(struct audio_device *adev,
|
||||
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
|
||||
index be20e12953..981cad8e1e 100644
|
||||
--- a/hal/audio_extn/utils.c
|
||||
+++ b/hal/audio_extn/utils.c
|
||||
@@ -3315,6 +3315,7 @@ int audio_extn_utils_get_channels_from_string(const char *id_string)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#if defined(DEV_ARBI_ENABLED) || defined(SOUND_TRIGGER_ENABLED) || defined(AUDIO_LISTEN_ENABLED)
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
{
|
||||
audio_extn_dev_arbi_release(snd_device);
|
||||
@@ -3323,6 +3324,7 @@ void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
audio_extn_listen_update_device_status(snd_device,
|
||||
LISTEN_EVENT_SND_DEVICE_FREE);
|
||||
}
|
||||
+#endif
|
||||
|
||||
int audio_extn_utils_get_license_params(
|
||||
const struct audio_device *adev,
|
@ -0,0 +1,58 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: codeworkx <daniel.hillenbrand@codeworkx.de>
|
||||
Date: Mon, 1 Jul 2019 06:36:30 +0000
|
||||
Subject: [PATCH] audio_extn: Fix unused parameter warning in utils.c
|
||||
|
||||
The unused parameter warning appears if we are not building with
|
||||
at least one of the following cflags enabled:
|
||||
|
||||
* DEV_ARBI_ENABLED
|
||||
* SOUND_TRIGGER_ENABLED
|
||||
* AUDIO_LISTEN_ENABLED
|
||||
|
||||
hardware/qcom/audio/hal/audio_extn/utils.c:2522:55: error: unused parameter 'snd_device'
|
||||
[-Werror,-Wunused-parameter]
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device)
|
||||
|
||||
Change-Id: I694c683c9bfde60343f0f6ea8d806bc5e24437e6
|
||||
---
|
||||
hal/audio_extn/audio_extn.h | 4 ++++
|
||||
hal/audio_extn/utils.c | 2 ++
|
||||
2 files changed, 6 insertions(+)
|
||||
|
||||
diff --git a/hal/audio_extn/audio_extn.h b/hal/audio_extn/audio_extn.h
|
||||
index d75dd5a064..080cfabd4e 100644
|
||||
--- a/hal/audio_extn/audio_extn.h
|
||||
+++ b/hal/audio_extn/audio_extn.h
|
||||
@@ -873,7 +873,11 @@ bool audio_extn_utils_is_dolby_format(audio_format_t format);
|
||||
int audio_extn_utils_get_bit_width_from_string(const char *);
|
||||
int audio_extn_utils_get_sample_rate_from_string(const char *);
|
||||
int audio_extn_utils_get_channels_from_string(const char *);
|
||||
+#if !defined(DEV_ARBI_ENABLED) && !defined(SOUND_TRIGGER_ENABLED) && !defined(AUDIO_LISTEN_ENABLED)
|
||||
+#define audio_extn_utils_release_snd_device(snd_device) (0)
|
||||
+#else
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device);
|
||||
+#endif
|
||||
bool audio_extn_utils_is_vendor_enhanced_fwk();
|
||||
int audio_extn_utils_get_vendor_enhanced_info();
|
||||
int audio_extn_utils_get_app_sample_rate_for_device(struct audio_device *adev,
|
||||
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
|
||||
index 55006d23f3..d2b60f703d 100644
|
||||
--- a/hal/audio_extn/utils.c
|
||||
+++ b/hal/audio_extn/utils.c
|
||||
@@ -3315,6 +3315,7 @@ int audio_extn_utils_get_channels_from_string(const char *id_string)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
+#if defined(DEV_ARBI_ENABLED) || defined(SOUND_TRIGGER_ENABLED) || defined(AUDIO_LISTEN_ENABLED)
|
||||
void audio_extn_utils_release_snd_device(snd_device_t snd_device __unused)
|
||||
{
|
||||
audio_extn_dev_arbi_release(snd_device);
|
||||
@@ -3323,6 +3324,7 @@ void audio_extn_utils_release_snd_device(snd_device_t snd_device __unused)
|
||||
audio_extn_listen_update_device_status(snd_device,
|
||||
LISTEN_EVENT_SND_DEVICE_FREE);
|
||||
}
|
||||
+#endif
|
||||
|
||||
int audio_extn_utils_get_license_params(
|
||||
const struct audio_device *adev,
|
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Tue, 14 Dec 2021 21:10:51 +0200
|
||||
Subject: [PATCH] don't throw SecurityException when INTERNET permission is
|
||||
revoked
|
||||
|
||||
---
|
||||
ojluni/src/main/java/java/net/Inet6AddressImpl.java | 11 +----------
|
||||
1 file changed, 1 insertion(+), 10 deletions(-)
|
||||
|
||||
diff --git a/ojluni/src/main/java/java/net/Inet6AddressImpl.java b/ojluni/src/main/java/java/net/Inet6AddressImpl.java
|
||||
index 84bcf17edae..fda9674e08e 100644
|
||||
--- a/ojluni/src/main/java/java/net/Inet6AddressImpl.java
|
||||
+++ b/ojluni/src/main/java/java/net/Inet6AddressImpl.java
|
||||
@@ -141,16 +141,7 @@ class Inet6AddressImpl implements InetAddressImpl {
|
||||
addressCache.put(host, netId, addresses);
|
||||
return addresses;
|
||||
} catch (GaiException gaiException) {
|
||||
- // If the failure appears to have been a lack of INTERNET permission, throw a clear
|
||||
- // SecurityException to aid in debugging this common mistake.
|
||||
- // http://code.google.com/p/android/issues/detail?id=15722
|
||||
- if (gaiException.getCause() instanceof ErrnoException) {
|
||||
- int errno = ((ErrnoException) gaiException.getCause()).errno;
|
||||
- if (errno == EACCES || errno == EPERM) {
|
||||
- throw new SecurityException("Permission denied (missing INTERNET permission?)", gaiException);
|
||||
- }
|
||||
- }
|
||||
- // Otherwise, throw an UnknownHostException.
|
||||
+ // Throw an UnknownHostException.
|
||||
String detailMessage = "Unable to resolve host \"" + host + "\": " + Libcore.os.gai_strerror(gaiException.error);
|
||||
addressCache.putUnknownHost(host, netId, detailMessage);
|
||||
throw gaiException.rethrowAsUnknownHostException(detailMessage);
|
@ -0,0 +1,727 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Muhomor <muhomor.dmitry@gmail.com>
|
||||
Date: Mon, 9 Oct 2023 14:21:38 +0300
|
||||
Subject: [PATCH] constify JNINativeMethod tables
|
||||
|
||||
fd '.+\.(c|cpp|cc)$' --exec sed -i 's/static JNINativeMethod/static const JNINativeMethod/'
|
||||
---
|
||||
luni/src/main/native/android_system_OsConstants.cpp | 2 +-
|
||||
luni/src/main/native/java_lang_StringToReal.cpp | 2 +-
|
||||
luni/src/main/native/java_lang_invoke_MethodHandle.cpp | 2 +-
|
||||
luni/src/main/native/java_lang_invoke_VarHandle.cpp | 2 +-
|
||||
luni/src/main/native/libcore_icu_ICU.cpp | 2 +-
|
||||
luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp | 2 +-
|
||||
luni/src/main/native/libcore_io_Linux.cpp | 2 +-
|
||||
luni/src/main/native/libcore_io_Memory.cpp | 2 +-
|
||||
luni/src/main/native/libcore_math_NativeBN.cpp | 2 +-
|
||||
.../src/main/native/libcore_util_NativeAllocationRegistry.cpp | 2 +-
|
||||
luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp | 4 ++--
|
||||
luni/src/main/native/sun_misc_Unsafe.cpp | 2 +-
|
||||
ojluni/src/main/native/Adler32.c | 2 +-
|
||||
ojluni/src/main/native/CRC32.c | 2 +-
|
||||
ojluni/src/main/native/Character.cpp | 2 +-
|
||||
ojluni/src/main/native/Console_md.c | 2 +-
|
||||
ojluni/src/main/native/DatagramChannelImpl.c | 2 +-
|
||||
ojluni/src/main/native/DatagramDispatcher.c | 2 +-
|
||||
ojluni/src/main/native/Deflater.c | 2 +-
|
||||
ojluni/src/main/native/Double.c | 2 +-
|
||||
ojluni/src/main/native/FileChannelImpl.c | 2 +-
|
||||
ojluni/src/main/native/FileDescriptor_md.c | 2 +-
|
||||
ojluni/src/main/native/FileDispatcherImpl.c | 2 +-
|
||||
ojluni/src/main/native/FileInputStream.c | 2 +-
|
||||
ojluni/src/main/native/FileKey.c | 2 +-
|
||||
ojluni/src/main/native/FileSystemPreferences.c | 2 +-
|
||||
ojluni/src/main/native/Float.c | 2 +-
|
||||
ojluni/src/main/native/IOUtil.c | 2 +-
|
||||
ojluni/src/main/native/Inflater.c | 2 +-
|
||||
ojluni/src/main/native/MappedByteBuffer.c | 2 +-
|
||||
ojluni/src/main/native/Math.c | 2 +-
|
||||
ojluni/src/main/native/NativeThread.c | 2 +-
|
||||
ojluni/src/main/native/Net.c | 2 +-
|
||||
ojluni/src/main/native/ObjectInputStream.c | 2 +-
|
||||
ojluni/src/main/native/ObjectOutputStream.c | 2 +-
|
||||
ojluni/src/main/native/ObjectStreamClass.c | 2 +-
|
||||
ojluni/src/main/native/PollArrayWrapper.c | 2 +-
|
||||
ojluni/src/main/native/ProcessEnvironment_md.c | 2 +-
|
||||
ojluni/src/main/native/Runtime.c | 2 +-
|
||||
ojluni/src/main/native/ServerSocketChannelImpl.c | 2 +-
|
||||
ojluni/src/main/native/SocketChannelImpl.c | 2 +-
|
||||
ojluni/src/main/native/SocketInputStream.c | 2 +-
|
||||
ojluni/src/main/native/SocketOutputStream.c | 2 +-
|
||||
ojluni/src/main/native/StrictMath.c | 2 +-
|
||||
ojluni/src/main/native/System.c | 2 +-
|
||||
ojluni/src/main/native/UNIXProcess_md.c | 2 +-
|
||||
ojluni/src/main/native/UnixFileSystem_md.c | 2 +-
|
||||
ojluni/src/main/native/UnixNativeDispatcher.c | 2 +-
|
||||
ojluni/src/main/native/ZipFile.c | 4 ++--
|
||||
ojluni/src/main/native/jdk_internal_misc_VM.cpp | 2 +-
|
||||
50 files changed, 52 insertions(+), 52 deletions(-)
|
||||
|
||||
diff --git a/luni/src/main/native/android_system_OsConstants.cpp b/luni/src/main/native/android_system_OsConstants.cpp
|
||||
index 3f8ce604b20..4dc08cad77e 100644
|
||||
--- a/luni/src/main/native/android_system_OsConstants.cpp
|
||||
+++ b/luni/src/main/native/android_system_OsConstants.cpp
|
||||
@@ -737,7 +737,7 @@ static void OsConstants_initConstants(JNIEnv* env, jclass c) {
|
||||
initConstant(env, c, "_SC_XOPEN_XCU_VERSION", _SC_XOPEN_XCU_VERSION);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(OsConstants, initConstants, "()V"),
|
||||
};
|
||||
void register_android_system_OsConstants(JNIEnv* env) {
|
||||
diff --git a/luni/src/main/native/java_lang_StringToReal.cpp b/luni/src/main/native/java_lang_StringToReal.cpp
|
||||
index d712708d90e..3ae0382a1b6 100644
|
||||
--- a/luni/src/main/native/java_lang_StringToReal.cpp
|
||||
+++ b/luni/src/main/native/java_lang_StringToReal.cpp
|
||||
@@ -892,7 +892,7 @@ static jdouble StringToReal_parseDblImpl(JNIEnv* env, jclass, jstring s, jint e)
|
||||
return createDouble(env, str.c_str(), e);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(StringToReal, parseFltImpl, "(Ljava/lang/String;I)F"),
|
||||
NATIVE_METHOD(StringToReal, parseDblImpl, "(Ljava/lang/String;I)D"),
|
||||
};
|
||||
diff --git a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
|
||||
index 0441d4552dc..3335c6de9ac 100644
|
||||
--- a/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
|
||||
+++ b/luni/src/main/native/java_lang_invoke_MethodHandle.cpp
|
||||
@@ -29,7 +29,7 @@ static jobject MethodHandle_invoke(JNIEnv* env, jobject, jobjectArray) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(MethodHandle, invokeExact, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
NATIVE_METHOD(MethodHandle, invoke, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
};
|
||||
diff --git a/luni/src/main/native/java_lang_invoke_VarHandle.cpp b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
|
||||
index e1cc1c7f8b5..9f5215a5204 100644
|
||||
--- a/luni/src/main/native/java_lang_invoke_VarHandle.cpp
|
||||
+++ b/luni/src/main/native/java_lang_invoke_VarHandle.cpp
|
||||
@@ -210,7 +210,7 @@ static jboolean VarHandle_weakCompareAndSetRelease(JNIEnv* env, jobject, jobject
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(VarHandle, compareAndExchange, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
NATIVE_METHOD(VarHandle, compareAndExchangeAcquire, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
NATIVE_METHOD(VarHandle, compareAndExchangeRelease, "([Ljava/lang/Object;)Ljava/lang/Object;"),
|
||||
diff --git a/luni/src/main/native/libcore_icu_ICU.cpp b/luni/src/main/native/libcore_icu_ICU.cpp
|
||||
index f9401d1edb7..1531ad1ca59 100644
|
||||
--- a/luni/src/main/native/libcore_icu_ICU.cpp
|
||||
+++ b/luni/src/main/native/libcore_icu_ICU.cpp
|
||||
@@ -112,7 +112,7 @@ static jstring ICU_getUnicodeVersion(JNIEnv* env, jclass) {
|
||||
return versionString(env, unicodeVersion);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ICU, getAvailableLocalesNative, "()[Ljava/lang/String;"),
|
||||
NATIVE_METHOD(ICU, getCldrVersion, "()Ljava/lang/String;"),
|
||||
NATIVE_METHOD(ICU, getDefaultLocale, "()Ljava/lang/String;"),
|
||||
diff --git a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
|
||||
index e99edd6c4f9..61b75bcd358 100644
|
||||
--- a/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
|
||||
+++ b/luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp
|
||||
@@ -26,7 +26,7 @@ static void AsynchronousCloseMonitor_signalBlockedThreads(JNIEnv* env, jclass, j
|
||||
AsynchronousCloseMonitor::signalBlockedThreads(fd);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(AsynchronousCloseMonitor, signalBlockedThreads, "(Ljava/io/FileDescriptor;)V"),
|
||||
};
|
||||
void register_libcore_io_AsynchronousCloseMonitor(JNIEnv* env) {
|
||||
diff --git a/luni/src/main/native/libcore_io_Linux.cpp b/luni/src/main/native/libcore_io_Linux.cpp
|
||||
index adf7b75ad95..53c362616ab 100644
|
||||
--- a/luni/src/main/native/libcore_io_Linux.cpp
|
||||
+++ b/luni/src/main/native/libcore_io_Linux.cpp
|
||||
@@ -2759,7 +2759,7 @@ static jint Linux_writev(JNIEnv* env, jobject, jobject javaFd, jobjectArray buff
|
||||
#define NATIVE_METHOD_OVERLOAD(className, functionName, signature, variant) \
|
||||
{ #functionName, signature, reinterpret_cast<void*>(className ## _ ## functionName ## variant) }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Linux, accept, "(Ljava/io/FileDescriptor;Ljava/net/SocketAddress;)Ljava/io/FileDescriptor;"),
|
||||
NATIVE_METHOD(Linux, access, "(Ljava/lang/String;I)Z"),
|
||||
NATIVE_METHOD(Linux, android_fdsan_exchange_owner_tag, "(Ljava/io/FileDescriptor;JJ)V"),
|
||||
diff --git a/luni/src/main/native/libcore_io_Memory.cpp b/luni/src/main/native/libcore_io_Memory.cpp
|
||||
index 2fb4b43686e..da05c236ace 100644
|
||||
--- a/luni/src/main/native/libcore_io_Memory.cpp
|
||||
+++ b/luni/src/main/native/libcore_io_Memory.cpp
|
||||
@@ -238,7 +238,7 @@ static void Memory_unsafeBulkPut(JNIEnv* env, jclass, jbyteArray dstArray, jint
|
||||
}
|
||||
|
||||
// The remaining Memory methods are contained in art/runtime/native/libcore_io_Memory.cc
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Memory, memmove, "(Ljava/lang/Object;ILjava/lang/Object;IJ)V"),
|
||||
FAST_NATIVE_METHOD(Memory, peekByte, "(J)B"),
|
||||
FAST_NATIVE_METHOD(Memory, peekIntNative, "(J)I"),
|
||||
diff --git a/luni/src/main/native/libcore_math_NativeBN.cpp b/luni/src/main/native/libcore_math_NativeBN.cpp
|
||||
index dc4b947358b..c6af376f6bc 100644
|
||||
--- a/luni/src/main/native/libcore_math_NativeBN.cpp
|
||||
+++ b/luni/src/main/native/libcore_math_NativeBN.cpp
|
||||
@@ -164,7 +164,7 @@ static void NativeBN_BN_mod_exp(JNIEnv* env, jclass, jlong r, jlong a, jlong p,
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(NativeBN, BN_div, "(JJJJ)V"),
|
||||
NATIVE_METHOD(NativeBN, BN_free, "(J)V"),
|
||||
NATIVE_METHOD(NativeBN, BN_mod_exp, "(JJJJ)V"),
|
||||
diff --git a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
|
||||
index ded578a9580..faaa5c7a7c4 100644
|
||||
--- a/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
|
||||
+++ b/luni/src/main/native/libcore_util_NativeAllocationRegistry.cpp
|
||||
@@ -29,7 +29,7 @@ static void NativeAllocationRegistry_applyFreeFunction(JNIEnv*,
|
||||
nativeFreeFunction(nativePtr);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(NativeAllocationRegistry, applyFreeFunction, "(JJ)V"),
|
||||
};
|
||||
|
||||
diff --git a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
|
||||
index fdabcf71591..62a2cd37b76 100644
|
||||
--- a/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
|
||||
+++ b/luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp
|
||||
@@ -1366,7 +1366,7 @@ static void ExpatParser_staticInitialize(JNIEnv* env, jobject classObject, jstri
|
||||
emptyString = reinterpret_cast<jstring>(env->NewGlobalRef(empty));
|
||||
}
|
||||
|
||||
-static JNINativeMethod parserMethods[] = {
|
||||
+static const JNINativeMethod parserMethods[] = {
|
||||
NATIVE_METHOD(ExpatParser, appendString, "(JLjava/lang/String;Z)V"),
|
||||
NATIVE_METHOD(ExpatParser, appendBytes, "(J[BII)V"),
|
||||
NATIVE_METHOD(ExpatParser, appendChars, "(J[CII)V"),
|
||||
@@ -1380,7 +1380,7 @@ static JNINativeMethod parserMethods[] = {
|
||||
NATIVE_METHOD(ExpatParser, staticInitialize, "(Ljava/lang/String;)V"),
|
||||
};
|
||||
|
||||
-static JNINativeMethod attributeMethods[] = {
|
||||
+static const JNINativeMethod attributeMethods[] = {
|
||||
NATIVE_METHOD(ExpatAttributes, freeAttributes, "(J)V"),
|
||||
NATIVE_METHOD(ExpatAttributes, getIndexForQName, "(JLjava/lang/String;)I"),
|
||||
NATIVE_METHOD(ExpatAttributes, getIndex, "(JLjava/lang/String;Ljava/lang/String;)I"),
|
||||
diff --git a/luni/src/main/native/sun_misc_Unsafe.cpp b/luni/src/main/native/sun_misc_Unsafe.cpp
|
||||
index 49848a2db2b..87b2feac807 100644
|
||||
--- a/luni/src/main/native/sun_misc_Unsafe.cpp
|
||||
+++ b/luni/src/main/native/sun_misc_Unsafe.cpp
|
||||
@@ -23,7 +23,7 @@ static jobject Unsafe_allocateInstance(JNIEnv* env, jclass, jclass c) {
|
||||
return env->AllocObject(c);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Unsafe, allocateInstance, "(Ljava/lang/Class;)Ljava/lang/Object;"),
|
||||
};
|
||||
void register_sun_misc_Unsafe(JNIEnv* env) {
|
||||
diff --git a/ojluni/src/main/native/Adler32.c b/ojluni/src/main/native/Adler32.c
|
||||
index 137dc849a49..7172cfa0467 100644
|
||||
--- a/ojluni/src/main/native/Adler32.c
|
||||
+++ b/ojluni/src/main/native/Adler32.c
|
||||
@@ -68,7 +68,7 @@ Java_java_util_zip_Adler32_updateByteBuffer(JNIEnv *env, jclass cls, jint adler,
|
||||
#define NATIVE_METHOD(className, functionName, signature) \
|
||||
{ #functionName, signature, (void*)(className ## _ ## functionName) }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Java_java_util_zip_Adler32, update, "(II)I"),
|
||||
NATIVE_METHOD(Java_java_util_zip_Adler32, updateBytes, "(I[BII)I"),
|
||||
NATIVE_METHOD(Java_java_util_zip_Adler32, updateByteBuffer, "(IJII)I"),
|
||||
diff --git a/ojluni/src/main/native/CRC32.c b/ojluni/src/main/native/CRC32.c
|
||||
index adfb9f9cccf..eac9af13720 100644
|
||||
--- a/ojluni/src/main/native/CRC32.c
|
||||
+++ b/ojluni/src/main/native/CRC32.c
|
||||
@@ -74,7 +74,7 @@ Java_java_util_zip_CRC32_updateByteBuffer0(JNIEnv *env, jclass cls, jint crc,
|
||||
#define NATIVE_METHOD(className, functionName, signature) \
|
||||
{ #functionName, signature, (void*)(className ## _ ## functionName) }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Java_java_util_zip_CRC32, update, "(II)I"),
|
||||
NATIVE_METHOD(Java_java_util_zip_CRC32, updateBytes0, "(I[BII)I"),
|
||||
NATIVE_METHOD(Java_java_util_zip_CRC32, updateByteBuffer0, "(IJII)I"),
|
||||
diff --git a/ojluni/src/main/native/Character.cpp b/ojluni/src/main/native/Character.cpp
|
||||
index ff56a9afbe2..4523f776a0a 100644
|
||||
--- a/ojluni/src/main/native/Character.cpp
|
||||
+++ b/ojluni/src/main/native/Character.cpp
|
||||
@@ -167,7 +167,7 @@ Character_codePointOfImpl(JNIEnv* env, jclass, jstring s) {
|
||||
return U_SUCCESS(status) ? cp : -1;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Character, codePointOfImpl, "(Ljava/lang/String;)I"),
|
||||
FAST_NATIVE_METHOD(Character, digitImpl, "(II)I"),
|
||||
FAST_NATIVE_METHOD(Character, getDirectionalityImpl, "(I)B"),
|
||||
diff --git a/ojluni/src/main/native/Console_md.c b/ojluni/src/main/native/Console_md.c
|
||||
index 13437be314e..f87bd168b1a 100644
|
||||
--- a/ojluni/src/main/native/Console_md.c
|
||||
+++ b/ojluni/src/main/native/Console_md.c
|
||||
@@ -72,7 +72,7 @@ Java_java_io_Console_echo(JNIEnv *env,
|
||||
return old;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Console, istty, "()Z"),
|
||||
NATIVE_METHOD(Console, encoding, "()Ljava/lang/String;"),
|
||||
NATIVE_METHOD(Console, echo, "(Z)Z"),
|
||||
diff --git a/ojluni/src/main/native/DatagramChannelImpl.c b/ojluni/src/main/native/DatagramChannelImpl.c
|
||||
index 11d149ddcf9..8a8444c8a2c 100644
|
||||
--- a/ojluni/src/main/native/DatagramChannelImpl.c
|
||||
+++ b/ojluni/src/main/native/DatagramChannelImpl.c
|
||||
@@ -276,7 +276,7 @@ Java_sun_nio_ch_DatagramChannelImpl_send0(JNIEnv *env, jobject this,
|
||||
return n;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(DatagramChannelImpl, initIDs, "()V"),
|
||||
NATIVE_METHOD(DatagramChannelImpl, disconnect0, "(Ljava/io/FileDescriptor;Z)V"),
|
||||
NATIVE_METHOD(DatagramChannelImpl, receive0, "(Ljava/io/FileDescriptor;JIZ)I"),
|
||||
diff --git a/ojluni/src/main/native/DatagramDispatcher.c b/ojluni/src/main/native/DatagramDispatcher.c
|
||||
index 36cc6cf4bc1..39ff9241791 100644
|
||||
--- a/ojluni/src/main/native/DatagramDispatcher.c
|
||||
+++ b/ojluni/src/main/native/DatagramDispatcher.c
|
||||
@@ -139,7 +139,7 @@ Java_sun_nio_ch_DatagramDispatcher_writev0(JNIEnv *env, jclass clazz,
|
||||
return convertLongReturnVal(env, (jlong)result, JNI_FALSE);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(DatagramDispatcher, read0, "(Ljava/io/FileDescriptor;JI)I"),
|
||||
NATIVE_METHOD(DatagramDispatcher, readv0, "(Ljava/io/FileDescriptor;JI)J"),
|
||||
NATIVE_METHOD(DatagramDispatcher, write0, "(Ljava/io/FileDescriptor;JI)I"),
|
||||
diff --git a/ojluni/src/main/native/Deflater.c b/ojluni/src/main/native/Deflater.c
|
||||
index 9ee032619dd..2230f8c9519 100644
|
||||
--- a/ojluni/src/main/native/Deflater.c
|
||||
+++ b/ojluni/src/main/native/Deflater.c
|
||||
@@ -240,7 +240,7 @@ Deflater_end(JNIEnv *env, jclass cls, jlong addr)
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Deflater, init, "(IIZ)J"),
|
||||
NATIVE_METHOD(Deflater, setDictionary, "(J[BII)V"),
|
||||
NATIVE_METHOD(Deflater, deflateBytes, "(J[BIII)I"),
|
||||
diff --git a/ojluni/src/main/native/Double.c b/ojluni/src/main/native/Double.c
|
||||
index 8382b889945..2bcb97a653f 100644
|
||||
--- a/ojluni/src/main/native/Double.c
|
||||
+++ b/ojluni/src/main/native/Double.c
|
||||
@@ -63,7 +63,7 @@ Double_doubleToRawLongBits(JNIEnv *env, jclass unused, jdouble v)
|
||||
u.d = (double)v;
|
||||
return u.l;
|
||||
}
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Double, longBitsToDouble, "(J)D"),
|
||||
NATIVE_METHOD(Double, doubleToRawLongBits, "(D)J"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/FileChannelImpl.c b/ojluni/src/main/native/FileChannelImpl.c
|
||||
index 51339dff9c1..6d5c075e835 100644
|
||||
--- a/ojluni/src/main/native/FileChannelImpl.c
|
||||
+++ b/ojluni/src/main/native/FileChannelImpl.c
|
||||
@@ -284,7 +284,7 @@ FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
|
||||
#endif
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileChannelImpl, initIDs, "()J"),
|
||||
NATIVE_METHOD(FileChannelImpl, map0, "(IJJ)J"),
|
||||
NATIVE_METHOD(FileChannelImpl, unmap0, "(JJ)I"),
|
||||
diff --git a/ojluni/src/main/native/FileDescriptor_md.c b/ojluni/src/main/native/FileDescriptor_md.c
|
||||
index 880f5ea56ad..3ba1c1343a0 100644
|
||||
--- a/ojluni/src/main/native/FileDescriptor_md.c
|
||||
+++ b/ojluni/src/main/native/FileDescriptor_md.c
|
||||
@@ -70,7 +70,7 @@ JNIEXPORT jboolean JNICALL FileDescriptor_isSocket(JNIEnv *env, jclass ignored,
|
||||
// END Android-changed: isSocket - do not clear socket error code
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileDescriptor, sync, "()V"),
|
||||
NATIVE_METHOD(FileDescriptor, isSocket, "(I)Z"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/FileDispatcherImpl.c b/ojluni/src/main/native/FileDispatcherImpl.c
|
||||
index 3e8e4f3e0f2..facede4cf14 100644
|
||||
--- a/ojluni/src/main/native/FileDispatcherImpl.c
|
||||
+++ b/ojluni/src/main/native/FileDispatcherImpl.c
|
||||
@@ -287,7 +287,7 @@ FileDispatcherImpl_closeIntFD(JNIEnv *env, jclass clazz, jint fd)
|
||||
closeFileDescriptor(env, fd);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileDispatcherImpl, closeIntFD, "(I)V"),
|
||||
NATIVE_METHOD(FileDispatcherImpl, preClose0, "(Ljava/io/FileDescriptor;)V"),
|
||||
NATIVE_METHOD(FileDispatcherImpl, close0, "(Ljava/io/FileDescriptor;)V"),
|
||||
diff --git a/ojluni/src/main/native/FileInputStream.c b/ojluni/src/main/native/FileInputStream.c
|
||||
index 650cb6c9040..bd2f64e68f0 100644
|
||||
--- a/ojluni/src/main/native/FileInputStream.c
|
||||
+++ b/ojluni/src/main/native/FileInputStream.c
|
||||
@@ -145,7 +145,7 @@ FileInputStream_available0(JNIEnv *env, jobject this) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileInputStream, skip0, "(J)J"),
|
||||
NATIVE_METHOD(FileInputStream, available0, "()I"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/FileKey.c b/ojluni/src/main/native/FileKey.c
|
||||
index c3b5d2a00fe..61d3c2ae896 100644
|
||||
--- a/ojluni/src/main/native/FileKey.c
|
||||
+++ b/ojluni/src/main/native/FileKey.c
|
||||
@@ -68,7 +68,7 @@ FileKey_init(JNIEnv *env, jobject this, jobject fdo)
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileKey, init, "(Ljava/io/FileDescriptor;)V"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/FileSystemPreferences.c b/ojluni/src/main/native/FileSystemPreferences.c
|
||||
index 9a731504281..d49de07b618 100644
|
||||
--- a/ojluni/src/main/native/FileSystemPreferences.c
|
||||
+++ b/ojluni/src/main/native/FileSystemPreferences.c
|
||||
@@ -150,7 +150,7 @@ Java_java_util_prefs_FileSystemPreferences_unlockFile0(JNIEnv *env,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(FileSystemPreferences, lockFile0, "(Ljava/lang/String;IZ)[I"),
|
||||
NATIVE_METHOD(FileSystemPreferences, unlockFile0, "(I)I"),
|
||||
NATIVE_METHOD(FileSystemPreferences, chmod, "(Ljava/lang/String;I)I"),
|
||||
diff --git a/ojluni/src/main/native/Float.c b/ojluni/src/main/native/Float.c
|
||||
index 956048d6b8e..5bfdf58245d 100644
|
||||
--- a/ojluni/src/main/native/Float.c
|
||||
+++ b/ojluni/src/main/native/Float.c
|
||||
@@ -59,7 +59,7 @@ Float_floatToRawIntBits(JNIEnv *env, jclass unused, jfloat v)
|
||||
u.f = (float)v;
|
||||
return (jint)u.i;
|
||||
}
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Float, intBitsToFloat, "(I)F"),
|
||||
NATIVE_METHOD(Float, floatToRawIntBits, "(F)I"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/IOUtil.c b/ojluni/src/main/native/IOUtil.c
|
||||
index d2a8cf1a2e9..de47c111b1b 100644
|
||||
--- a/ojluni/src/main/native/IOUtil.c
|
||||
+++ b/ojluni/src/main/native/IOUtil.c
|
||||
@@ -206,7 +206,7 @@ fdval(JNIEnv *env, jobject fdo)
|
||||
return (*env)->GetIntField(env, fdo, fd_fdID);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(IOUtil, iovMax, "()I"),
|
||||
NATIVE_METHOD(IOUtil, fdLimit, "()I"),
|
||||
NATIVE_METHOD(IOUtil, drain, "(I)Z"),
|
||||
diff --git a/ojluni/src/main/native/Inflater.c b/ojluni/src/main/native/Inflater.c
|
||||
index c4c24f0fed1..23b107426db 100644
|
||||
--- a/ojluni/src/main/native/Inflater.c
|
||||
+++ b/ojluni/src/main/native/Inflater.c
|
||||
@@ -201,7 +201,7 @@ Inflater_end(JNIEnv *env, jclass cls, jlong addr)
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Inflater, init, "(Z)J"),
|
||||
NATIVE_METHOD(Inflater, setDictionary, "(J[BII)V"),
|
||||
NATIVE_METHOD(Inflater, inflateBytes, "(J[BII)I"),
|
||||
diff --git a/ojluni/src/main/native/MappedByteBuffer.c b/ojluni/src/main/native/MappedByteBuffer.c
|
||||
index e68ba04cb3c..013273b5433 100644
|
||||
--- a/ojluni/src/main/native/MappedByteBuffer.c
|
||||
+++ b/ojluni/src/main/native/MappedByteBuffer.c
|
||||
@@ -106,7 +106,7 @@ Java_java_nio_MappedByteBuffer_force0(JNIEnv *env, jobject obj, jobject fdo,
|
||||
}
|
||||
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(MappedByteBuffer, isLoaded0, "(JJJ)Z"),
|
||||
NATIVE_METHOD(MappedByteBuffer, load0, "(JJ)V"),
|
||||
NATIVE_METHOD(MappedByteBuffer, force0, "(Ljava/io/FileDescriptor;JJ)V"),
|
||||
diff --git a/ojluni/src/main/native/Math.c b/ojluni/src/main/native/Math.c
|
||||
index 4bbcd1d0f1b..f3423328d0d 100644
|
||||
--- a/ojluni/src/main/native/Math.c
|
||||
+++ b/ojluni/src/main/native/Math.c
|
||||
@@ -141,7 +141,7 @@ Math_rint(jdouble d) {
|
||||
return rint(d);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Math, IEEEremainder, "(DD)D"),
|
||||
FAST_NATIVE_METHOD(Math, acos, "(D)D"),
|
||||
FAST_NATIVE_METHOD(Math, asin, "(D)D"),
|
||||
diff --git a/ojluni/src/main/native/NativeThread.c b/ojluni/src/main/native/NativeThread.c
|
||||
index 83aa0aea08e..10b29bcb72f 100644
|
||||
--- a/ojluni/src/main/native/NativeThread.c
|
||||
+++ b/ojluni/src/main/native/NativeThread.c
|
||||
@@ -115,7 +115,7 @@ NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
|
||||
JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(NativeThread, current, "()J"),
|
||||
NATIVE_METHOD(NativeThread, signal, "(J)V"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/Net.c b/ojluni/src/main/native/Net.c
|
||||
index e1da723c4b2..c93f58c1010 100644
|
||||
--- a/ojluni/src/main/native/Net.c
|
||||
+++ b/ojluni/src/main/native/Net.c
|
||||
@@ -864,7 +864,7 @@ handleSocketError(JNIEnv *env, jint errorValue) {
|
||||
}
|
||||
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Net, isIPv6Available0, "()Z"),
|
||||
NATIVE_METHOD(Net, isExclusiveBindAvailable, "()I"),
|
||||
NATIVE_METHOD(Net, canIPv6SocketJoinIPv4Group0, "()Z"),
|
||||
diff --git a/ojluni/src/main/native/ObjectInputStream.c b/ojluni/src/main/native/ObjectInputStream.c
|
||||
index 6f65dca5a56..6ba47e31dc1 100644
|
||||
--- a/ojluni/src/main/native/ObjectInputStream.c
|
||||
+++ b/ojluni/src/main/native/ObjectInputStream.c
|
||||
@@ -175,7 +175,7 @@ Java_java_io_ObjectInputStream_bytesToDoubles(JNIEnv *env,
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dst, doubles, 0);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ObjectInputStream, bytesToFloats, "([BI[FII)V"),
|
||||
NATIVE_METHOD(ObjectInputStream, bytesToDoubles, "([BI[DII)V"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/ObjectOutputStream.c b/ojluni/src/main/native/ObjectOutputStream.c
|
||||
index 169a83f3f8d..0e1479d6df9 100644
|
||||
--- a/ojluni/src/main/native/ObjectOutputStream.c
|
||||
+++ b/ojluni/src/main/native/ObjectOutputStream.c
|
||||
@@ -184,7 +184,7 @@ Java_java_io_ObjectOutputStream_doublesToBytes(JNIEnv *env,
|
||||
(*env)->ReleasePrimitiveArrayCritical(env, dst, bytes, 0);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ObjectOutputStream, floatsToBytes, "([FI[BII)V"),
|
||||
NATIVE_METHOD(ObjectOutputStream, doublesToBytes, "([DI[BII)V"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/ObjectStreamClass.c b/ojluni/src/main/native/ObjectStreamClass.c
|
||||
index 3d3fdefa330..84cfcc43d3f 100644
|
||||
--- a/ojluni/src/main/native/ObjectStreamClass.c
|
||||
+++ b/ojluni/src/main/native/ObjectStreamClass.c
|
||||
@@ -110,7 +110,7 @@ ObjectStreamClass_hasStaticInitializer(JNIEnv *env, jclass this,
|
||||
return (clinitId != superClinitId);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ObjectStreamClass, hasStaticInitializer, "(Ljava/lang/Class;Z)Z"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/PollArrayWrapper.c b/ojluni/src/main/native/PollArrayWrapper.c
|
||||
index 696f172a4e2..611ddd65317 100644
|
||||
--- a/ojluni/src/main/native/PollArrayWrapper.c
|
||||
+++ b/ojluni/src/main/native/PollArrayWrapper.c
|
||||
@@ -106,7 +106,7 @@ Java_sun_nio_ch_PollArrayWrapper_interrupt(JNIEnv *env, jobject this, jint fd)
|
||||
#define NATIVE_METHOD(className, functionName, signature) \
|
||||
{ #functionName, signature, (void*)(className ## _ ## functionName) }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Java_sun_nio_ch_PollArrayWrapper, interrupt, "(I)V"),
|
||||
NATIVE_METHOD(Java_sun_nio_ch_PollArrayWrapper, poll0, "(JIJ)I"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/ProcessEnvironment_md.c b/ojluni/src/main/native/ProcessEnvironment_md.c
|
||||
index a59410badc2..a3f46a4d4fd 100644
|
||||
--- a/ojluni/src/main/native/ProcessEnvironment_md.c
|
||||
+++ b/ojluni/src/main/native/ProcessEnvironment_md.c
|
||||
@@ -91,7 +91,7 @@ ProcessEnvironment_environ(JNIEnv *env, jclass ign)
|
||||
return result;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ProcessEnvironment, environ, "()[[B"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/Runtime.c b/ojluni/src/main/native/Runtime.c
|
||||
index 749511eb080..5e8a2916f6e 100644
|
||||
--- a/ojluni/src/main/native/Runtime.c
|
||||
+++ b/ojluni/src/main/native/Runtime.c
|
||||
@@ -80,7 +80,7 @@ Runtime_nativeLoad(JNIEnv* env, jclass ignored, jstring javaFilename,
|
||||
return JVM_NativeLoad(env, javaFilename, javaLoader, caller);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
FAST_NATIVE_METHOD(Runtime, freeMemory, "()J"),
|
||||
FAST_NATIVE_METHOD(Runtime, totalMemory, "()J"),
|
||||
FAST_NATIVE_METHOD(Runtime, maxMemory, "()J"),
|
||||
diff --git a/ojluni/src/main/native/ServerSocketChannelImpl.c b/ojluni/src/main/native/ServerSocketChannelImpl.c
|
||||
index 679811f96ae..83a94f9b8e3 100644
|
||||
--- a/ojluni/src/main/native/ServerSocketChannelImpl.c
|
||||
+++ b/ojluni/src/main/native/ServerSocketChannelImpl.c
|
||||
@@ -137,7 +137,7 @@ Java_sun_nio_ch_ServerSocketChannelImpl_accept0(JNIEnv *env, jobject this,
|
||||
|
||||
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, initIDs, "()V"),
|
||||
NATIVE_METHOD(Java_sun_nio_ch_ServerSocketChannelImpl, accept0,
|
||||
"(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;[Ljava/net/InetSocketAddress;)I"),
|
||||
diff --git a/ojluni/src/main/native/SocketChannelImpl.c b/ojluni/src/main/native/SocketChannelImpl.c
|
||||
index 94291659cf9..9e543690544 100644
|
||||
--- a/ojluni/src/main/native/SocketChannelImpl.c
|
||||
+++ b/ojluni/src/main/native/SocketChannelImpl.c
|
||||
@@ -96,7 +96,7 @@ Java_sun_nio_ch_SocketChannelImpl_sendOutOfBandData(JNIEnv* env, jclass this,
|
||||
return convertReturnVal(env, n, JNI_FALSE);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(SocketChannelImpl, checkConnect, "(Ljava/io/FileDescriptor;ZZ)I"),
|
||||
NATIVE_METHOD(SocketChannelImpl, sendOutOfBandData, "(Ljava/io/FileDescriptor;B)I"),
|
||||
};
|
||||
diff --git a/ojluni/src/main/native/SocketInputStream.c b/ojluni/src/main/native/SocketInputStream.c
|
||||
index dcea334fd1f..aa10f4e9c1a 100644
|
||||
--- a/ojluni/src/main/native/SocketInputStream.c
|
||||
+++ b/ojluni/src/main/native/SocketInputStream.c
|
||||
@@ -153,7 +153,7 @@ SocketInputStream_socketRead0(JNIEnv *env, jobject this,
|
||||
return nread;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(SocketInputStream, socketRead0, "(Ljava/io/FileDescriptor;[BIII)I"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/SocketOutputStream.c b/ojluni/src/main/native/SocketOutputStream.c
|
||||
index bc3522bee35..d72fd1108ba 100644
|
||||
--- a/ojluni/src/main/native/SocketOutputStream.c
|
||||
+++ b/ojluni/src/main/native/SocketOutputStream.c
|
||||
@@ -128,7 +128,7 @@ SocketOutputStream_socketWrite0(JNIEnv *env, jobject this,
|
||||
}
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(SocketOutputStream, socketWrite0, "(Ljava/io/FileDescriptor;[BII)V"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/StrictMath.c b/ojluni/src/main/native/StrictMath.c
|
||||
index 7f9bbebcdf7..24b29228a46 100644
|
||||
--- a/ojluni/src/main/native/StrictMath.c
|
||||
+++ b/ojluni/src/main/native/StrictMath.c
|
||||
@@ -156,7 +156,7 @@ StrictMath_expm1(JNIEnv *env, jclass unused, jdouble d)
|
||||
return (jdouble) ieee_expm1((double)d);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(StrictMath, cos, "(D)D"),
|
||||
NATIVE_METHOD(StrictMath, sin, "(D)D"),
|
||||
NATIVE_METHOD(StrictMath, tan, "(D)D"),
|
||||
diff --git a/ojluni/src/main/native/System.c b/ojluni/src/main/native/System.c
|
||||
index 39332ce5ed8..582e06d1e07 100644
|
||||
--- a/ojluni/src/main/native/System.c
|
||||
+++ b/ojluni/src/main/native/System.c
|
||||
@@ -261,7 +261,7 @@ static jlong System_currentTimeMillis() {
|
||||
return JVM_CurrentTimeMillis(NULL, NULL);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(System, mapLibraryName, "(Ljava/lang/String;)Ljava/lang/String;"),
|
||||
NATIVE_METHOD(System, setErr0, "(Ljava/io/PrintStream;)V"),
|
||||
NATIVE_METHOD(System, setOut0, "(Ljava/io/PrintStream;)V"),
|
||||
diff --git a/ojluni/src/main/native/UNIXProcess_md.c b/ojluni/src/main/native/UNIXProcess_md.c
|
||||
index 8fdb6a0e0aa..9b6d4f13b1f 100644
|
||||
--- a/ojluni/src/main/native/UNIXProcess_md.c
|
||||
+++ b/ojluni/src/main/native/UNIXProcess_md.c
|
||||
@@ -1058,7 +1058,7 @@ UNIXProcess_destroyProcess(JNIEnv *env, jobject junk, jint pid)
|
||||
kill(pid, SIGTERM);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(UNIXProcess, destroyProcess, "(I)V"),
|
||||
NATIVE_METHOD(UNIXProcess, forkAndExec, "([B[BI[BI[B[IZ)I"),
|
||||
NATIVE_METHOD(UNIXProcess, waitForProcessExit, "(I)I"),
|
||||
diff --git a/ojluni/src/main/native/UnixFileSystem_md.c b/ojluni/src/main/native/UnixFileSystem_md.c
|
||||
index 6f432fddf1d..07baef8a802 100644
|
||||
--- a/ojluni/src/main/native/UnixFileSystem_md.c
|
||||
+++ b/ojluni/src/main/native/UnixFileSystem_md.c
|
||||
@@ -552,7 +552,7 @@ Java_java_io_UnixFileSystem_getNameMax0(JNIEnv *env, jobject this,
|
||||
return length != -1 ? length : (jlong)NAME_MAX;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(UnixFileSystem, initIDs, "()V"),
|
||||
NATIVE_METHOD(UnixFileSystem, canonicalize0, "(Ljava/lang/String;)Ljava/lang/String;"),
|
||||
NATIVE_METHOD(UnixFileSystem, getBooleanAttributes0, "(Ljava/lang/String;)I"),
|
||||
diff --git a/ojluni/src/main/native/UnixNativeDispatcher.c b/ojluni/src/main/native/UnixNativeDispatcher.c
|
||||
index 6710e13be51..47dc1213422 100644
|
||||
--- a/ojluni/src/main/native/UnixNativeDispatcher.c
|
||||
+++ b/ojluni/src/main/native/UnixNativeDispatcher.c
|
||||
@@ -1233,7 +1233,7 @@ Java_sun_nio_fs_UnixNativeDispatcher_getgrnam0(JNIEnv* env, jclass this,
|
||||
#define NATIVE_METHOD(className, functionName, signature) \
|
||||
{ #functionName, signature, (void*)(className ## _ ## functionName) }
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(Java_sun_nio_fs_UnixNativeDispatcher, getcwd, "()[B"),
|
||||
NATIVE_METHOD(Java_sun_nio_fs_UnixNativeDispatcher, dup, "(I)I"),
|
||||
NATIVE_METHOD(Java_sun_nio_fs_UnixNativeDispatcher, open0, "(JII)I"),
|
||||
diff --git a/ojluni/src/main/native/ZipFile.c b/ojluni/src/main/native/ZipFile.c
|
||||
index 314b6c7aa79..2abdede0ca3 100644
|
||||
--- a/ojluni/src/main/native/ZipFile.c
|
||||
+++ b/ojluni/src/main/native/ZipFile.c
|
||||
@@ -398,7 +398,7 @@ JarFile_getMetaInfEntryNames(JNIEnv *env, jobject obj)
|
||||
return result;
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ZipFile, getFileDescriptor, "(J)I"),
|
||||
NATIVE_METHOD(ZipFile, getEntry, "(J[BZ)J"),
|
||||
NATIVE_METHOD(ZipFile, freeEntry, "(JJ)V"),
|
||||
@@ -419,7 +419,7 @@ static JNINativeMethod gMethods[] = {
|
||||
NATIVE_METHOD(ZipFile, getZipMessage, "(J)Ljava/lang/String;"),
|
||||
};
|
||||
|
||||
-static JNINativeMethod gJarFileMethods[] = {
|
||||
+static const JNINativeMethod gJarFileMethods[] = {
|
||||
NATIVE_METHOD(JarFile, getMetaInfEntryNames, "()[Ljava/lang/String;"),
|
||||
};
|
||||
|
||||
diff --git a/ojluni/src/main/native/jdk_internal_misc_VM.cpp b/ojluni/src/main/native/jdk_internal_misc_VM.cpp
|
||||
index 8e413286798..9791a13b84f 100644
|
||||
--- a/ojluni/src/main/native/jdk_internal_misc_VM.cpp
|
||||
+++ b/ojluni/src/main/native/jdk_internal_misc_VM.cpp
|
||||
@@ -29,7 +29,7 @@ JNIEXPORT jlong JNICALL VM_getNanoTimeAdjustment(jlong offsetInSeconds) {
|
||||
return JVM_GetNanoTimeAdjustment(nullptr, nullptr, offsetInSeconds);
|
||||
}
|
||||
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
CRITICAL_NATIVE_METHOD(VM, getNanoTimeAdjustment, "(J)J"),
|
||||
};
|
||||
|
@ -0,0 +1,79 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Wed, 11 Sep 2019 13:46:38 +0300
|
||||
Subject: [PATCH] add parameter for avoiding full preload with exec
|
||||
|
||||
---
|
||||
api/module-lib-current.txt | 2 ++
|
||||
.../main/java/dalvik/system/ZygoteHooks.java | 24 +++++++++++++++++--
|
||||
2 files changed, 24 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/api/module-lib-current.txt b/api/module-lib-current.txt
|
||||
index 0ff15eaf273..5c3a486fff9 100644
|
||||
--- a/api/module-lib-current.txt
|
||||
+++ b/api/module-lib-current.txt
|
||||
@@ -365,7 +365,9 @@ package dalvik.system {
|
||||
public final class ZygoteHooks {
|
||||
method public static void gcAndFinalize();
|
||||
method public static boolean isIndefiniteThreadSuspensionSafe();
|
||||
+ method public static void onBeginPreload(boolean);
|
||||
method public static void onBeginPreload();
|
||||
+ method public static void onEndPreload(boolean);
|
||||
method public static void onEndPreload();
|
||||
method public static void postForkChild(int, boolean, boolean, String);
|
||||
method public static void postForkCommon();
|
||||
diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
index f1de769e528..961330837a5 100644
|
||||
--- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
+++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
@@ -66,7 +66,7 @@ public final class ZygoteHooks {
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
- public static void onBeginPreload() {
|
||||
+ public static void onBeginPreload(boolean fullPreload) {
|
||||
com.android.i18n.system.ZygoteHooks.onBeginPreload();
|
||||
|
||||
ICU.initializeCacheInZygote();
|
||||
@@ -87,13 +87,23 @@ public final class ZygoteHooks {
|
||||
}
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Called when the zygote begins preloading classes and data.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @SystemApi(client = MODULE_LIBRARIES)
|
||||
+ public static void onBeginPreload() {
|
||||
+ onBeginPreload(true);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Called when the zygote has completed preloading classes and data.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
- public static void onEndPreload() {
|
||||
+ public static void onEndPreload(boolean fullPreload) {
|
||||
com.android.i18n.system.ZygoteHooks.onEndPreload();
|
||||
|
||||
// Clone standard descriptors as originals closed / rebound during zygote post fork.
|
||||
@@ -102,6 +112,16 @@ public final class ZygoteHooks {
|
||||
FileDescriptor.err.cloneForFork();
|
||||
}
|
||||
|
||||
+ /**
|
||||
+ * Called when the zygote has completed preloading classes and data.
|
||||
+ *
|
||||
+ * @hide
|
||||
+ */
|
||||
+ @SystemApi(client = MODULE_LIBRARIES)
|
||||
+ public static void onEndPreload() {
|
||||
+ onEndPreload(true);
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Called after GC but before fork, it cleans stale cache entries in
|
||||
* BaseLocale and Locale, so to avoid the cleaning to happen in every
|
@ -0,0 +1,42 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Fri, 15 Oct 2021 00:00:10 +0300
|
||||
Subject: [PATCH] disable cache pinning for exec spawning
|
||||
|
||||
---
|
||||
.../src/main/java/dalvik/system/ZygoteHooks.java | 14 +++++++++-----
|
||||
1 file changed, 9 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
index 961330837a5..b36bd3f4a39 100644
|
||||
--- a/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
+++ b/dalvik/src/main/java/dalvik/system/ZygoteHooks.java
|
||||
@@ -67,11 +67,13 @@ public final class ZygoteHooks {
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
public static void onBeginPreload(boolean fullPreload) {
|
||||
- com.android.i18n.system.ZygoteHooks.onBeginPreload();
|
||||
+ if (fullPreload) {
|
||||
+ com.android.i18n.system.ZygoteHooks.onBeginPreload();
|
||||
|
||||
- ICU.initializeCacheInZygote();
|
||||
- DecimalFormatData.initializeCacheInZygote();
|
||||
- SimpleDateFormatData.initializeCacheInZygote();
|
||||
+ ICU.initializeCacheInZygote();
|
||||
+ DecimalFormatData.initializeCacheInZygote();
|
||||
+ SimpleDateFormatData.initializeCacheInZygote();
|
||||
+ }
|
||||
|
||||
// Look up JaCoCo on the boot classpath, if it exists. This will be used later for enabling
|
||||
// memory-mapped Java coverage.
|
||||
@@ -104,7 +106,9 @@ public final class ZygoteHooks {
|
||||
*/
|
||||
@SystemApi(client = MODULE_LIBRARIES)
|
||||
public static void onEndPreload(boolean fullPreload) {
|
||||
- com.android.i18n.system.ZygoteHooks.onEndPreload();
|
||||
+ if (fullPreload) {
|
||||
+ com.android.i18n.system.ZygoteHooks.onEndPreload();
|
||||
+ }
|
||||
|
||||
// Clone standard descriptors as originals closed / rebound during zygote post fork.
|
||||
FileDescriptor.in.cloneForFork();
|
@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Wed, 31 May 2023 12:38:29 -0400
|
||||
Subject: [PATCH] Migrate Private DNS preset modes to hostname-mode based
|
||||
|
||||
Credit: CalyxOS
|
||||
- Tommy Webb <tommy@calyxinstitute.org>
|
||||
https://review.calyxos.org/c/CalyxOS/platform_calyx-sdk/+/17311
|
||||
|
||||
Change-Id: Ie3990a6e789be22da0c7771d85ad71034ed334eb
|
||||
---
|
||||
.../LineageDatabaseHelper.java | 60 +++++++++++++++++++
|
||||
1 file changed, 60 insertions(+)
|
||||
|
||||
diff --git a/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java b/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
||||
index 2a77cec7..83322355 100644
|
||||
--- a/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
||||
+++ b/packages/LineageSettingsProvider/src/org/lineageos/lineagesettings/LineageDatabaseHelper.java
|
||||
@@ -120,6 +120,66 @@ public class LineageDatabaseHelper extends SQLiteOpenHelper{
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
+
|
||||
+ // DNS migration XXX: shouldn't be here
|
||||
+ final String currentPrivateDnsMode = Settings.Global.getString(
|
||||
+ mContext.getContentResolver(), Settings.Global.PRIVATE_DNS_MODE);
|
||||
+ if (!"off".equals(currentPrivateDnsMode) && !"hostname".equals(currentPrivateDnsMode) && !"opportunistic".equals(currentPrivateDnsMode)) {
|
||||
+ Log.d(TAG, "Performing migration for private dns presets");
|
||||
+ if ("adguard".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.adguard.com");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("appliedprivacy".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dot1.applied-privacy.net");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("cira".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "protected.canadianshield.cira.ca");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("cleanbrowsing".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "security-filter-dns.cleanbrowsing.org");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("cloudflare".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "security.cloudflare-dns.com");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("cznic".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "odvr.nic.cz");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ }else if ("google".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.google");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("mullvad".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "adblock.dns.mullvad.net");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("quadnine".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.quad9.net");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("restena".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "kaitain.restena.lu");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("switch".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "dns.switch.ch");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("twnic".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "101.101.101.101");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ } else if ("uncensoreddns".equals(currentPrivateDnsMode)) {
|
||||
+ ConnectivitySettingsManager.setPrivateDnsHostname(mContext, "anycast.censurfridns.dk");
|
||||
+ ConnectivitySettingsManager.setPrivateDnsMode(mContext,
|
||||
+ ConnectivitySettingsManager.PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
@ -0,0 +1,148 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sun, 13 Feb 2022 00:55:33 -0500
|
||||
Subject: [PATCH] allow toggling presidential alerts
|
||||
|
||||
---
|
||||
res/values/config.xml | 2 +-
|
||||
res/values/strings.xml | 2 ++
|
||||
res/xml/preferences.xml | 3 +--
|
||||
.../CellBroadcastAlertService.java | 4 ++--
|
||||
.../CellBroadcastChannelManager.java | 6 +++---
|
||||
.../cellbroadcastreceiver/CellBroadcastReceiver.java | 8 ++++++++
|
||||
.../cellbroadcastreceiver/CellBroadcastSettings.java | 11 ++++++++++-
|
||||
7 files changed, 27 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/res/values/config.xml b/res/values/config.xml
|
||||
index d678715e7..1e866e3ca 100644
|
||||
--- a/res/values/config.xml
|
||||
+++ b/res/values/config.xml
|
||||
@@ -22,7 +22,7 @@
|
||||
<!-- Whether to show main switch settings at the top -->
|
||||
<bool name="show_main_switch_settings">true</bool>
|
||||
<!-- Whether to show presidential alert settings -->
|
||||
- <bool name="show_presidential_alerts_settings">false</bool>
|
||||
+ <bool name="show_presidential_alerts_settings">true</bool>
|
||||
<!-- Whether to show extreme alert settings -->
|
||||
<bool name="show_extreme_alert_settings">true</bool>
|
||||
<!-- Whether to show severe alert settings -->
|
||||
diff --git a/res/values/strings.xml b/res/values/strings.xml
|
||||
index 66a8a306c..10d43df0a 100644
|
||||
--- a/res/values/strings.xml
|
||||
+++ b/res/values/strings.xml
|
||||
@@ -392,4 +392,6 @@
|
||||
<!-- Notification title and text when alerting user that their CB settings have changed -->
|
||||
<string name="notification_cb_settings_changed_title">Settings changed by carrier</string>
|
||||
<string name="notification_cb_settings_changed_text">Tap to see wireless emergency alert settings</string>
|
||||
+
|
||||
+ <string name="enable_cmas_presidential_alerts_summary_override">National warning messages.</string>
|
||||
</resources>
|
||||
diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml
|
||||
index fc0649e24..08c1ccf30 100644
|
||||
--- a/res/xml/preferences.xml
|
||||
+++ b/res/xml/preferences.xml
|
||||
@@ -45,9 +45,8 @@
|
||||
|
||||
<!-- Show checkbox for Presidential alerts in settings -->
|
||||
<SwitchPreference android:defaultValue="true"
|
||||
- android:enabled="false"
|
||||
android:key="enable_cmas_presidential_alerts"
|
||||
- android:summary="@string/enable_cmas_presidential_alerts_summary"
|
||||
+ android:summary="@string/enable_cmas_presidential_alerts_summary_override"
|
||||
android:title="@string/enable_cmas_presidential_alerts_title"/>
|
||||
|
||||
<!-- Enable CMAS Extreme Threat alerts -->
|
||||
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
|
||||
index 0f9a5ed16..d45b8f854 100644
|
||||
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
|
||||
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastAlertService.java
|
||||
@@ -575,8 +575,8 @@ public class CellBroadcastAlertService extends Service {
|
||||
}
|
||||
// CMAS warning types
|
||||
if (resourcesKey == R.array.cmas_presidential_alerts_channels_range_strings) {
|
||||
- // always enabled
|
||||
- return true;
|
||||
+ return emergencyAlertEnabled && checkAlertConfigEnabled(
|
||||
+ subId, CellBroadcastSettings.KEY_ENABLE_CMAS_PRESIDENTIAL_ALERTS, true);
|
||||
}
|
||||
if (resourcesKey == R.array.cmas_alert_extreme_channels_range_strings) {
|
||||
return emergencyAlertEnabled && checkAlertConfigEnabled(
|
||||
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java b/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
|
||||
index eaca6d741..e4cf7a509 100644
|
||||
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
|
||||
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastChannelManager.java
|
||||
@@ -279,9 +279,9 @@ public class CellBroadcastChannelManager {
|
||||
}
|
||||
break;
|
||||
case KEY_ALWAYS_ON:
|
||||
- if (value.equalsIgnoreCase("true")) {
|
||||
- mAlwaysOn = true;
|
||||
- }
|
||||
+ //if (value.equalsIgnoreCase("true")) {
|
||||
+ //mAlwaysOn = true;
|
||||
+ //}
|
||||
break;
|
||||
case KEY_SCREEN_ON_DURATION:
|
||||
mScreenOnDuration = Integer.parseInt(value);
|
||||
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
|
||||
index e8b55feb1..4b6541011 100644
|
||||
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
|
||||
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastReceiver.java
|
||||
@@ -660,6 +660,8 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
|
||||
break;
|
||||
|
||||
case CdmaSmsCbProgramData.OPERATION_CLEAR_CATEGORIES:
|
||||
+ tryCdmaSetCategory(mContext,
|
||||
+ CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT, false);
|
||||
tryCdmaSetCategory(mContext,
|
||||
CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT, false);
|
||||
tryCdmaSetCategory(mContext,
|
||||
@@ -687,6 +689,12 @@ public class CellBroadcastReceiver extends BroadcastReceiver {
|
||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
switch (category) {
|
||||
+ case CdmaSmsCbProgramData.CATEGORY_CMAS_PRESIDENTIAL_LEVEL_ALERT:
|
||||
+ sharedPrefs.edit().putBoolean(
|
||||
+ CellBroadcastSettings.KEY_ENABLE_CMAS_PRESIDENTIAL_ALERTS, enable)
|
||||
+ .apply();
|
||||
+ break;
|
||||
+
|
||||
case CdmaSmsCbProgramData.CATEGORY_CMAS_EXTREME_THREAT:
|
||||
sharedPrefs.edit().putBoolean(
|
||||
CellBroadcastSettings.KEY_ENABLE_CMAS_EXTREME_THREAT_ALERTS, enable)
|
||||
diff --git a/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java b/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java
|
||||
index f5484e24c..7e94aab04 100644
|
||||
--- a/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java
|
||||
+++ b/src/com/android/cellbroadcastreceiver/CellBroadcastSettings.java
|
||||
@@ -505,6 +505,9 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity {
|
||||
if (mAreaUpdateInfoCheckBox != null) {
|
||||
mAreaUpdateInfoCheckBox.setOnPreferenceChangeListener(startConfigServiceListener);
|
||||
}
|
||||
+ if (mPresidentialCheckBox != null) {
|
||||
+ mPresidentialCheckBox.setOnPreferenceChangeListener(startConfigServiceListener);
|
||||
+ }
|
||||
if (mExtremeCheckBox != null) {
|
||||
mExtremeCheckBox.setOnPreferenceChangeListener(startConfigServiceListener);
|
||||
}
|
||||
@@ -614,7 +617,9 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity {
|
||||
|
||||
if (mPresidentialCheckBox != null) {
|
||||
mPresidentialCheckBox.setVisible(
|
||||
- res.getBoolean(R.bool.show_presidential_alerts_settings));
|
||||
+ res.getBoolean(R.bool.show_presidential_alerts_settings)
|
||||
+ && !channelManager.getCellBroadcastChannelRanges(
|
||||
+ R.array.cmas_presidential_alerts_channels_range_strings).isEmpty());
|
||||
if (isWatch && !mPresidentialCheckBox.isVisible()) {
|
||||
preferenceScreen.removePreference(mPresidentialCheckBox);
|
||||
}
|
||||
@@ -826,6 +831,10 @@ public class CellBroadcastSettings extends CollapsingToolbarBaseActivity {
|
||||
private void setAlertsEnabled(boolean alertsEnabled) {
|
||||
Resources res = CellBroadcastSettings.getResourcesForDefaultSubId(getContext());
|
||||
|
||||
+ if (mPresidentialCheckBox != null) {
|
||||
+ mPresidentialCheckBox.setEnabled(alertsEnabled);
|
||||
+ mPresidentialCheckBox.setChecked(alertsEnabled);
|
||||
+ }
|
||||
if (mSevereCheckBox != null) {
|
||||
mSevereCheckBox.setEnabled(alertsEnabled);
|
||||
mSevereCheckBox.setChecked(alertsEnabled);
|
@ -0,0 +1,40 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Luca Stefani <luca.stefani.ge1@gmail.com>
|
||||
Date: Thu, 20 Jan 2022 18:43:00 +0530
|
||||
Subject: [PATCH] Delay FCM registration until it's actually required
|
||||
|
||||
Most users / carriers don't need this, so let's avoid registering it for everyone.
|
||||
|
||||
Change-Id: I3f57ce0a1184a510d09638c703236989f8596c5f
|
||||
---
|
||||
.../fcm/FcmRegistrationService.java | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/com/android/imsserviceentitlement/fcm/FcmRegistrationService.java b/src/com/android/imsserviceentitlement/fcm/FcmRegistrationService.java
|
||||
index 184740d..cb777a3 100644
|
||||
--- a/src/com/android/imsserviceentitlement/fcm/FcmRegistrationService.java
|
||||
+++ b/src/com/android/imsserviceentitlement/fcm/FcmRegistrationService.java
|
||||
@@ -30,6 +30,7 @@ import com.android.imsserviceentitlement.R;
|
||||
import com.android.imsserviceentitlement.job.JobManager;
|
||||
import com.android.imsserviceentitlement.utils.TelephonyUtils;
|
||||
|
||||
+import com.google.common.collect.ImmutableSet;
|
||||
import com.google.firebase.FirebaseApp;
|
||||
import com.google.firebase.FirebaseOptions;
|
||||
import com.google.firebase.iid.FirebaseInstanceId;
|
||||
@@ -110,8 +111,14 @@ public class FcmRegistrationService extends JobService {
|
||||
* The token changes when the InstanceID becomes invalid (e.g. app data is deleted).
|
||||
*/
|
||||
protected void onHandleWork(JobParameters params) {
|
||||
+ ImmutableSet<Integer> subIds = TelephonyUtils.getSubIdsWithFcmSupported(this);
|
||||
+ if (subIds.size() == 0 && mFakeInstanceID == null) {
|
||||
+ jobFinished(params, false);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
boolean wantsReschedule = false;
|
||||
- for (int subId : TelephonyUtils.getSubIdsWithFcmSupported(this)) {
|
||||
+ for (int subId : subIds) {
|
||||
if (!updateFcmToken(getFirebaseInstanceId(), subId)) {
|
||||
wantsReschedule = true;
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Tue, 14 Apr 2020 17:03:26 -0400
|
||||
Subject: [PATCH] Remove analytics
|
||||
|
||||
Change-Id: Ic01c97d6ceac8d324609763973639b41b4581a76
|
||||
---
|
||||
AndroidManifest.xml | 22 ----------------------
|
||||
proguard.flags | 1 -
|
||||
res/values/config.xml | 3 ---
|
||||
res/values/strings.xml | 22 ----------------------
|
||||
res/xml/parts_catalog.xml | 5 -----
|
||||
res/xml/trust_preferences.xml | 3 ---
|
||||
6 files changed, 56 deletions(-)
|
||||
|
||||
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||||
index 35574d2..ea68c4f 100644
|
||||
--- a/AndroidManifest.xml
|
||||
+++ b/AndroidManifest.xml
|
||||
@@ -269,28 +269,6 @@
|
||||
android:resource="@string/summary_empty" />
|
||||
</activity-alias>
|
||||
|
||||
- <!-- Anonymous Statistics -->
|
||||
- <receiver
|
||||
- android:name=".lineagestats.ReportingServiceManager"
|
||||
- android:enabled="true"
|
||||
- android:exported="false"
|
||||
- android:label="ReportingServiceManager">
|
||||
- <intent-filter>
|
||||
- <action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
- <action android:name="org.lineageos.lineageparts.action.TRIGGER_REPORT_METRICS" />
|
||||
- </intent-filter>
|
||||
- </receiver>
|
||||
-
|
||||
- <service
|
||||
- android:name=".lineagestats.ReportingService"
|
||||
- android:enabled="true"
|
||||
- android:exported="false"
|
||||
- android:label="ReportingService" />
|
||||
-
|
||||
- <service
|
||||
- android:name=".lineagestats.StatsUploadJobService"
|
||||
- android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
-
|
||||
<activity
|
||||
android:name=".profiles.NFCProfile"
|
||||
android:exported="true">
|
||||
diff --git a/proguard.flags b/proguard.flags
|
||||
index cfbdae3..8991f2b 100644
|
||||
--- a/proguard.flags
|
||||
+++ b/proguard.flags
|
||||
@@ -11,7 +11,6 @@
|
||||
-keep class org.lineageos.lineageparts.gestures.*
|
||||
-keep class org.lineageos.lineageparts.hardware.*
|
||||
-keep class org.lineageos.lineageparts.input.*
|
||||
--keep class org.lineageos.lineageparts.lineagestats.*
|
||||
-keep class org.lineageos.lineageparts.livedisplay.*
|
||||
-keep class org.lineageos.lineageparts.notificationlight.*
|
||||
-keep class org.lineageos.lineageparts.power.*
|
||||
diff --git a/res/values/config.xml b/res/values/config.xml
|
||||
index adfcaa4..4c575f2 100644
|
||||
--- a/res/values/config.xml
|
||||
+++ b/res/values/config.xml
|
||||
@@ -6,9 +6,6 @@
|
||||
-->
|
||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||
|
||||
- <!-- Metrics server endpoint -->
|
||||
- <string name="stats_lineage_url">https://stats.lineageos.org/api/v1/stats</string>
|
||||
-
|
||||
<!-- Default action ids for a device's touchscreen gestures
|
||||
The array should be sorted in the same order as the
|
||||
touchscreen gestures advertised by the device's LineageHW impl. -->
|
||||
diff --git a/res/values/strings.xml b/res/values/strings.xml
|
||||
index e11fdc4..edad29e 100644
|
||||
--- a/res/values/strings.xml
|
||||
+++ b/res/values/strings.xml
|
||||
@@ -541,28 +541,6 @@
|
||||
<b>Total commits:</b> <xliff:g id="total_commits">%2$s</xliff:g><br/><br/>
|
||||
<b>Last update:</b> <xliff:g id="date">%3$s</xliff:g>]]></string>
|
||||
|
||||
- <!-- Anonymous Statistics #Lineage -->
|
||||
- <!-- About device screen, list item title. Takes the user to the screen about opting in or out of anonymous statistics. -->
|
||||
- <string name="anonymous_statistics_title">LineageOS statistics</string>
|
||||
- <string name="anonymous_statistics_summary">Help make LineageOS better by opting into anonymous statistics reporting</string>
|
||||
- <string name="anonymous_statistics_warning_title">About</string>
|
||||
- <string name="anonymous_statistics_warning">Opting into LineageOS Statistics will allow non-personal data to be submitted to the
|
||||
- developers of LineageOS to track unique installations across devices. The information submitted includes an unique identifier,
|
||||
- which does not compromise your privacy or personal data. The data is submitted during each boot.\n\nFor an example of the data that is submitted, tap on Preview Data.</string>
|
||||
- <string name="enable_reporting_title">Enable reporting</string>
|
||||
- <string name="preview_data_title">Preview data</string>
|
||||
- <string name="view_stats_title">View stats</string>
|
||||
- <string name="anonymous_learn_more">Learn more</string>
|
||||
-
|
||||
- <!-- Anonymous Statistics - Preview -->
|
||||
- <string name="preview_id_title">Unique ID</string>
|
||||
- <string name="preview_device_title">Device</string>
|
||||
- <string name="preview_version_title">Version</string>
|
||||
- <string name="preview_country_title">Country</string>
|
||||
- <string name="preview_carrier_title">Carrier</string>
|
||||
- <string name="stats_collection_title">Stats collection</string>
|
||||
- <string name="stats_collection_summary">Allow installation metrics and device statistics to be collected</string>
|
||||
-
|
||||
<!-- Display : Rotation -->
|
||||
<string name="accelerometer_title">Auto-rotate screen</string>
|
||||
<string name="display_rotation_title">Rotation settings</string>
|
||||
diff --git a/res/xml/parts_catalog.xml b/res/xml/parts_catalog.xml
|
||||
index d6b19c0..e356517 100644
|
||||
--- a/res/xml/parts_catalog.xml
|
||||
+++ b/res/xml/parts_catalog.xml
|
||||
@@ -64,11 +64,6 @@
|
||||
android:fragment="org.lineageos.lineageparts.statusbar.StatusBarSettings"
|
||||
lineage:xmlRes="@xml/status_bar_settings" />
|
||||
|
||||
- <part android:key="lineagestats"
|
||||
- android:title="@string/anonymous_statistics_title"
|
||||
- android:fragment="org.lineageos.lineageparts.lineagestats.AnonymousStats"
|
||||
- lineage:xmlRes="@xml/anonymous_stats" />
|
||||
-
|
||||
<part android:key="power_menu"
|
||||
android:title="@string/power_menu_title"
|
||||
android:fragment="org.lineageos.lineageparts.input.PowerMenuActions"
|
||||
diff --git a/res/xml/trust_preferences.xml b/res/xml/trust_preferences.xml
|
||||
index 021533b..5767cf4 100644
|
||||
--- a/res/xml/trust_preferences.xml
|
||||
+++ b/res/xml/trust_preferences.xml
|
||||
@@ -36,9 +36,6 @@
|
||||
android:entryValues="@array/trust_restrict_usb_values"
|
||||
android:defaultValue="0" />
|
||||
|
||||
- <lineageos.preference.LineagePartsPreference
|
||||
- android:key="lineagestats" />
|
||||
-
|
||||
<ListPreference
|
||||
android:key="sms_security_check_limit"
|
||||
android:defaultValue="30"
|
@ -0,0 +1,50 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Micay <danielmicay@gmail.com>
|
||||
Date: Sun, 17 Mar 2019 20:58:37 -0400
|
||||
Subject: [PATCH] constify JNINativeMethod tables
|
||||
|
||||
---
|
||||
nci/jni/NativeNfcManager.cpp | 2 +-
|
||||
nci/jni/NativeNfcTag.cpp | 2 +-
|
||||
nci/jni/NativeP2pDevice.cpp | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/nci/jni/NativeNfcManager.cpp b/nci/jni/NativeNfcManager.cpp
|
||||
index 603d8ab6..8fc42860 100644
|
||||
--- a/nci/jni/NativeNfcManager.cpp
|
||||
+++ b/nci/jni/NativeNfcManager.cpp
|
||||
@@ -1994,7 +1994,7 @@ static jbyteArray nfcManager_doGetRoutingTable(JNIEnv* e, jobject o) {
|
||||
** JNI functions for android-4.0.1_r1
|
||||
**
|
||||
*****************************************************************************/
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"doDownload", "()Z", (void*)nfcManager_doDownload},
|
||||
|
||||
{"initializeNativeStructure", "()Z", (void*)nfcManager_initNativeStruc},
|
||||
diff --git a/nci/jni/NativeNfcTag.cpp b/nci/jni/NativeNfcTag.cpp
|
||||
index d9c59953..a1eb7953 100644
|
||||
--- a/nci/jni/NativeNfcTag.cpp
|
||||
+++ b/nci/jni/NativeNfcTag.cpp
|
||||
@@ -1739,7 +1739,7 @@ void nativeNfcTag_releaseRfInterfaceMutexLock() {
|
||||
** JNI functions for Android 4.0.3
|
||||
**
|
||||
*****************************************************************************/
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"doConnect", "(I)I", (void*)nativeNfcTag_doConnect},
|
||||
{"doDisconnect", "()Z", (void*)nativeNfcTag_doDisconnect},
|
||||
{"doReconnect", "()I", (void*)nativeNfcTag_doReconnect},
|
||||
diff --git a/nci/jni/NativeP2pDevice.cpp b/nci/jni/NativeP2pDevice.cpp
|
||||
index 23f5db41..396c6d0c 100644
|
||||
--- a/nci/jni/NativeP2pDevice.cpp
|
||||
+++ b/nci/jni/NativeP2pDevice.cpp
|
||||
@@ -58,7 +58,7 @@ static jboolean nativeP2pDeviceDoSend(JNIEnv*, jobject, jbyteArray) {
|
||||
** Description: JNI functions
|
||||
**
|
||||
*****************************************************************************/
|
||||
-static JNINativeMethod gMethods[] = {
|
||||
+static const JNINativeMethod gMethods[] = {
|
||||
{"doConnect", "()Z", (void*)nativeP2pDeviceDoConnect},
|
||||
{"doDisconnect", "()Z", (void*)nativeP2pDeviceDoDisconnect},
|
||||
{"doTransceive", "([B)[B", (void*)nativeP2pDeviceDoTransceive},
|
@ -0,0 +1,178 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Fri, 3 Sep 2021 08:52:48 -0400
|
||||
Subject: [PATCH] Remove analytics
|
||||
|
||||
Change-Id: I044dd6b137b8a1d4a6dde3a63c0aaa454309341f
|
||||
---
|
||||
res/layout/setup_lineage_settings.xml | 29 -----------------
|
||||
.../lineageos/setupwizard/FinishActivity.java | 13 --------
|
||||
.../setupwizard/LineageSettingsActivity.java | 32 -------------------
|
||||
.../lineageos/setupwizard/SetupWizardApp.java | 1 -
|
||||
4 files changed, 75 deletions(-)
|
||||
|
||||
diff --git a/res/layout/setup_lineage_settings.xml b/res/layout/setup_lineage_settings.xml
|
||||
index 6c99b30..ea2094f 100644
|
||||
--- a/res/layout/setup_lineage_settings.xml
|
||||
+++ b/res/layout/setup_lineage_settings.xml
|
||||
@@ -33,35 +33,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
- <!-- Whether or not to enable metrics -->
|
||||
- <LinearLayout
|
||||
- android:id="@+id/metrics"
|
||||
- android:orientation="horizontal"
|
||||
- android:layout_width="match_parent"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:paddingLeft="@dimen/location_margin_left"
|
||||
- android:paddingRight="@dimen/content_margin_right"
|
||||
- android:background="?android:attr/selectableItemBackground"
|
||||
- android:clickable="true">
|
||||
-
|
||||
-
|
||||
- <CheckBox
|
||||
- android:id="@+id/enable_metrics_checkbox"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:duplicateParentState="true"
|
||||
- android:clickable="false"
|
||||
- style="@style/SudCheckBox.Multiline" />
|
||||
-
|
||||
- <TextView
|
||||
- android:id="@+id/enable_metrics_summary"
|
||||
- android:layout_width="wrap_content"
|
||||
- android:layout_height="wrap_content"
|
||||
- android:text="@string/services_metrics_label"
|
||||
- style="@style/SudCheckBox.Multiline" />
|
||||
-
|
||||
- </LinearLayout>
|
||||
-
|
||||
<!-- Checkbox for using on-screen nav keys -->
|
||||
<LinearLayout
|
||||
android:id="@+id/nav_keys"
|
||||
diff --git a/src/org/lineageos/setupwizard/FinishActivity.java b/src/org/lineageos/setupwizard/FinishActivity.java
|
||||
index 0427a4d..11348fe 100644
|
||||
--- a/src/org/lineageos/setupwizard/FinishActivity.java
|
||||
+++ b/src/org/lineageos/setupwizard/FinishActivity.java
|
||||
@@ -14,7 +14,6 @@ import static org.lineageos.setupwizard.SetupWizardApp.ACTION_FINISHED;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ACTION_SETUP_COMPLETE;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.ENABLE_RECOVERY_UPDATE;
|
||||
-import static org.lineageos.setupwizard.SetupWizardApp.KEY_SEND_METRICS;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.NAVIGATION_OPTION_KEY;
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.UPDATE_RECOVERY_PROP;
|
||||
@@ -172,7 +171,6 @@ public class FinishActivity extends BaseSetupWizardActivity {
|
||||
}
|
||||
|
||||
private void completeSetup() {
|
||||
- handleEnableMetrics(mSetupWizardApp);
|
||||
handleNavKeys(mSetupWizardApp);
|
||||
handleRecoveryUpdate(mSetupWizardApp);
|
||||
handleNavigationOption(mSetupWizardApp);
|
||||
@@ -185,17 +183,6 @@ public class FinishActivity extends BaseSetupWizardActivity {
|
||||
Log.i(TAG, "Setup complete!");
|
||||
}
|
||||
|
||||
- private static void handleEnableMetrics(SetupWizardApp setupWizardApp) {
|
||||
- Bundle privacyData = setupWizardApp.getSettingsBundle();
|
||||
- if (privacyData != null
|
||||
- && privacyData.containsKey(KEY_SEND_METRICS)) {
|
||||
- LineageSettings.Secure.putInt(setupWizardApp.getContentResolver(),
|
||||
- LineageSettings.Secure.STATS_COLLECTION,
|
||||
- privacyData.getBoolean(KEY_SEND_METRICS)
|
||||
- ? 1 : 0);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
private static void handleNavKeys(SetupWizardApp setupWizardApp) {
|
||||
if (setupWizardApp.getSettingsBundle().containsKey(DISABLE_NAV_KEYS)) {
|
||||
writeDisableNavkeysOption(setupWizardApp,
|
||||
diff --git a/src/org/lineageos/setupwizard/LineageSettingsActivity.java b/src/org/lineageos/setupwizard/LineageSettingsActivity.java
|
||||
index 974bd15..0632e32 100644
|
||||
--- a/src/org/lineageos/setupwizard/LineageSettingsActivity.java
|
||||
+++ b/src/org/lineageos/setupwizard/LineageSettingsActivity.java
|
||||
@@ -7,7 +7,6 @@
|
||||
package org.lineageos.setupwizard;
|
||||
|
||||
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
|
||||
-import static org.lineageos.setupwizard.SetupWizardApp.KEY_SEND_METRICS;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
@@ -25,17 +24,10 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
|
||||
private SetupWizardApp mSetupWizardApp;
|
||||
|
||||
- private CheckBox mMetrics;
|
||||
private CheckBox mNavKeys;
|
||||
|
||||
private boolean mSupportsKeyDisabler = false;
|
||||
|
||||
- private final View.OnClickListener mMetricsClickListener = view -> {
|
||||
- boolean checked = !mMetrics.isChecked();
|
||||
- mMetrics.setChecked(checked);
|
||||
- mSetupWizardApp.getSettingsBundle().putBoolean(KEY_SEND_METRICS, checked);
|
||||
- };
|
||||
-
|
||||
private final View.OnClickListener mNavKeysClickListener = view -> {
|
||||
boolean checked = !mNavKeys.isChecked();
|
||||
mNavKeys.setChecked(checked);
|
||||
@@ -56,20 +48,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
privacyPolicy, policySummary);
|
||||
getGlifLayout().setDescriptionText(servicesFullDescription);
|
||||
|
||||
- View metricsRow = findViewById(R.id.metrics);
|
||||
- metricsRow.setOnClickListener(mMetricsClickListener);
|
||||
- metricsRow.requestFocus();
|
||||
- String metricsHelpImproveLineage =
|
||||
- getString(R.string.services_help_improve_cm, os_name);
|
||||
- String metricsSummary = getString(R.string.services_metrics_label,
|
||||
- metricsHelpImproveLineage, os_name, os_name);
|
||||
- final SpannableStringBuilder metricsSpan = new SpannableStringBuilder(metricsSummary);
|
||||
- metricsSpan.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD),
|
||||
- 0, metricsHelpImproveLineage.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
- TextView metrics = findViewById(R.id.enable_metrics_summary);
|
||||
- metrics.setText(metricsSpan);
|
||||
- mMetrics = findViewById(R.id.enable_metrics_checkbox);
|
||||
-
|
||||
View navKeysRow = findViewById(R.id.nav_keys);
|
||||
navKeysRow.setOnClickListener(mNavKeysClickListener);
|
||||
mNavKeys = findViewById(R.id.nav_keys_checkbox);
|
||||
@@ -86,7 +64,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateDisableNavkeysOption();
|
||||
- updateMetricsOption();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,15 +81,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
|
||||
return R.drawable.ic_features;
|
||||
}
|
||||
|
||||
- private void updateMetricsOption() {
|
||||
- final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
|
||||
- boolean metricsChecked =
|
||||
- !myPageBundle.containsKey(KEY_SEND_METRICS) || myPageBundle
|
||||
- .getBoolean(KEY_SEND_METRICS);
|
||||
- mMetrics.setChecked(metricsChecked);
|
||||
- myPageBundle.putBoolean(KEY_SEND_METRICS, metricsChecked);
|
||||
- }
|
||||
-
|
||||
private void updateDisableNavkeysOption() {
|
||||
if (mSupportsKeyDisabler) {
|
||||
final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
|
||||
diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java
|
||||
index 9be3b10..d7aa052 100644
|
||||
--- a/src/org/lineageos/setupwizard/SetupWizardApp.java
|
||||
+++ b/src/org/lineageos/setupwizard/SetupWizardApp.java
|
||||
@@ -44,7 +44,6 @@ public class SetupWizardApp extends Application {
|
||||
public static final String EXTRA_PREFS_SET_BACK_TEXT = "extra_prefs_set_back_text";
|
||||
public static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
|
||||
|
||||
- public static final String KEY_SEND_METRICS = "send_metrics";
|
||||
public static final String DISABLE_NAV_KEYS = "disable_nav_keys";
|
||||
public static final String ENABLE_RECOVERY_UPDATE = "enable_recovery_update";
|
||||
public static final String UPDATE_RECOVERY_PROP = "persist.vendor.recovery_update";
|
@ -0,0 +1,92 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Davide Garberi <dade.garberi@gmail.com>
|
||||
Date: Wed, 12 Jul 2023 15:55:29 +0200
|
||||
Subject: [PATCH] Launcher3: Allow toggling monochrome icons for all apps
|
||||
|
||||
* This feature has been added by Google in Android 13 QPR2, but
|
||||
hasn't been enabled by default
|
||||
* Instead of forcing it to always enabled, add a toggle so that
|
||||
users can choose whether they want it or not.
|
||||
|
||||
Change-Id: I6bf7aa4aca22f80231b06123a9c5fd0386bde851
|
||||
---
|
||||
res/values/lineage_strings.xml | 4 ++++
|
||||
res/xml/launcher_preferences.xml | 7 +++++++
|
||||
src/com/android/launcher3/InvariantDeviceProfile.java | 5 +++++
|
||||
src/com/android/launcher3/icons/LauncherIcons.java | 3 ++-
|
||||
4 files changed, 18 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/res/values/lineage_strings.xml b/res/values/lineage_strings.xml
|
||||
index dd03335495..87f58a47c9 100644
|
||||
--- a/res/values/lineage_strings.xml
|
||||
+++ b/res/values/lineage_strings.xml
|
||||
@@ -39,6 +39,10 @@
|
||||
<string name="pref_themed_icons_title">Use themed icons in drawer</string>
|
||||
<string name="pref_themed_icons_summary">Follow themed icons used on home screen</string>
|
||||
|
||||
+ <!-- Force monocrome icons -->
|
||||
+ <string name="pref_force_mono_icons_title">Force monochrome icons</string>
|
||||
+ <string name="pref_force_mono_icons_summary">Force monochrome icons for apps that don\'t support them natively</string>
|
||||
+
|
||||
<!-- Hide labels -->
|
||||
<string name="desktop_show_labels">Show icon labels on desktop</string>
|
||||
<string name="drawer_show_labels">Show icon labels in drawer</string>
|
||||
diff --git a/res/xml/launcher_preferences.xml b/res/xml/launcher_preferences.xml
|
||||
index 83ef5b3bd2..a10c0f5365 100644
|
||||
--- a/res/xml/launcher_preferences.xml
|
||||
+++ b/res/xml/launcher_preferences.xml
|
||||
@@ -84,6 +84,13 @@
|
||||
android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
|
||||
+ <SwitchPreference
|
||||
+ android:key="pref_force_mono_icons"
|
||||
+ android:title="@string/pref_force_mono_icons_title"
|
||||
+ android:summary="@string/pref_force_mono_icons_summary"
|
||||
+ android:defaultValue="false"
|
||||
+ android:persistent="true" />
|
||||
+
|
||||
<SwitchPreference
|
||||
android:key="pref_desktop_show_labels"
|
||||
android:title="@string/desktop_show_labels"
|
||||
diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java
|
||||
index 6e03a40ce2..65708a349e 100644
|
||||
--- a/src/com/android/launcher3/InvariantDeviceProfile.java
|
||||
+++ b/src/com/android/launcher3/InvariantDeviceProfile.java
|
||||
@@ -94,10 +94,13 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
|
||||
private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;
|
||||
|
||||
public static final String KEY_ALLAPPS_THEMED_ICONS = "pref_allapps_themed_icons";
|
||||
+ public static final String KEY_FORCE_MONO_ICONS = "pref_force_mono_icons";
|
||||
public static final String KEY_SHOW_DESKTOP_LABELS = "pref_desktop_show_labels";
|
||||
public static final String KEY_SHOW_DRAWER_LABELS = "pref_drawer_show_labels";
|
||||
public static final String KEY_WORKSPACE_LOCK = "pref_workspace_lock";
|
||||
|
||||
+ public static boolean mPrefForceMonoIcons;
|
||||
+
|
||||
// Constants that affects the interpolation curve between statically defined device profile
|
||||
// buckets.
|
||||
private static final float KNEARESTNEIGHBOR = 3;
|
||||
@@ -356,6 +359,8 @@ public class InvariantDeviceProfile implements OnSharedPreferenceChangeListener
|
||||
@Override
|
||||
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) {
|
||||
switch (key) {
|
||||
+ case KEY_FORCE_MONO_ICONS:
|
||||
+ mPrefForceMonoIcons = prefs.getBoolean(key, false);
|
||||
case KEY_ALLAPPS_THEMED_ICONS:
|
||||
case KEY_SHOW_DESKTOP_LABELS:
|
||||
case KEY_SHOW_DRAWER_LABELS:
|
||||
diff --git a/src/com/android/launcher3/icons/LauncherIcons.java b/src/com/android/launcher3/icons/LauncherIcons.java
|
||||
index a15348bb57..920294ef57 100644
|
||||
--- a/src/com/android/launcher3/icons/LauncherIcons.java
|
||||
+++ b/src/com/android/launcher3/icons/LauncherIcons.java
|
||||
@@ -103,7 +103,8 @@ public class LauncherIcons extends BaseIconFactory implements AutoCloseable {
|
||||
@Override
|
||||
protected Drawable getMonochromeDrawable(Drawable base) {
|
||||
Drawable mono = super.getMonochromeDrawable(base);
|
||||
- if (mono != null || !ENABLE_FORCED_MONO_ICON.get()) {
|
||||
+ if (mono != null || (!ENABLE_FORCED_MONO_ICON.get() &&
|
||||
+ !InvariantDeviceProfile.mPrefForceMonoIcons)) {
|
||||
return mono;
|
||||
}
|
||||
if (mMonochromeIconFactory == null) {
|
@ -0,0 +1,33 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Thu, 20 Sep 2018 16:43:46 -0400
|
||||
Subject: [PATCH] Switch to our update server
|
||||
|
||||
Change-Id: I26dc2942736cf0cfe4e7b92ddfdd04b9d74dbae5
|
||||
---
|
||||
.../main/java/org/lineageos/updater/misc/Utils.java | 11 ++---------
|
||||
1 file changed, 2 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/misc/Utils.java b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
index b7ba720..f3d334b 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
@@ -155,16 +155,9 @@ public class Utils {
|
||||
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
|
||||
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
|
||||
SystemProperties.get(Constants.PROP_DEVICE));
|
||||
- String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase(Locale.ROOT);
|
||||
+ String server = "0OTA_SERVER_CLEARNET0";
|
||||
|
||||
- String serverUrl = SystemProperties.get(Constants.PROP_UPDATER_URI);
|
||||
- if (serverUrl.trim().isEmpty()) {
|
||||
- serverUrl = context.getString(R.string.updater_server_url);
|
||||
- }
|
||||
-
|
||||
- return serverUrl.replace("{device}", device)
|
||||
- .replace("{type}", type)
|
||||
- .replace("{incr}", incrementalVersion);
|
||||
+ return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion;
|
||||
}
|
||||
|
||||
public static String getUpgradeBlockedURL(Context context) {
|
@ -0,0 +1,397 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Thu, 20 Sep 2018 21:44:53 -0400
|
||||
Subject: [PATCH] Add support for routing over Tor
|
||||
|
||||
Change-Id: Ibfe080c3d801af34fb64fda1b6b8f4f39a2b1ccf
|
||||
---
|
||||
app/src/main/AndroidManifest.xml | 4 ++
|
||||
.../lineageos/updater/UpdatesActivity.java | 12 ++++
|
||||
.../updater/UpdatesCheckReceiver.java | 4 ++
|
||||
.../updater/controller/UpdaterController.java | 8 +++
|
||||
.../updater/download/DownloadClient.java | 8 ++-
|
||||
.../download/HttpURLConnectionClient.java | 27 ++++++--
|
||||
.../org/lineageos/updater/misc/Constants.java | 1 +
|
||||
.../org/lineageos/updater/misc/Utils.java | 65 +++++++++++++++++++
|
||||
.../main/res/layout/preferences_dialog.xml | 8 +++
|
||||
app/src/main/res/values/strings.xml | 2 +
|
||||
10 files changed, 134 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
|
||||
index 80fd2bc..02d2b53 100644
|
||||
--- a/app/src/main/AndroidManifest.xml
|
||||
+++ b/app/src/main/AndroidManifest.xml
|
||||
@@ -14,6 +14,10 @@
|
||||
<uses-permission android:name="android.permission.START_ACTIVITIES_FROM_BACKGROUND" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
+ <queries>
|
||||
+ <package android:name="org.torproject.android" />
|
||||
+ </queries>
|
||||
+
|
||||
<application
|
||||
android:allowBackup="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
index 25ca0b8..4dbc077 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
@@ -473,10 +473,14 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
|
||||
final DownloadClient downloadClient;
|
||||
try {
|
||||
+ if(Utils.isOnionRoutingEnabled(getApplicationContext())) {
|
||||
+ Utils.requestStartOrbot(getApplicationContext());
|
||||
+ }
|
||||
downloadClient = new DownloadClient.Builder()
|
||||
.setUrl(url)
|
||||
.setDestination(jsonFileTmp)
|
||||
.setDownloadCallback(callback)
|
||||
+ .setUseOnionRouting(Utils.isOnionRoutingEnabled(getApplicationContext()))
|
||||
.build();
|
||||
} catch (IOException exception) {
|
||||
Log.e(TAG, "Could not build download client");
|
||||
@@ -580,6 +584,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
private void showPreferencesDialog() {
|
||||
View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null);
|
||||
Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval);
|
||||
+ SwitchCompat onionRouting = view.findViewById(R.id.preferences_onion_routing);
|
||||
SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates);
|
||||
SwitchCompat meteredNetworkWarning = view.findViewById(
|
||||
R.id.preferences_metered_network_warning);
|
||||
@@ -592,6 +597,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this));
|
||||
+ onionRouting.setChecked(prefs.getBoolean(Constants.PREF_ONION_ROUTING, false));
|
||||
autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false));
|
||||
meteredNetworkWarning.setChecked(prefs.getBoolean(Constants.PREF_METERED_NETWORK_WARNING,
|
||||
prefs.getBoolean(Constants.PREF_MOBILE_DATA_WARNING, true)));
|
||||
@@ -632,6 +638,8 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
prefs.edit()
|
||||
.putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL,
|
||||
autoCheckInterval.getSelectedItemPosition())
|
||||
+ .putBoolean(Constants.PREF_ONION_ROUTING,
|
||||
+ onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext()))
|
||||
.putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked())
|
||||
.putBoolean(Constants.PREF_METERED_NETWORK_WARNING,
|
||||
meteredNetworkWarning.isChecked())
|
||||
@@ -645,6 +653,10 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
UpdatesCheckReceiver.cancelUpdatesCheck(this);
|
||||
}
|
||||
|
||||
+ if(onionRouting.isChecked() && !Utils.isOrbotInstalled(getApplicationContext())) {
|
||||
+ showSnackbar(R.string.snack_orbot_not_available, Snackbar.LENGTH_LONG);
|
||||
+ }
|
||||
+
|
||||
if (Utils.isABDevice()) {
|
||||
boolean enableABPerfMode = abPerfMode.isChecked();
|
||||
mUpdaterService.getUpdaterController().setPerformanceMode(enableABPerfMode);
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/UpdatesCheckReceiver.java b/app/src/main/java/org/lineageos/updater/UpdatesCheckReceiver.java
|
||||
index 9f45423..382fbd4 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/UpdatesCheckReceiver.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/UpdatesCheckReceiver.java
|
||||
@@ -110,10 +110,14 @@ public class UpdatesCheckReceiver extends BroadcastReceiver {
|
||||
};
|
||||
|
||||
try {
|
||||
+ if(Utils.isOnionRoutingEnabled(context)) {
|
||||
+ Utils.requestStartOrbot(context);
|
||||
+ }
|
||||
DownloadClient downloadClient = new DownloadClient.Builder()
|
||||
.setUrl(url)
|
||||
.setDestination(jsonNew)
|
||||
.setDownloadCallback(callback)
|
||||
+ .setUseOnionRouting(Utils.isOnionRoutingEnabled(context))
|
||||
.build();
|
||||
downloadClient.start();
|
||||
} catch (IOException e) {
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/controller/UpdaterController.java b/app/src/main/java/org/lineageos/updater/controller/UpdaterController.java
|
||||
index daa710c..1e51c5b 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/controller/UpdaterController.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/controller/UpdaterController.java
|
||||
@@ -374,12 +374,16 @@ public class UpdaterController {
|
||||
update.setFile(destination);
|
||||
DownloadClient downloadClient;
|
||||
try {
|
||||
+ if(Utils.isOnionRoutingEnabled(mContext)) {
|
||||
+ Utils.requestStartOrbot(mContext);
|
||||
+ }
|
||||
downloadClient = new DownloadClient.Builder()
|
||||
.setUrl(update.getDownloadUrl())
|
||||
.setDestination(update.getFile())
|
||||
.setDownloadCallback(getDownloadCallback(downloadId))
|
||||
.setProgressListener(getProgressListener(downloadId))
|
||||
.setUseDuplicateLinks(true)
|
||||
+ .setUseOnionRouting(Utils.isOnionRoutingEnabled(mContext))
|
||||
.build();
|
||||
} catch (IOException exception) {
|
||||
Log.e(TAG, "Could not build download client");
|
||||
@@ -419,6 +423,9 @@ public class UpdaterController {
|
||||
verifyUpdateAsync(downloadId);
|
||||
notifyUpdateChange(downloadId);
|
||||
} else {
|
||||
+ if(Utils.isOnionRoutingEnabled(mContext)) {
|
||||
+ Utils.requestStartOrbot(mContext);
|
||||
+ }
|
||||
DownloadClient downloadClient;
|
||||
try {
|
||||
downloadClient = new DownloadClient.Builder()
|
||||
@@ -427,6 +434,7 @@ public class UpdaterController {
|
||||
.setDownloadCallback(getDownloadCallback(downloadId))
|
||||
.setProgressListener(getProgressListener(downloadId))
|
||||
.setUseDuplicateLinks(true)
|
||||
+ .setUseOnionRouting(Utils.isOnionRoutingEnabled(mContext))
|
||||
.build();
|
||||
} catch (IOException exception) {
|
||||
Log.e(TAG, "Could not build download client");
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/download/DownloadClient.java b/app/src/main/java/org/lineageos/updater/download/DownloadClient.java
|
||||
index 3494947..7a7f7cf 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/download/DownloadClient.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/download/DownloadClient.java
|
||||
@@ -60,6 +60,7 @@ public interface DownloadClient {
|
||||
private DownloadClient.DownloadCallback mCallback;
|
||||
private DownloadClient.ProgressListener mProgressListener;
|
||||
private boolean mUseDuplicateLinks;
|
||||
+ private boolean mOnionRouting;
|
||||
|
||||
public DownloadClient build() throws IOException {
|
||||
if (mUrl == null) {
|
||||
@@ -70,7 +71,7 @@ public interface DownloadClient {
|
||||
throw new IllegalStateException("No download callback defined");
|
||||
}
|
||||
return new HttpURLConnectionClient(mUrl, mDestination, mProgressListener, mCallback,
|
||||
- mUseDuplicateLinks);
|
||||
+ mUseDuplicateLinks, mOnionRouting);
|
||||
}
|
||||
|
||||
public Builder setUrl(String url) {
|
||||
@@ -97,5 +98,10 @@ public interface DownloadClient {
|
||||
mUseDuplicateLinks = useDuplicateLinks;
|
||||
return this;
|
||||
}
|
||||
+
|
||||
+ public Builder setUseOnionRouting(boolean onionRouting) {
|
||||
+ mOnionRouting = onionRouting;
|
||||
+ return this;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/download/HttpURLConnectionClient.java b/app/src/main/java/org/lineageos/updater/download/HttpURLConnectionClient.java
|
||||
index b9c4b5d..b94fff0 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/download/HttpURLConnectionClient.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/download/HttpURLConnectionClient.java
|
||||
@@ -18,12 +18,16 @@ package org.lineageos.updater.download;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
|
||||
+import org.lineageos.updater.misc.Utils;
|
||||
+
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
+import java.net.InetSocketAddress;
|
||||
+import java.net.Proxy;
|
||||
import java.net.URL;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
@@ -42,6 +46,7 @@ public class HttpURLConnectionClient implements DownloadClient {
|
||||
private final DownloadClient.ProgressListener mProgressListener;
|
||||
private final DownloadClient.DownloadCallback mCallback;
|
||||
private final boolean mUseDuplicateLinks;
|
||||
+ private final boolean mUseOnionRouting;
|
||||
|
||||
private DownloadThread mDownloadThread;
|
||||
|
||||
@@ -56,8 +61,14 @@ public class HttpURLConnectionClient implements DownloadClient {
|
||||
HttpURLConnectionClient(String url, File destination,
|
||||
DownloadClient.ProgressListener progressListener,
|
||||
DownloadClient.DownloadCallback callback,
|
||||
- boolean useDuplicateLinks) throws IOException {
|
||||
- mClient = (HttpURLConnection) new URL(url).openConnection();
|
||||
+ boolean useDuplicateLinks, boolean useOnionRouting) throws IOException {
|
||||
+ mUseOnionRouting = useOnionRouting;
|
||||
+ if(mUseOnionRouting) {
|
||||
+ Proxy orbot = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 9050));
|
||||
+ mClient = (HttpURLConnection) new URL(url).openConnection(orbot);
|
||||
+ } else {
|
||||
+ mClient = (HttpURLConnection) new URL(url).openConnection();
|
||||
+ }
|
||||
mDestination = destination;
|
||||
mProgressListener = progressListener;
|
||||
mCallback = callback;
|
||||
@@ -177,7 +188,12 @@ public class HttpURLConnectionClient implements DownloadClient {
|
||||
private void changeClientUrl(URL newUrl) throws IOException {
|
||||
String range = mClient.getRequestProperty("Range");
|
||||
mClient.disconnect();
|
||||
- mClient = (HttpURLConnection) newUrl.openConnection();
|
||||
+ if(mUseOnionRouting) {
|
||||
+ Proxy orbot = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", 9050));
|
||||
+ mClient = (HttpURLConnection) newUrl.openConnection(orbot);
|
||||
+ } else {
|
||||
+ mClient = (HttpURLConnection) newUrl.openConnection();
|
||||
+ }
|
||||
if (range != null) {
|
||||
mClient.setRequestProperty("Range", range);
|
||||
}
|
||||
@@ -232,7 +248,7 @@ public class HttpURLConnectionClient implements DownloadClient {
|
||||
}
|
||||
Log.d(TAG, "Downloading from " + newUrl);
|
||||
changeClientUrl(url);
|
||||
- mClient.setConnectTimeout(5000);
|
||||
+ mClient.setConnectTimeout(mUseOnionRouting ? 45000 : 5000);
|
||||
mClient.connect();
|
||||
if (!isSuccessCode(mClient.getResponseCode())) {
|
||||
throw new IOException("Server replied with " + mClient.getResponseCode());
|
||||
@@ -257,6 +273,9 @@ public class HttpURLConnectionClient implements DownloadClient {
|
||||
public void run() {
|
||||
boolean justResumed = false;
|
||||
try {
|
||||
+ if(mUseOnionRouting) {
|
||||
+ Utils.waitUntilOrbotIsAvailable();
|
||||
+ }
|
||||
mClient.setInstanceFollowRedirects(!mUseDuplicateLinks);
|
||||
mClient.connect();
|
||||
int responseCode = mClient.getResponseCode();
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/misc/Constants.java b/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
index beb9423..a51ab15 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
@@ -30,6 +30,7 @@ public final class Constants {
|
||||
|
||||
public static final String PREF_LAST_UPDATE_CHECK = "last_update_check";
|
||||
public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval";
|
||||
+ public static final String PREF_ONION_ROUTING = "onion_routing";
|
||||
public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates";
|
||||
public static final String PREF_AB_PERF_MODE = "ab_perf_mode";
|
||||
public static final String PREF_METERED_NETWORK_WARNING = "pref_metered_network_warning";
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/misc/Utils.java b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
index f3d334b..67ad386 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
@@ -46,6 +46,7 @@ import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
+import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
@@ -151,11 +152,75 @@ public class Utils {
|
||||
return updates;
|
||||
}
|
||||
|
||||
+ //Credit: https://stackoverflow.com/a/6758962
|
||||
+ public static boolean isPackageInstalled(Context context, String packageID) {
|
||||
+ PackageManager pm = context.getPackageManager();
|
||||
+ try {
|
||||
+ pm.getPackageInfo(packageID, PackageManager.GET_META_DATA);
|
||||
+ } catch(PackageManager.NameNotFoundException e) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isOrbotInstalled(Context context) {
|
||||
+ return isPackageInstalled(context, "org.torproject.android");
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isOnionRoutingEnabled(Context context) {
|
||||
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
+ return preferences.getBoolean(Constants.PREF_ONION_ROUTING, false);
|
||||
+ }
|
||||
+
|
||||
+ //Credit: OrbotHelper/NetCipher
|
||||
+ public static void requestStartOrbot(Context context) {
|
||||
+ Intent intent = new Intent("org.torproject.android.intent.action.START");
|
||||
+ intent.setPackage("org.torproject.android");
|
||||
+ intent.putExtra("org.torproject.android.intent.extra.PACKAGE_NAME", context.getPackageName());
|
||||
+ context.sendBroadcast(intent);
|
||||
+ }
|
||||
+
|
||||
+ //Credit: https://www.geekality.net/2013/04/30/java-simple-check-to-see-if-a-server-is-listening-on-a-port/
|
||||
+ public static boolean isPortListening(String host, int port) {
|
||||
+ Socket s = null;
|
||||
+ try {
|
||||
+ s = new Socket(host, port);
|
||||
+ return true;
|
||||
+ } catch(Exception e) {
|
||||
+ return false;
|
||||
+ } finally {
|
||||
+ if (s != null) {
|
||||
+ try {
|
||||
+ s.close();
|
||||
+ } catch(Exception e1) {
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static boolean waitUntilOrbotIsAvailable() {
|
||||
+ int tries = 0;
|
||||
+ boolean listening;
|
||||
+ while(!(listening = isPortListening("127.0.0.1", 9050)) && tries <= 60) {
|
||||
+ tries++;
|
||||
+ try {
|
||||
+ Thread.sleep(1000);
|
||||
+ } catch(Exception e) {
|
||||
+
|
||||
+ }
|
||||
+ }
|
||||
+ return listening;
|
||||
+ }
|
||||
+
|
||||
public static String getServerURL(Context context) {
|
||||
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
|
||||
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
|
||||
SystemProperties.get(Constants.PROP_DEVICE));
|
||||
String server = "0OTA_SERVER_CLEARNET0";
|
||||
+ String serverOnion = "0OTA_SERVER_ONION0";
|
||||
+ if(serverOnion.toLowerCase().startsWith("http") && isOnionRoutingEnabled(context)) {
|
||||
+ server = serverOnion;
|
||||
+ }
|
||||
|
||||
return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion;
|
||||
}
|
||||
diff --git a/app/src/main/res/layout/preferences_dialog.xml b/app/src/main/res/layout/preferences_dialog.xml
|
||||
index c1b4356..93f1bfc 100644
|
||||
--- a/app/src/main/res/layout/preferences_dialog.xml
|
||||
+++ b/app/src/main/res/layout/preferences_dialog.xml
|
||||
@@ -29,6 +29,14 @@
|
||||
android:entries="@array/menu_auto_updates_check_interval_entries" />
|
||||
</LinearLayout>
|
||||
|
||||
+ <androidx.appcompat.widget.SwitchCompat
|
||||
+ android:id="@+id/preferences_onion_routing"
|
||||
+ android:layout_width="match_parent"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:layout_marginBottom="16dp"
|
||||
+ android:text="@string/menu_onion_routing"
|
||||
+ android:textSize="16sp" />
|
||||
+
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/preferences_auto_delete_updates"
|
||||
android:layout_width="match_parent"
|
||||
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
|
||||
index b59cea4..841be10 100644
|
||||
--- a/app/src/main/res/values/strings.xml
|
||||
+++ b/app/src/main/res/values/strings.xml
|
||||
@@ -79,6 +79,7 @@
|
||||
<string name="menu_auto_updates_check_interval_weekly">Once a week</string>
|
||||
<string name="menu_auto_updates_check_interval_monthly">Once a month</string>
|
||||
<string name="menu_auto_updates_check_interval_never">Never</string>
|
||||
+ <string name="menu_onion_routing">Perform requests over Tor</string>
|
||||
<string name="menu_auto_delete_updates">Delete updates when installed</string>
|
||||
<string name="menu_delete_update">Delete</string>
|
||||
<string name="menu_copy_url">Copy URL</string>
|
||||
@@ -96,6 +97,7 @@
|
||||
<string name="snack_download_failed">The download failed. Please check your internet connection and try again later.</string>
|
||||
<string name="snack_download_verification_failed">The update verification failed.</string>
|
||||
<string name="snack_download_verified">Download completed.</string>
|
||||
+ <string name="snack_orbot_not_available">Orbot is not installed, disabling Tor routing!</string>
|
||||
|
||||
<string name="snack_update_not_installable">This update can\'t be installed on top of the current build.</string>
|
||||
|
@ -0,0 +1,207 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tavi <tavi@divested.dev>
|
||||
Date: Sat, 18 May 2024 11:21:24 -0400
|
||||
Subject: [PATCH] Add server choices
|
||||
|
||||
Change-Id: I43524f0567eabff163ce81c4a93cf145542a3d5d
|
||||
Signed-off-by: Tavi <tavi@divested.dev>
|
||||
---
|
||||
app/src/main/AndroidManifest.xml | 3 ++-
|
||||
.../lineageos/updater/UpdatesActivity.java | 4 +++
|
||||
.../org/lineageos/updater/misc/Constants.java | 11 ++++++++
|
||||
.../org/lineageos/updater/misc/Utils.java | 27 ++++++++++++++++---
|
||||
.../main/res/layout/preferences_dialog.xml | 22 +++++++++++++++
|
||||
app/src/main/res/values/arrays.xml | 7 +++++
|
||||
app/src/main/res/values/strings.xml | 5 ++++
|
||||
.../main/res/xml/network_security_config.xml | 8 ++++++
|
||||
8 files changed, 82 insertions(+), 5 deletions(-)
|
||||
create mode 100644 app/src/main/res/xml/network_security_config.xml
|
||||
|
||||
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
|
||||
index 02d2b53..2e5eb22 100644
|
||||
--- a/app/src/main/AndroidManifest.xml
|
||||
+++ b/app/src/main/AndroidManifest.xml
|
||||
@@ -25,7 +25,8 @@
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
- android:usesCleartextTraffic="false">
|
||||
+ android:usesCleartextTraffic="false"
|
||||
+ android:networkSecurityConfig="@xml/network_security_config">
|
||||
|
||||
<activity
|
||||
android:name=".UpdatesActivity"
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
index 4dbc077..b77143c 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/UpdatesActivity.java
|
||||
@@ -584,6 +584,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
private void showPreferencesDialog() {
|
||||
View view = LayoutInflater.from(this).inflate(R.layout.preferences_dialog, null);
|
||||
Spinner autoCheckInterval = view.findViewById(R.id.preferences_auto_updates_check_interval);
|
||||
+ Spinner serverChoice = view.findViewById(R.id.preferences_server_choice);
|
||||
SwitchCompat onionRouting = view.findViewById(R.id.preferences_onion_routing);
|
||||
SwitchCompat autoDelete = view.findViewById(R.id.preferences_auto_delete_updates);
|
||||
SwitchCompat meteredNetworkWarning = view.findViewById(
|
||||
@@ -597,6 +598,7 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
autoCheckInterval.setSelection(Utils.getUpdateCheckSetting(this));
|
||||
+ serverChoice.setSelection(Utils.getServerChoiceSetting(this));
|
||||
onionRouting.setChecked(prefs.getBoolean(Constants.PREF_ONION_ROUTING, false));
|
||||
autoDelete.setChecked(prefs.getBoolean(Constants.PREF_AUTO_DELETE_UPDATES, false));
|
||||
meteredNetworkWarning.setChecked(prefs.getBoolean(Constants.PREF_METERED_NETWORK_WARNING,
|
||||
@@ -638,6 +640,8 @@ public class UpdatesActivity extends UpdatesListActivity implements UpdateImport
|
||||
prefs.edit()
|
||||
.putInt(Constants.PREF_AUTO_UPDATES_CHECK_INTERVAL,
|
||||
autoCheckInterval.getSelectedItemPosition())
|
||||
+ .putInt(Constants.PREF_SERVER_CHOICE,
|
||||
+ serverChoice.getSelectedItemPosition())
|
||||
.putBoolean(Constants.PREF_ONION_ROUTING,
|
||||
onionRouting.isChecked() && Utils.isOrbotInstalled(getApplicationContext()))
|
||||
.putBoolean(Constants.PREF_AUTO_DELETE_UPDATES, autoDelete.isChecked())
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/misc/Constants.java b/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
index a51ab15..fb4bc71 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/misc/Constants.java
|
||||
@@ -28,8 +28,19 @@ public final class Constants {
|
||||
public static final int AUTO_UPDATES_CHECK_INTERVAL_WEEKLY = 2;
|
||||
public static final int AUTO_UPDATES_CHECK_INTERVAL_MONTHLY = 3;
|
||||
|
||||
+ public static final int PREF_SERVER_CHOICE_PRIMARY = 0;
|
||||
+ public static final int PREF_SERVER_CHOICE_SECONDARY = 1;
|
||||
+ public static final int PREF_SERVER_CHOICE_ONION_PRIMARY = 2;
|
||||
+ public static final int PREF_SERVER_CHOICE_ONION_SECONDARY = 3;
|
||||
+
|
||||
+ public static final String PREF_SERVER_CHOICE_PRIMARY_ACTUAL = "0OTA_SERVER_CLEARNET_PRIMARY0";
|
||||
+ public static final String PREF_SERVER_CHOICE_SECONDARY_ACTUAL = "0OTA_SERVER_CLEARNET_SECONDARY0";
|
||||
+ public static final String PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL = "0OTA_SERVER_ONION_PRIMARY0";
|
||||
+ public static final String PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL = "0OTA_SERVER_ONION_SECONDARY0";
|
||||
+
|
||||
public static final String PREF_LAST_UPDATE_CHECK = "last_update_check";
|
||||
public static final String PREF_AUTO_UPDATES_CHECK_INTERVAL = "auto_updates_check_interval";
|
||||
+ public static final String PREF_SERVER_CHOICE = "server_choice";
|
||||
public static final String PREF_ONION_ROUTING = "onion_routing";
|
||||
public static final String PREF_AUTO_DELETE_UPDATES = "auto_delete_updates";
|
||||
public static final String PREF_AB_PERF_MODE = "ab_perf_mode";
|
||||
diff --git a/app/src/main/java/org/lineageos/updater/misc/Utils.java b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
index 67ad386..7ddf91e 100644
|
||||
--- a/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
+++ b/app/src/main/java/org/lineageos/updater/misc/Utils.java
|
||||
@@ -212,14 +212,33 @@ public class Utils {
|
||||
return listening;
|
||||
}
|
||||
|
||||
+ public static int getServerChoiceSetting(Context context) {
|
||||
+ SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
+ return preferences.getInt(Constants.PREF_SERVER_CHOICE,
|
||||
+ Constants.PREF_SERVER_CHOICE_PRIMARY);
|
||||
+ }
|
||||
+
|
||||
+ public static String getServerBaseUrl(Context context) {
|
||||
+ switch (Utils.getServerChoiceSetting(context)) {
|
||||
+ case Constants.PREF_SERVER_CHOICE_PRIMARY:
|
||||
+ default:
|
||||
+ return Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL;
|
||||
+ case Constants.PREF_SERVER_CHOICE_SECONDARY:
|
||||
+ return Constants.PREF_SERVER_CHOICE_SECONDARY_ACTUAL;
|
||||
+ case Constants.PREF_SERVER_CHOICE_ONION_PRIMARY:
|
||||
+ return Constants.PREF_SERVER_CHOICE_ONION_PRIMARY_ACTUAL;
|
||||
+ case Constants.PREF_SERVER_CHOICE_ONION_SECONDARY:
|
||||
+ return Constants.PREF_SERVER_CHOICE_ONION_SECONDARY_ACTUAL;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public static String getServerURL(Context context) {
|
||||
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
|
||||
String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE,
|
||||
SystemProperties.get(Constants.PROP_DEVICE));
|
||||
- String server = "0OTA_SERVER_CLEARNET0";
|
||||
- String serverOnion = "0OTA_SERVER_ONION0";
|
||||
- if(serverOnion.toLowerCase().startsWith("http") && isOnionRoutingEnabled(context)) {
|
||||
- server = serverOnion;
|
||||
+ String server = getServerBaseUrl(context);
|
||||
+ if (!isOnionRoutingEnabled(context) && server.toLowerCase().startsWith("http://") && server.toLowerCase().contains(".onion/")) {
|
||||
+ server = Constants.PREF_SERVER_CHOICE_PRIMARY_ACTUAL;
|
||||
}
|
||||
|
||||
return server + "?base=LineageOS&device=" + device + "&inc=" + incrementalVersion;
|
||||
diff --git a/app/src/main/res/layout/preferences_dialog.xml b/app/src/main/res/layout/preferences_dialog.xml
|
||||
index 93f1bfc..8e020f7 100644
|
||||
--- a/app/src/main/res/layout/preferences_dialog.xml
|
||||
+++ b/app/src/main/res/layout/preferences_dialog.xml
|
||||
@@ -29,6 +29,28 @@
|
||||
android:entries="@array/menu_auto_updates_check_interval_entries" />
|
||||
</LinearLayout>
|
||||
|
||||
+ <LinearLayout
|
||||
+ android:layout_width="match_parent"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:layout_marginBottom="16dp"
|
||||
+ android:orientation="horizontal">
|
||||
+
|
||||
+ <TextView
|
||||
+ android:layout_width="0dp"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:layout_weight="1"
|
||||
+ android:text="@string/menu_server_choice"
|
||||
+ android:textColor="@color/inverted"
|
||||
+ android:textSize="16sp" />
|
||||
+
|
||||
+ <Spinner
|
||||
+ android:id="@+id/preferences_server_choice"
|
||||
+ android:layout_width="0dp"
|
||||
+ android:layout_height="wrap_content"
|
||||
+ android:layout_weight="1"
|
||||
+ android:entries="@array/menu_server_choice_entries" />
|
||||
+ </LinearLayout>
|
||||
+
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/preferences_onion_routing"
|
||||
android:layout_width="match_parent"
|
||||
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
|
||||
index 287c221..777c8ef 100644
|
||||
--- a/app/src/main/res/values/arrays.xml
|
||||
+++ b/app/src/main/res/values/arrays.xml
|
||||
@@ -21,4 +21,11 @@
|
||||
<item>@string/menu_auto_updates_check_interval_weekly</item>
|
||||
<item>@string/menu_auto_updates_check_interval_monthly</item>
|
||||
</string-array>
|
||||
+
|
||||
+ <string-array name="menu_server_choice_entries" translatable="false">
|
||||
+ <item>@string/menu_server_choice_primary</item>
|
||||
+ <item>@string/menu_server_choice_secondary</item>
|
||||
+ <item>@string/menu_server_choice_onion_primary</item>
|
||||
+ <item>@string/menu_server_choice_onion_secondary</item>
|
||||
+ </string-array>
|
||||
</resources>
|
||||
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
|
||||
index 841be10..7f59845 100644
|
||||
--- a/app/src/main/res/values/strings.xml
|
||||
+++ b/app/src/main/res/values/strings.xml
|
||||
@@ -79,6 +79,11 @@
|
||||
<string name="menu_auto_updates_check_interval_weekly">Once a week</string>
|
||||
<string name="menu_auto_updates_check_interval_monthly">Once a month</string>
|
||||
<string name="menu_auto_updates_check_interval_never">Never</string>
|
||||
+ <string name="menu_server_choice">Server Choice</string>
|
||||
+ <string name="menu_server_choice_primary">Primary</string>
|
||||
+ <string name="menu_server_choice_secondary">0OTA_SERVER_CLEARNET_SECONDARY_NAME0</string>
|
||||
+ <string name="menu_server_choice_onion_primary">Onion #1</string>
|
||||
+ <string name="menu_server_choice_onion_secondary">Onion #2</string>
|
||||
<string name="menu_onion_routing">Perform requests over Tor</string>
|
||||
<string name="menu_auto_delete_updates">Delete updates when installed</string>
|
||||
<string name="menu_delete_update">Delete</string>
|
||||
diff --git a/app/src/main/res/xml/network_security_config.xml b/app/src/main/res/xml/network_security_config.xml
|
||||
new file mode 100644
|
||||
index 0000000..09b655b
|
||||
--- /dev/null
|
||||
+++ b/app/src/main/res/xml/network_security_config.xml
|
||||
@@ -0,0 +1,8 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<network-security-config>
|
||||
+ <domain-config cleartextTrafficPermitted="true">
|
||||
+ <domain includeSubdomains="false">0OTA_SERVER_ONION_DOMAIN_PRIMARY0</domain>
|
||||
+ <domain includeSubdomains="false">0OTA_SERVER_ONION_DOMAIN_SECONDARY0</domain>
|
||||
+ </domain-config>
|
||||
+</network-security-config>
|
||||
+
|
@ -0,0 +1,90 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Tad <tad@spotco.us>
|
||||
Date: Mon, 29 May 2017 20:25:28 -0400
|
||||
Subject: [PATCH] Remove voice input key
|
||||
|
||||
Change-Id: Ifb56c679d3a9b6c035fcdd4596ec0b3b5653bea8
|
||||
---
|
||||
java/res/values-sw430dp/config-per-form-factor.xml | 2 +-
|
||||
java/res/values/config-per-form-factor.xml | 2 +-
|
||||
java/res/xml/prefs_screen_preferences.xml | 2 +-
|
||||
.../latin/settings/PreferencesSettingsFragment.java | 3 +--
|
||||
.../android/inputmethod/latin/settings/SettingsValues.java | 6 ++----
|
||||
5 files changed, 6 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/java/res/values-sw430dp/config-per-form-factor.xml b/java/res/values-sw430dp/config-per-form-factor.xml
|
||||
index 1a539c190..5f513b433 100644
|
||||
--- a/java/res/values-sw430dp/config-per-form-factor.xml
|
||||
+++ b/java/res/values-sw430dp/config-per-form-factor.xml
|
||||
@@ -25,7 +25,7 @@
|
||||
<bool name="config_default_key_preview_popup">true</bool>
|
||||
<bool name="config_default_sound_enabled">false</bool>
|
||||
<bool name="config_enable_show_emoji_key_option">true</bool>
|
||||
- <bool name="config_enable_show_voice_key_option">true</bool>
|
||||
+ <bool name="config_enable_show_voice_key_option">false</bool>
|
||||
<bool name="config_key_selection_by_dragging_finger">true</bool>
|
||||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||
false -->
|
||||
diff --git a/java/res/values/config-per-form-factor.xml b/java/res/values/config-per-form-factor.xml
|
||||
index a5259a6d8..499b25fb4 100644
|
||||
--- a/java/res/values/config-per-form-factor.xml
|
||||
+++ b/java/res/values/config-per-form-factor.xml
|
||||
@@ -25,7 +25,7 @@
|
||||
<bool name="config_default_key_preview_popup">true</bool>
|
||||
<bool name="config_default_sound_enabled">false</bool>
|
||||
<bool name="config_enable_show_emoji_key_option">true</bool>
|
||||
- <bool name="config_enable_show_voice_key_option">true</bool>
|
||||
+ <bool name="config_enable_show_voice_key_option">false</bool>
|
||||
<bool name="config_key_selection_by_dragging_finger">true</bool>
|
||||
<!-- Showing more keys keyboard, just above the touched point if true, aligned to the key if
|
||||
false -->
|
||||
diff --git a/java/res/xml/prefs_screen_preferences.xml b/java/res/xml/prefs_screen_preferences.xml
|
||||
index d2dc51e7f..c7f8b588b 100644
|
||||
--- a/java/res/xml/prefs_screen_preferences.xml
|
||||
+++ b/java/res/xml/prefs_screen_preferences.xml
|
||||
@@ -66,6 +66,6 @@
|
||||
<CheckBoxPreference
|
||||
android:key="pref_voice_input_key"
|
||||
android:title="@string/voice_input"
|
||||
- android:defaultValue="true"
|
||||
+ android:defaultValue="false"
|
||||
android:persistent="true" />
|
||||
</PreferenceScreen>
|
||||
diff --git a/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
|
||||
index aba14ee7a..867259309 100644
|
||||
--- a/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
|
||||
+++ b/java/src/com/android/inputmethod/latin/settings/PreferencesSettingsFragment.java
|
||||
@@ -61,8 +61,7 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
||||
if (!showEmojiKeyOption) {
|
||||
removePreference(Settings.PREF_SHOW_EMOJI_KEY);
|
||||
}
|
||||
- final boolean showVoiceKeyOption = res.getBoolean(
|
||||
- R.bool.config_enable_show_voice_key_option);
|
||||
+ final boolean showVoiceKeyOption = false;
|
||||
if (!showVoiceKeyOption) {
|
||||
removePreference(Settings.PREF_VOICE_INPUT_KEY);
|
||||
}
|
||||
diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
|
||||
index 6eb8e98b8..8eec5b0f3 100644
|
||||
--- a/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
|
||||
+++ b/java/src/com/android/inputmethod/latin/settings/SettingsValues.java
|
||||
@@ -140,9 +140,7 @@ public class SettingsValues {
|
||||
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
|
||||
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
|
||||
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
|
||||
- mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res)
|
||||
- && mInputAttributes.mShouldShowVoiceInputKey
|
||||
- && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
|
||||
+ mShowsVoiceInputKey = false;
|
||||
mShowNumberRow = prefs.getBoolean(Settings.PREF_SHOW_NUMBER_ROW, false);
|
||||
mShowLongpressHints = prefs.getBoolean(Settings.PREF_SHOW_LONGPRESS_HINTS, true);
|
||||
mIncludesOtherImesInLanguageSwitchList = Settings.ENABLE_SHOW_LANGUAGE_SWITCH_KEY_SETTINGS
|
||||
@@ -374,7 +372,7 @@ public class SettingsValues {
|
||||
.remove(Settings.PREF_VOICE_MODE_OBSOLETE)
|
||||
.apply();
|
||||
}
|
||||
- return prefs.getBoolean(Settings.PREF_VOICE_INPUT_KEY, true);
|
||||
+ return prefs.getBoolean(Settings.PREF_VOICE_INPUT_KEY, false);
|
||||
}
|
||||
|
||||
public String dump() {
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user