Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
lianglixin committed Nov 21, 2020
1 parent 12adad0 commit 8384cd7
Show file tree
Hide file tree
Showing 18 changed files with 108 additions and 104 deletions.
1 change: 1 addition & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/release
*.apk
src/main/res2
dict.txt
26 changes: 5 additions & 21 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
apply plugin: 'com.android.application'
// apply plugin: 'lazyinject'

/*
lazyinject {
//是否开启注入
enable true
//启用编译期间类型匹配,可以减少运行期间反射,建议开启
optimize true
//包名数组,过滤需要注入的包,加快编译
includes "virtual"
}
*/

android {
compileSdkVersion 30
Expand All @@ -19,8 +7,8 @@ android {
applicationId "io.virtualapp.sandvxposed"
minSdkVersion 21
targetSdkVersion 28
versionCode 85
versionName "1.2.5.1.3.1.7.3"
versionCode 88
versionName "1.2.5.1.3.1.7.6"
multiDexEnabled true
android {
defaultConfig {
Expand Down Expand Up @@ -71,15 +59,15 @@ android {
}

dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
api fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')
api project(':lib')
// Update to AndroidX on 2019/06/07
//Android Lib
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.melnykov:floatingactionbutton:1.3.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
//Promise Support
implementation 'org.jdeferred:jdeferred-android-aar:1.2.4'
Expand All @@ -93,10 +81,6 @@ dependencies {
implementation 'androidx.recyclerview:recyclerview:1.1.0'
// annotationProcessor 'com.trend.lazyinject:compiler:3.4.0-beta'

// TX移动统计,非必要,大家可在构建的时候删掉
implementation 'com.qq.mta:mta:3.7.1-release'
implementation 'com.tencent.mid:mid:4.1.5-release'

// ZLoadingView
api 'com.zyao89:zloading:1.2.0'

Expand Down
41 changes: 0 additions & 41 deletions app/dict.txt

This file was deleted.

Binary file added app/libs/Baidu_Mtj_android_4.0.3.6.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions app/proguard-baidu-mtj.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

-keep class com.baidu.mobstat.** { *; }
26 changes: 25 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.virtualapp">

<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -14,7 +15,30 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/sknetsec"
android:theme="@style/AppTheme">
android:theme="@style/AppTheme"
tools:ignore="UnusedAttribute">
<meta-data
android:name="BaiduMobAd_STAT_ID"
android:value="ed51395236" />
<meta-data
android:name="BaiduMobAd_CHANNEL"
android:value="SandVXposed" />
<meta-data
android:name="BaiduMobAd_EXCEPTION_LOG"
android:value="true" />
<meta-data
android:name="BaiduMobAd_ONLY_WIFI"
android:value="false" />
<meta-data
android:name="BaiduMobAd_CELL_LOCATION"
android:value="true" />
<meta-data
android:name="BaiduMobAd_GPS_LOCATION"
android:value="false" />
<meta-data
android:name="BaiduMobAd_WIFI_LOCATION"
android:value="true" />

<activity
android:name="com.zhongcheng.openva.zchome.ZCHome"
android:label="@string/title_activity_zchome"
Expand Down
7 changes: 5 additions & 2 deletions app/src/main/java/io/virtualapp/VApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import com.lody.virtual.helper.utils.VLog;
import com.lody.virtual.sandxposed.SandXposed;
import com.sk.dexdumper.DumpDexV2;
// import com.trend.lazyinject.buildmap.Auto_ComponentBuildMap;
// import com.trend.lazyinject.lib.LazyInject;

import io.virtualapp.delegate.MyAppRequestListener;
import io.virtualapp.delegate.MyComponentDelegate;
Expand Down Expand Up @@ -42,6 +40,11 @@ protected void attachBaseContext(Context base) {
{
com.sk.SKAppLoad.InitApp.bindApplicationPassCheck();
}
try{
com.sk.SKAppLoad.InitApp.emplaceDeviceCompat();
}catch (Exception ignored)
{
}
SandXposed.init(BuildConfig.DEBUG);
VLog.OPEN_LOG = BuildConfig.DEBUG;
mPreferences = base.getSharedPreferences("va", Context.MODE_MULTI_PROCESS);
Expand Down
24 changes: 15 additions & 9 deletions app/src/main/java/io/virtualapp/home/ListAppActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@
import java.util.ArrayList;

import io.virtualapp.R;
import io.virtualapp.VApp;
import io.virtualapp.VCommends;
import io.virtualapp.abs.ui.VActivity;
import io.virtualapp.home.adapters.AppChooseAct;
import io.virtualapp.home.adapters.AppPagerAdapter;
import io.virtualapp.home.models.AppInfoLite;
import sk.vpkg.provider.BanNotificationProvider;

/**
* @author Lody
Expand Down Expand Up @@ -92,17 +94,21 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
mViewPager.setAdapter(new AppPagerAdapter(getSupportFragmentManager()));
mTabLayout.setupWithViewPager(mViewPager);
// Request permission to access external storage
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
String szEnableRedirectStorage = BanNotificationProvider.getString(VApp.getApp(),"enablePackageScan");
if(szEnableRedirectStorage != null)
{
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE
}, 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
{
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{
Manifest.permission.READ_EXTERNAL_STORAGE
}, 0);
}
}
}
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public PackageAppData(Context context, InstalledAppInfo installedAppInfo) {
this.packageName = installedAppInfo.packageName;
this.isFirstOpen = !installedAppInfo.isLaunched(0);
this.xposedModule = installedAppInfo.xposedModule;
versionName = installedAppInfo.getPackageInfo(0).versionName;
versionName = installedAppInfo.getPackageInfo(installedAppInfo.getInstalledUsers()[0]).versionName;
loadData(context, installedAppInfo.getApplicationInfo(installedAppInfo.getInstalledUsers()[0]));
}

Expand Down
14 changes: 5 additions & 9 deletions app/src/main/java/io/virtualapp/splash/SplashActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import com.baidu.mobstat.StatService;
import com.lody.virtual.client.core.VirtualCore;
import com.sk.desktop.SKDesktop;
import com.sk.verify.msVerify;
import com.tencent.stat.StatConfig;
import com.tencent.stat.StatService;

import io.virtualapp.R;
import io.virtualapp.VCommends;
Expand Down Expand Up @@ -158,13 +157,10 @@ private void initMTA()

private void bindMTA()
{
try
{
// [可选]设置是否打开debug输出,上线时请关闭,Logcat标签为"MtaSDK"
StatConfig.setDebugEnable(false);
// 基础统计API
StatService.registerActivityLifecycleCallbacks(this.getApplication());
}catch (Throwable e)
try{
StatService.setAuthorizedState(this, true);
StatService.start(this);
}catch (Exception e)
{
e.printStackTrace();
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<string name="sk_upgrade_localapp">默认会更新所有克隆的应用(会被更新到与本机安装版本相同),如果需要取消更新,请点击列表里面的项目。点击以后可以取消该应用的更新同步。</string>
<string name="clear_data">删除数据</string>
<string name="title_activity_app_data_manager">应用数据管理</string>
<string name="update_tips">更新日志:修复大量严重问题。</string>
<string name="update_tips">更新日志:修复主要问题。</string>
<string name="enable_wakeup">应用唤醒设置</string>
<string name="wake_up_setting">启用或者禁用程序唤醒(切断唤醒)</string>
<string name="shared_to_inner_app">分享到SVXP内部的应用</string>
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<string name="sk_upgrade_localapp">默认会更新所有克隆的应用(会被更新到与本机安装版本相同),如果需要取消更新,请点击列表里面的项目。点击以后可以取消该应用的更新同步。</string>
<string name="clear_data">删除数据</string>
<string name="title_activity_app_data_manager">应用数据管理</string>
<string name="update_tips">更新日志:修复大量严重问题。</string>
<string name="update_tips">更新日志:修复主要问题。</string>
<string name="enable_wakeup">应用唤醒设置</string>
<string name="wake_up_setting">启用或者禁用程序唤醒(切断唤醒)</string>
<string name="shared_to_inner_app">分享到SVXP内部的应用</string>
Expand Down
7 changes: 1 addition & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@ buildscript {
url 'https://dl.google.com/dl/android/maven2/'
name 'Google'
}
maven {
url 'https://maven.fabric.io/public'
}
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:4.1.1'
// classpath 'com.android.tools.build:gradle-experimental:3.3.2'
// classpath 'com.trend.lazyinject:aopweave:3.4.0-beta'
// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -33,7 +29,6 @@ allprojects {
maven {
url "https://jitpack.io"
}
google()
}
}

Expand Down
30 changes: 25 additions & 5 deletions lib/src/main/java/com/lody/virtual/client/VClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ private void startIOUniformer() {
.getAbsolutePath();
}
}
else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
else if(BuildCompat.isQ())
{
File lpFile = VirtualCore.get().getContext().getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS);
if(lpFile!=null)
Expand All @@ -503,7 +503,7 @@ else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
else
szExtStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath();
//新建一个File,传入文件夹目录
File file = new File(szExtStoragePath + "/skdir");
File file = new File(szExtStoragePath, "skdir");
//判断文件夹是否存在,如果不存在就创建,否则不创建
if (!file.exists())
{
Expand All @@ -513,15 +513,35 @@ else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
VLog.d(TAG,"Make directory failed.");
}
}
NativeEngine.redirectDirectory(Environment.
getExternalStorageDirectory().
getAbsolutePath(), szExtStoragePath + "/skdir");
HashSet<String> mps = getMountPoints();
for(String srtMp : mps)
{
NativeEngine.redirectDirectory(srtMp, file.getAbsolutePath());
}
}catch (Throwable e)
{
// ignored.
e.printStackTrace();
}
}
else if(BuildCompat.isR())
{
HashSet<String> mps = getMountPoints();
File cacheDir =
new File(
new File(VirtualCore.get().getContext().getCacheDir(),"v_user"),
info.packageName!=null?info.packageName:"shared"
);
if(!cacheDir.exists())cacheDir.mkdirs();
for(String theMountPoint : mps)
{
File ksFile = new File(theMountPoint, "Android");
String newPath =
cacheDir.getAbsolutePath();
String oldPath = ksFile.getAbsolutePath();
NativeEngine.redirectDirectory(oldPath, newPath);
}
}

NativeEngine.enableIORedirect();
}
Expand Down
12 changes: 12 additions & 0 deletions lib/src/main/java/com/lody/virtual/client/core/VirtualCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import com.lody.virtual.server.interfaces.IPackageObserver;
import com.lody.virtual.server.interfaces.IUiCallback;

import java.io.File;
import java.io.IOException;
import java.util.List;

Expand Down Expand Up @@ -661,6 +662,17 @@ public boolean uninstallPackage(String pkgName) {
{
e.printStackTrace();
}
try{
File ext = new File(context.getCacheDir(),"v_user");
ext = new File(ext, pkgName);
if(ext.exists())
{
if(!ext.delete())ext.deleteOnExit();
}
}catch (Exception e)
{
e.printStackTrace();
}
getPkgLocation.removeLocFromPkg(pkgName);
XposedUtils.clearXposed(pkgName);
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
return super.call(who, method, args);
} catch (Throwable se) {
if (se.getCause() instanceof SecurityException && OSUtils.getInstance().isAndroidQ()) {
se.printStackTrace();
// ignored
} else {
throw se;
}
Expand Down
Loading

0 comments on commit 8384cd7

Please sign in to comment.