Skip to content

Commit

Permalink
首次提交
Browse files Browse the repository at this point in the history
首次提交
  • Loading branch information
su committed Mar 15, 2018
1 parent 40fcf1a commit 0b04ba8
Show file tree
Hide file tree
Showing 35 changed files with 1,646 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# XposedRimetHelper
Xposed 钉钉辅助模块,暂时实现模拟位置。
Xposed 钉钉辅助模块,暂时实现模拟位置。
“酷公司”是怎样的反正我是不知道,不过恶心的公司恶心的做法应该都是一样了,模拟位置让你在哪都能打卡。
## 效果图
![00.png](https://raw.githubusercontent.com/wuxiaosu/XposedRimetHelper/master/screenshots/00.png)
## 下载
- release from [github](https://github.com/wuxiaosu/XposedRimetHelper/releases) [v1.0](https://github.com/wuxiaosu/XposedRimetHelper/releases/tag/v1.0)
- release from [酷安](https://www.coolapk.com/apk/180336)
## v1.0
支持版本:"4.2.0", "4.2.1", "4.2.6", "4.2.8", "4.3.0", "4.3.1"
25 changes: 25 additions & 0 deletions amaplitelib/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26

defaultConfig {
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
}
Binary file not shown.
21 changes: 21 additions & 0 deletions amaplitelib/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
2 changes: 2 additions & 0 deletions amaplitelib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wuxiaosu.amaplitelib" />
29 changes: 29 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven {
url 'https://raw.githubusercontent.com/wuxiaosu/MvnRepository/master'
}
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}
66 changes: 66 additions & 0 deletions rimethelper/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 26
defaultConfig {
applicationId "com.wuxiaosu.rimethelper"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
}

signingConfigs {
release {
storeFile file(RIMETHELPER_STORE_FILE)
storePassword RIMETHELPER_STORE_PASSWORD
keyAlias RIMETHELPER_KEY_ALIAS
keyPassword RIMETHELPER_KEY_PASSWORD
}
}

buildTypes {

release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release

manifestPlaceholders = [
AMapKey: "26b0d2cd5c99befe30cf73c6d93fe8ea"
]
applicationVariants.all { variant ->
variant.outputs.all { output ->
def oldFile = output.outputFile
def newName = oldFile.name
if (variant.buildType.name == 'release') {
newName = oldFile.name.replace(".", "-v" + variant.versionName + '.')
}
outputFileName = newName
}
}
}

debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

manifestPlaceholders = [
AMapKey: "26b0d2cd5c99befe30cf73c6d93fe8ea"
]
}
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
compile 'com.jaeger.statusbarutil:library:1.4.0'
provided 'de.robv.android.xposed:api:82'
implementation 'com.github.wuxiaosu:SettingLabelView:1.0@aar'
compile project(':amaplitelib')
compile 'com.github.arimorty:floatingsearchview:2.1.1'
}
43 changes: 43 additions & 0 deletions rimethelper/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-keep class com.wuxiaosu.rimethelper.activity.MainActivity {
private void showModuleActiveInfo(...);
}
-keep class com.wuxiaosu.rimethelper.Main {
public void handleLoadPackage(...);
}

# 搜索
-keep class com.amap.api.services.**{*;}

# 2D地图
-keep class com.amap.api.col.**{*;}
-keep class com.amap.api.location.**{*;}
-keep class com.amap.api.maps2d.**{*;}
-keep class com.amap.api.mapcore2d.**{*;}

-dontwarn com.amap.api.location.**
-dontwarn com.amap.api.maps2d.**
-dontwarn com.amap.api.mapcore2d.**
-dontwarn com.amap.apis.utils.**
-dontwarn com.amap.api.maps.**
71 changes: 71 additions & 0 deletions rimethelper/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.wuxiaosu.rimethelper">

<!--允许程序打开网络套接字-->
<uses-permission android:name="android.permission.INTERNET" />
<!--允许程序设置内置sd卡的写权限-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--允许程序获取网络状态-->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!--允许程序访问WiFi网络信息-->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--允许程序读写手机状态和身份-->
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<!--允许程序访问CellID或WiFi热点来获取粗略的位置-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".activity.MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="de.robv.android.xposed.category.MODULE_SETTINGS" />
</intent-filter>
</activity>

<activity-alias
android:name=".activity.MainActivity_Alias"
android:enabled="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:targetActivity=".activity.MainActivity"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>

<meta-data
android:name="xposedmodule"
android:value="true" />
<meta-data
android:name="xposeddescription"
android:value="@string/app_description" />
<meta-data
android:name="xposedminversion"
android:value="30" />

<meta-data
android:name="com.amap.api.v2.apikey"
android:value="${AMapKey}"/>
<activity
android:name=".activity.AMapLiteActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar" />

</application>

</manifest>
1 change: 1 addition & 0 deletions rimethelper/src/main/assets/xposed_init
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
com.wuxiaosu.rimethelper.Main
75 changes: 75 additions & 0 deletions rimethelper/src/main/java/com/wuxiaosu/rimethelper/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package com.wuxiaosu.rimethelper;

import android.app.Application;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

import com.wuxiaosu.rimethelper.hook.LocationHook;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/**
* Created by su on 2018/3/15.
*/

public class Main implements IXposedHookLoadPackage {
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {

if (lpparam.appInfo == null || (lpparam.appInfo.flags & (ApplicationInfo.FLAG_SYSTEM |
ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) {
return;
}

final String RIMET_PACKAGENAME = "com.alibaba.android.rimet";
if (BuildConfig.APPLICATION_ID.equals(lpparam.packageName)) {
XposedHelpers.findAndHookMethod("com.wuxiaosu.rimethelper.activity.MainActivity", lpparam.classLoader,
"showModuleActiveInfo", boolean.class, new XC_MethodHook() {
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
param.args[0] = true;
super.beforeHookedMethod(param);
}
});
}

if (lpparam.packageName.equals(RIMET_PACKAGENAME)) {
try {
XposedHelpers.findAndHookMethod(Application.class,
"attach",
Context.class, new XC_MethodHook() {
@Override
protected void afterHookedMethod(XC_MethodHook.MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Context context = (Context) param.args[0];
ClassLoader appClassLoader = context.getClassLoader();
handleHook(appClassLoader,
getVersionName(context, RIMET_PACKAGENAME));
}
});
} catch (Error | Exception e) {
e.printStackTrace();
}
}
}

private void handleHook(ClassLoader classLoader, String versionName) {
new LocationHook(versionName).hook(classLoader);
}

private String getVersionName(Context context, String pkgName) {
try {
PackageManager packageManager = context.getPackageManager();
PackageInfo packInfo = packageManager.getPackageInfo(pkgName, 0);
return packInfo.versionName;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return "";
}
}
Loading

0 comments on commit 0b04ba8

Please sign in to comment.