chore: 整理文档目录并清理冗余 JNI 与布局文件

This commit is contained in:
2026-10-22 16:32:04 +08:00
parent e95490b5ce
commit dfd43a167b
14 changed files with 49 additions and 89 deletions

View File

@@ -5,19 +5,21 @@
cmake_minimum_required(VERSION 3.4.1)
project(aoleyun CXX)
# Creates and names a library, sets it as either STATIC
# or SHARED, and provides the relative paths to its source code.
# You can define multiple libraries, and CMake builds them for you.
# Gradle automatically packages shared libraries with your APK.
add_library( # Sets the name of the library.
jgy
aoleyun
# Sets the library as a shared library.
SHARED
# Provides a relative path to your source file(s).
src/main/jni/jgy.cpp )
src/main/jni/aoleyun.cpp)
# Searches for a specified prebuilt library and stores the path as a
# variable. Because CMake includes system libraries in the search path by
@@ -37,10 +39,10 @@ find_library( # Sets the name of the path variable.
# build script, prebuilt third-party libraries, or system libraries.
target_link_libraries( # Specifies the target library.
jgy
aoleyun
# Links the target library to the log library
# included in the NDK.
${log-lib} )
set_target_properties(jgy PROPERTIES LINK_FLAGS "-Wl,-z,max-page-size=16384")
set_target_properties(aoleyun PROPERTIES LINK_FLAGS "-Wl,-z,max-page-size=16384")

View File

@@ -18,8 +18,8 @@ android {
defaultConfig {
applicationId "com.aoleyun.sn"
versionCode 252
versionName "1.6.1021"
versionCode 253
versionName "1.6.1022"
//There are no CERT files because If the mini sdk version is 23+, the AGP will ignore the V1 scheme signature.
minSdkVersion 24
@@ -45,7 +45,7 @@ android {
buildConfigField "String", "WEBSOCKET_URL", '"wss://led.aoleyun.cn/wss/"'
// 百度定位 AK:统一在构建期注入,所有 buildType / flavor 共用同一份固定值。
// 严禁事后修改 APK(反编译重打包会破坏 liblocSDK8b.so 的未压缩与页对齐,导致 162 / .dynamic section header was not found)
// 注意:liblocSDK8b.so 不能被 strip 或重打包(见下方 packaging 配置),否则定位返回 162。
}
@@ -76,6 +76,14 @@ android {
}
}
packaging {
jniLibs {
// liblocSDK8b.so 使用自定义 ELF 布局,AGP 的 strip 会重写其节头表并丢失 .dynamic,
// 导致运行时请求串解密失败(getLocType() 返回 162)。必须原样打包。
keepDebugSymbols += ['**/liblocSDK8b.so']
}
}
// Disable release builds for now
android.variantFilter { variant ->
// // Icon recents is Go only
@@ -354,7 +362,6 @@ android {
G122JDebug.initWith(debug)
G122JDebug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "qyYyTD4ahoebPRY2oRxyiw5Xw1T6ikxJ"]
buildConfigField "String", "platform", '"G122J"'
versionNameSuffix "_debug"
debuggable true
@@ -363,14 +370,12 @@ android {
G122JRelease.initWith(release)
G122JRelease {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "qyYyTD4ahoebPRY2oRxyiw5Xw1T6ikxJ"]
buildConfigField "String", "platform", '"G122J"'
signingConfig signingConfigs.G122J
}
G12NLDebug.initWith(debug)
G12NLDebug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"G12NL"'
versionNameSuffix "_debug"
debuggable true
@@ -379,14 +384,12 @@ android {
G12NLRelease.initWith(release)
G12NLRelease {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"G12NL"'
signingConfig signingConfigs.MT6789
}
DX11Debug.initWith(debug)
DX11Debug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"DX11"'
versionNameSuffix "_debug"
debuggable true
@@ -395,14 +398,12 @@ android {
DX11Release.initWith(release)
DX11Release {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"DX11"'
signingConfig signingConfigs.DX11
}
G122Debug.initWith(debug)
G122Debug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"MT6765"'
versionNameSuffix "_debug"
debuggable true
@@ -411,14 +412,12 @@ android {
G122Release.initWith(release)
G122Release {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"MT6765"'
signingConfig signingConfigs.G122
}
QualcommDebug.initWith(debug)
QualcommDebug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "qyYyTD4ahoebPRY2oRxyiw5Xw1T6ikxJ"]
buildConfigField "String", "platform", '"QualcommA"'
versionNameSuffix "_debug"
debuggable true
@@ -427,7 +426,6 @@ android {
QualcommRelease.initWith(release)
QualcommRelease {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "qyYyTD4ahoebPRY2oRxyiw5Xw1T6ikxJ"]
buildConfigField "String", "platform", '"QualcommA"'
signingConfig signingConfigs.SM8150
}
@@ -476,6 +474,7 @@ android {
iPlay50miniProDebug.initWith(debug)
iPlay50miniProDebug {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"miniG99"'
versionNameSuffix "_debug"
debuggable true
@@ -484,6 +483,7 @@ android {
iPlay50miniProRelease.initWith(release)
iPlay50miniProRelease {
manifestPlaceholders = [BAIDU_LBS_API_KEY: "CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr"]
buildConfigField "String", "platform", '"miniG99"'
signingConfig signingConfigs.iPlay50miniPro
}

View File

@@ -395,7 +395,7 @@
<meta-data
android:name="com.baidu.lbsapi.API_KEY"
android:value="${BAIDU_LBS_API_KEY}" />
android:value="CjFhFE1UP5G14tMBz1kWs7ca92bgHuLr" />
<!-- 请填写你自己的- appKey -->
<meta-data

View File

@@ -193,6 +193,11 @@ public class MainActivity extends BaseMvvmActivity<MainViewModel, ActivityMainBi
// startActivity(new Intent(Settings.ACTION_SECURITY_SETTINGS));
JgyUtils.getInstance().getAllRunningAppProcessInfo();
JgyUtils.getInstance().getAllRunningServices();
try {
Log.e(TAG, "initView jni: " + JgyUtils.getJniInfo());
} catch (Exception e) {
Log.e(TAG, "initView: jni Exception: " + e.getMessage());
}
}
String defaultDesktop = mMMKV.decodeString(CommonConfig.DEFAULT_DESKTOP_PACKAGE_NAME, "");

View File

@@ -388,8 +388,13 @@ public class MapManager {
mMMKV.encode("MapError", "无法获取有效定位依据导致定位失败,一般是由于手机的原因,处于飞行模式下一般会造成这种结果,可以试着重启手机");
break;
case BDLocation.TypeServerDecryptError:
Log.e(TAG, "onReceiveLocation: 服务端解密错误(162),通常是 AK 校验失败/包名或 SHA1 与 AK 不匹配");
mMMKV.encode("MapError", "服务端解密错误,请检查 AK 与该包名、签名的绑定关系");
Log.e(TAG, "onReceiveLocation: 请求串密文解析失败(162),通常是 liblocSDK8b.so 加载或打包异常");
mMMKV.encode("MapError", "定位失败(162):liblocSDK8b.so 加载异常,请检查 SO 是否缺失、被 strip 或被改动");
break;
case 502:
case BDLocation.TypeServerCheckKeyError:
Log.e(TAG, "onReceiveLocation: AK 校验失败(" + location.getLocType() + ")");
mMMKV.encode("MapError", "AK 校验失败(" + location.getLocType() + "),请检查 AK 与包名、签名 SHA1 的绑定关系");
break;
default:
}

View File

@@ -216,7 +216,7 @@ public class JgyUtils {
private CacheHelper cacheHelper;
static {
System.loadLibrary("jgy");
System.loadLibrary("aoleyun");
}
private JgyUtils(Context context) {
@@ -271,7 +271,7 @@ public class JgyUtils {
return sInstance;
}
public static native String getAuthorization();
public static native String getJniInfo();
private static final String EBAIFEN_PACKAGE = "com.kte.interfacesettings";
private static final String EBAIFEN_CLASS_NAME = "com.kte.interfacesettings.ToolsImplService";

View File

@@ -0,0 +1,15 @@
#include <jni.h>
#include <string>
#include <sys/system_properties.h>
// 日志打印
#include <android/log.h>
#define LOG_TAG "TAG_LOG"
#define LOGI(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
extern "C"
JNIEXPORT jstring JNICALL
Java_com_aoleyun_sn_utils_JgyUtils_getJniInfo(JNIEnv *env, jclass clazz) {
std::string info = "form cpp";
return env->NewStringUTF(info.c_str());
}

View File

@@ -1,50 +0,0 @@
#include <jni.h>
#include <string>
#include <sys/system_properties.h>
// 日志打印
#include <android/log.h>
#define LOG_TAG "TAG_LOG"
#define LOGI(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
extern "C"
JNIEXPORT jstring JNICALL
Java_com_aoleyun_sn_utils_JgyUtils_getAuthorization(JNIEnv *env, jclass clazz) {
// TODO: implement getAuthorization()
std::string hello;
// 1. 获取 SDK 版本号 , 存储于 C 字符串 sdk_verison_str 中
char sdk[128] = "0";
// 获取版本号方法
__system_property_get("ro.build.version.sdk", sdk);
//将版本号转为 int 值
int sdk_verison = atoi(sdk);
jclass cls = env->FindClass("com/aoleyun/sn/BuildConfig");
jfieldID jfieldId_text = env->GetStaticFieldID(cls, "FLAVOR", "Ljava/lang/String;");
jstring text = (jstring) env->GetStaticObjectField(cls, jfieldId_text);
const char *char_name = env->GetStringUTFChars(text, JNI_FALSE);
std::string s = char_name;
if (s.compare("newly") == 0) {
LOGI("newly");
hello = "Basic NzljNjRlZjQxYjg3MjhhZDZhYTI5YWY6YWJjNjQ3NzRiYjc2YzMyZDVkZTg0Yzk3==";
} else if (s.compare("MTKnewly") == 0) {
LOGI("MTKnewly");
hello = "Basic NzljNjRlZjQxYjg3MjhhZDZhYTI5YWY6YWJjNjQ3NzRiYjc2YzMyZDVkZTg0Yzk3==";
} else if (s.compare("beta") == 0) {
LOGI("beta");
hello = "Basic NTJkODE2NDM2NjViYjJjYWRhY2YwZTllOmI5N2RkZTYwNjdhY2ZhMjY5MDlhZjQ1Nw==";
}
// LOGI("%s", char_name);
// LOGI("dasdasd");
// LOGI("%s", hello.c_str());
return env->NewStringUTF(hello.c_str());
}
extern "C"
JNIEXPORT jstring JNICALL
Java_com_aoleyun_sn_activity_main_MainAPresenter_getAeskey(JNIEnv *env, jobject thiz) {
std::string key = "0123456789ABCDEF";
return env->NewStringUTF(key.c_str());
}

View File

@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context="com.aoleyun.sn.activity.MainActivity1">
<TextView
android:id="@+id/tv_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>