Skip to content

Commit

Permalink
Major fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lianglixin committed Apr 24, 2020
1 parent 1fa14bf commit 3a5d27b
Show file tree
Hide file tree
Showing 13 changed files with 50 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId "io.virtualapp.sandvxposed"
minSdkVersion 19
targetSdkVersion 28
versionCode 76
versionName "1.2.5.1.3.1.5.7"
versionCode 77
versionName "1.2.5.1.3.1.6.0"
multiDexEnabled true
android {
defaultConfig {
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/io/virtualapp/VApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import com.lody.virtual.client.core.VirtualCore;
import com.lody.virtual.client.stub.VASettings;
import com.lody.virtual.helper.utils.VLog;
import com.lody.virtual.sandxposed.SandXposed;
// import com.trend.lazyinject.buildmap.Auto_ComponentBuildMap;
// import com.trend.lazyinject.lib.LazyInject;
Expand All @@ -32,6 +33,7 @@ public static VApp getApp() {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
SandXposed.init();
VLog.OPEN_LOG = BuildConfig.DEBUG;
mPreferences = base.getSharedPreferences("va", Context.MODE_MULTI_PROCESS);
VASettings.ENABLE_IO_REDIRECT = true;
VASettings.ENABLE_INNER_SHORTCUT = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class safePackage
{
static public String safe_Package[] =
{
"com.tencent.tim", // TIM OfficeQQ
"com.qiyi.video",//爱奇艺
"com.changba",//唱吧
"com.dianping.v1",//大众点评
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">更新日志:修复部分BUG,加入新桌面。</string>
<string name="update_tips">更新日志:修复安卓10下的BUG</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">更新日志:修复部分BUG,加入新桌面。</string>
<string name="update_tips">更新日志:修复安卓10下的BUG</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/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<string name="sk_upgrade_localapp">All applications were added to list when page was loaded. You can click item in list for cancel item form syncing.</string>
<string name="title_activity_app_data_manager">Application Data Manager</string>
<string name="clear_data">Delete Data</string>
<string name="update_tips">Update Logs: Fix bugs. Add new desktop.</string>
<string name="update_tips">Update Logs: Fix bugs within Android Q</string>
<string name="enable_wakeup">Application Wake Up</string>
<string name="wake_up_setting">Enable or disable application wake up</string>
<string name="shared_to_inner_app">Shared to SVXP\'s applications.</string>
Expand Down
3 changes: 2 additions & 1 deletion lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ gradle.startParameter.getTaskNames().each { task ->

dependencies {
api fileTree(include: ['*.jar'], dir: 'libs')
api 'com.swift.sandhook:hooklib:4.1.6'
implementation 'com.swift.sandhook:hooklib:4.2.0'
implementation 'com.swift.sandhook:nativehook:4.2.0'
// api 'com.swift.sandhook:xposedcompat:4.1.0'
api 'com.trend.lazyinject:lib:3.4.0-beta'
implementation "me.weishu:free_reflection:2.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ public String getMethodName() {
@Override
public Object call(Object who, Method method, Object... args) throws Throwable {

Log.d("Q_M", "---->StartActivity 类");
VLog.d("Q_M", "---->StartActivity 类");

int intentIndex = ArrayUtils.indexOfObject(args, Intent.class, 1);
if (intentIndex < 0) {
VLog.d("Q_M", "---->intentIndex < 0");
return ActivityManagerCompat.START_INTENT_NOT_RESOLVED;
}
int resultToIndex = ArrayUtils.indexOfObject(args, IBinder.class, 2);
Expand All @@ -124,19 +125,21 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
int userId = VUserHandle.myUserId();

if (ComponentUtils.isStubComponent(intent)) {
VLog.d("Q_M", "---->ComponentUtils.isStubComponent");
return method.invoke(who, args);
}

if (Intent.ACTION_INSTALL_PACKAGE.equals(intent.getAction())
|| (Intent.ACTION_VIEW.equals(intent.getAction())
&& "application/vnd.android.package-archive".equals(intent.getType()))) {
VLog.d("Q_M", "---->application/vnd.android.package-archive");
if (handleInstallRequest(intent)) {
return 0;
}
} else if ((Intent.ACTION_UNINSTALL_PACKAGE.equals(intent.getAction())
|| Intent.ACTION_DELETE.equals(intent.getAction()))
&& "package".equals(intent.getScheme())) {

VLog.d("Q_M", "---->package");
if (handleUninstallRequest(intent)) {
return 0;
}
Expand Down Expand Up @@ -172,9 +175,9 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
if (activityInfo == null) {
VLog.e("VActivityManager", "Unable to resolve activityInfo : " + intent);

Log.d("Q_M", "---->StartActivity who=" + who);
Log.d("Q_M", "---->StartActivity intent=" + intent);
Log.d("Q_M", "---->StartActivity resultTo=" + resultTo);
VLog.d("Q_M", "---->StartActivity who=" + who);
VLog.d("Q_M", "---->StartActivity intent=" + intent);
VLog.d("Q_M", "---->StartActivity resultTo=" + resultTo);

if (intent.getPackage() != null && isAppPkg(intent.getPackage())) {
return ActivityManagerCompat.START_INTENT_NOT_RESOLVED;
Expand All @@ -191,6 +194,8 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
}
int res = VActivityManager.get().startActivity(intent, activityInfo, resultTo, options, resultWho, requestCode, VUserHandle.myUserId());
if (res != 0 && resultTo != null && requestCode > 0) {
VLog.d("Q_M", "---->sendActivityResult to=" + resultTo+ " who "+resultWho
+" code "+requestCode);
VActivityManager.get().sendActivityResult(resultTo, resultWho, requestCode);
}
if (resultTo != null) {
Expand All @@ -200,6 +205,8 @@ public Object call(Object who, Method method, Object... args) throws Throwable {
TypedValue out = new TypedValue();
Resources.Theme theme = r.activity.getResources().newTheme();
theme.applyStyle(activityInfo.getThemeResource(), true);

VLog.d("Q_M", "---->StartActivity Anim=" + activityInfo.getThemeResource());
if (theme.resolveAttribute(android.R.attr.windowAnimationStyle, out, true)) {

TypedArray array = theme.obtainStyledAttributes(out.data,
Expand Down
27 changes: 22 additions & 5 deletions lib/src/main/java/com/lody/virtual/client/ipc/VPackageManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import android.os.RemoteException;

import com.lody.virtual.client.env.VirtualRuntime;
import com.lody.virtual.helper.compat.BuildCompat;
import com.lody.virtual.helper.ipcbus.IPCSingleton;
import com.lody.virtual.server.IPackageInstaller;
import com.lody.virtual.server.interfaces.IPackageManager;
Expand Down Expand Up @@ -171,20 +172,36 @@ public ApplicationInfo getApplicationInfo(String packageName, int flags, int use
if (info == null) {
return null;
}
final int P = 28;
final String APACHE_LEGACY = "/system/framework/org.apache.http.legacy.boot.jar";
if (android.os.Build.VERSION.SDK_INT >= P && info.targetSdkVersion < P) {
if(BuildCompat.isQ())
{
final String HTTP_LIB_Q = "/system/framework/org.apache.http.legacy.jar";
String[] newSharedLibraryFiles;
if (info.sharedLibraryFiles == null) {
newSharedLibraryFiles = new String[]{APACHE_LEGACY};
newSharedLibraryFiles = new String[]{HTTP_LIB_Q};
} else {
int newLength = info.sharedLibraryFiles.length + 1;
newSharedLibraryFiles = new String[newLength];
System.arraycopy(info.sharedLibraryFiles, 0, newSharedLibraryFiles, 0, newLength - 1);
newSharedLibraryFiles[newLength - 1] = APACHE_LEGACY;
newSharedLibraryFiles[newLength - 1] = HTTP_LIB_Q;
}
info.sharedLibraryFiles = newSharedLibraryFiles;
}
else
{
final String APACHE_LEGACY = "/system/framework/org.apache.http.legacy.boot.jar";
if (BuildCompat.isP()) {
String[] newSharedLibraryFiles;
if (info.sharedLibraryFiles == null) {
newSharedLibraryFiles = new String[]{APACHE_LEGACY};
} else {
int newLength = info.sharedLibraryFiles.length + 1;
newSharedLibraryFiles = new String[newLength];
System.arraycopy(info.sharedLibraryFiles, 0, newSharedLibraryFiles, 0, newLength - 1);
newSharedLibraryFiles[newLength - 1] = APACHE_LEGACY;
}
info.sharedLibraryFiles = newSharedLibraryFiles;
}
}
return info;
} catch (RemoteException e) {
return VirtualRuntime.crash(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public static boolean isQ() {
final int Q = 29;
return SDK == Q - 1 && getPreviewSDKInt() > 0 || Build.VERSION.SDK_INT >= Q;
}

public static boolean isP()
{
return Build.VERSION_CODES.P<=Build.VERSION.SDK_INT;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static void init() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
ReflectionUtils.passApiCheck();
}
/*

try{
if (PendingHookHandler.canWork()) {
VLog.i("SandHook", "Pending Hook Mode!");
Expand All @@ -42,7 +42,6 @@ public static void init() {
{
e.printStackTrace();
}
*/
}

public static void injectXposedModule(Context context, String packageName, String processName) {
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 3a5d27b

Please sign in to comment.