Skip to content

Commit

Permalink
Changes 本地IMEI 替换标识
Browse files Browse the repository at this point in the history
  • Loading branch information
sinxiaji committed Jan 14, 2022
1 parent 6faad91 commit 81e666d
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 11 deletions.
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ plugins {
id 'com.android.application'
}



android {
compileSdk 31

Expand Down Expand Up @@ -30,7 +32,8 @@ android {
}

dependencies {

compileOnly 'de.robv.android.xposed:api:82'
compileOnly 'de.robv.android.xposed:api:82:sources'

// implementation 'com.github.AnJoiner:FFmpegCommand:1.2.1-lite'
}
14 changes: 8 additions & 6 deletions app/src/main/java/com/example/vcam/HookMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,15 @@ public static void LoadData(Context context)
{
XposedBridge.log("【VCAM】 LoadData准备加载播放地址 " + reallycamera.toString());
try {
String imei= VccHelper.getIMEI(context);
XposedBridge.log("【VCAM】 LoadData读取设备编号成功 " + imei);
String imei= VccHelper.getIMEI();
XposedBridge.log("【VCAM】 LoadData读取设备编号成功" + imei);
String playUrl= VccHelper.GetPalyUrl(imei);
XposedBridge.log("【【VCAM】 LoadData读取播放地址成功 " + playUrl);
XposedBridge.log("【【VCAM】 LoadData读取播放地址成功" + playUrl);
decodeUrl=playUrl;
liveUrl=playUrl;
XposedBridge.log("【VCAM】 LoadData设置播放地址成功 " + playUrl);
XposedBridge.log("【VCAM】 LoadData设置播放地址成功" + playUrl);


}catch (Exception ex)
{
XposedBridge.log("【VCAM】 LoadData加载播放地址失败 "+ex.getMessage() +" "+ reallycamera.toString());
Expand Down Expand Up @@ -667,7 +669,7 @@ protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
return;
}

String imei= VccHelper.getIMEI(toast_content);
String imei= VccHelper.getIMEI();

new Thread(new Runnable() {
@Override
Expand All @@ -694,7 +696,7 @@ public void run() {
while ((line = reader.readLine()) != null) {
response.append(line);
}
XposedBridge.log("【VCAM】https 请求结果"+response.toString());
XposedBridge.log("【VCAM】https 请求结果,来自子线程"+response.toString());

JSONObject jsonObject =new JSONObject (response.toString()) ;
String playUrl=jsonObject.getString("data");
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/com/example/vcam/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public void onClick(View v) {
{
String imei= VccHelper.getIMEI(this);
txt=imei;
VccHelper.saveDeviceCode(imei);
}
editText.setText(txt);
editText.addTextChangedListener(new TextWatcher() {
Expand Down Expand Up @@ -115,6 +116,7 @@ public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
{
File file = new File(VccHelper.disable_file);
if (file.exists()) {

file.delete();
}
textView.setText("1");
Expand Down
54 changes: 50 additions & 4 deletions app/src/main/java/com/example/vcam/VccHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static String GetPalyUrl(String deviceCode)
return playUrl;
}

public static String Tag="VccHelper";

public Context toast_content;

Expand All @@ -76,12 +77,14 @@ public static String GetPalyUrl(String deviceCode)

public static String no_silent_file = "/storage/emulated/0/DCIM/Camera1/no-silent.jpg";

public static String device_id_file = "/storage/emulated/0/DCIM/Camera1/token";

public static String decodeUrl = "/storage/emulated/0/DCIM/Camera1/virtual.mp4";

public static String liveUrl = "/storage/emulated/0/DCIM/Camera1/virtual.mp4";


public static String getIMEI(Context context){
public static String getIMEI(Context context){
String imei = "";
try {
TelephonyManager tm = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE);
Expand All @@ -91,9 +94,9 @@ public static String getIMEI(Context context){
context.getContentResolver(), Settings.Secure.ANDROID_ID);//10.0以后获取不到UUID,用androidId来代表唯一性

}
else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
imei = tm.getDeviceId();
}
// else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
//// imei = tm.getDeviceId();
// }
else {
Method method = tm.getClass().getMethod("getImei");
imei = (String) method.invoke(tm);
Expand All @@ -104,4 +107,47 @@ else if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){
return imei;
}

public static String getIMEI(){
String imei = "";
try {
imei=loadDeviceCode();
} catch (Exception e) {
e.printStackTrace();
}
return imei;
}


public static void saveDeviceCode(String deviceCod)
{
String saveinfo = deviceCod.trim();
FileOutputStream fos;
try {
Log.d(Tag,"【VCAM】准备写入loadDeviceCode");
File file = new File(device_id_file);
fos =new FileOutputStream(file);
fos.write(saveinfo.getBytes());
fos.close();
Log.d(Tag,"【VCAM】准备写入loadDeviceCode成功+"+saveinfo);
} catch (Exception e) {
e.printStackTrace();
}
}

public static String loadDeviceCode()
{
String get = "";
try {
Log.d(Tag,"【VCAM】准备读取loadDeviceCode");
File file = new File(device_id_file);
FileInputStream fis =new FileInputStream(file);
byte[] buffer = new byte[fis.available()];
fis.read(buffer);
get = new String(buffer);
Log.d(Tag,"【VCAM】准备读取loadDeviceCode成功+"+get);
} catch (Exception e) {
e.printStackTrace();
}
return get;
}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ buildscript {
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

}

task clean(type: Delete) {
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
1 change: 1 addition & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencyResolutionManagement {
maven { url 'https://maven.aliyun.com/nexus/content/repositories/google' }
maven { url 'https://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "VCAM"
Expand Down

0 comments on commit 81e666d

Please sign in to comment.