2
2
3
3
import android .app .Application ;
4
4
import android .content .Context ;
5
- import android .content .SharedPreferences ;
6
5
import android .os .Build ;
7
6
8
- import com .crashlytics .android .Crashlytics ;
9
7
import com .lody .virtual .client .NativeEngine ;
10
8
import com .lody .virtual .client .core .VirtualCore ;
11
9
import com .lody .virtual .client .stub .VASettings ;
12
- import com .lody .virtual .os .VEnvironment ;
13
10
14
- import io .fabric .sdk .android .Fabric ;
15
- import io .virtualapp .delegate .MyAppRequestListener ;
16
- import io .virtualapp .delegate .MyComponentDelegate ;
17
- import io .virtualapp .delegate .MyCrashHandler ;
18
- import io .virtualapp .delegate .MyPhoneInfoDelegate ;
19
- import io .virtualapp .delegate .MyTaskDescDelegate ;
20
- import jonathanfinerty .once .Once ;
21
- import me .weishu .exposed .LogcatService ;
11
+ import io .virtualapp .delegate .MyVirtualInitializer ;
22
12
23
13
/**
24
14
* @author Lody
@@ -30,7 +20,6 @@ public class XApp extends Application {
30
20
public static final String XPOSED_INSTALLER_PACKAGE = "de.robv.android.xposed.installer" ;
31
21
32
22
private static XApp gApp ;
33
- private SharedPreferences mPreferences ;
34
23
35
24
public static XApp getApp () {
36
25
return gApp ;
@@ -43,7 +32,6 @@ protected void attachBaseContext(Context base) {
43
32
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N ) {
44
33
NativeEngine .disableJit (Build .VERSION .SDK_INT );
45
34
}
46
- mPreferences = base .getSharedPreferences ("va" , Context .MODE_MULTI_PROCESS );
47
35
VASettings .ENABLE_IO_REDIRECT = true ;
48
36
VASettings .ENABLE_INNER_SHORTCUT = false ;
49
37
try {
@@ -57,47 +45,7 @@ protected void attachBaseContext(Context base) {
57
45
public void onCreate () {
58
46
super .onCreate ();
59
47
VirtualCore virtualCore = VirtualCore .get ();
60
- virtualCore .initialize (new VirtualCore .VirtualInitializer () {
61
-
62
- @ Override
63
- public void onMainProcess () {
64
- Once .initialise (XApp .this );
65
- Fabric .with (XApp .this , new Crashlytics ());
66
- }
67
-
68
- @ Override
69
- public void onVirtualProcess () {
70
- Fabric .with (XApp .this , new Crashlytics ());
71
-
72
- //listener components
73
- virtualCore .setComponentDelegate (new MyComponentDelegate ());
74
- //fake phone imei,macAddress,BluetoothAddress
75
- virtualCore .setPhoneInfoDelegate (new MyPhoneInfoDelegate ());
76
- //fake task description's icon and title
77
- virtualCore .setTaskDescriptionDelegate (new MyTaskDescDelegate ());
78
- virtualCore .setCrashHandler (new MyCrashHandler ());
79
-
80
- // ensure the logcat service alive when every virtual process start.
81
- LogcatService .start (XApp .this , VEnvironment .getDataUserPackageDirectory (0 , XPOSED_INSTALLER_PACKAGE ));
82
- }
83
-
84
- @ Override
85
- public void onServerProcess () {
86
- virtualCore .setAppRequestListener (new MyAppRequestListener (XApp .this ));
87
- virtualCore .addVisibleOutsidePackage ("com.tencent.mobileqq" );
88
- virtualCore .addVisibleOutsidePackage ("com.tencent.mobileqqi" );
89
- virtualCore .addVisibleOutsidePackage ("com.tencent.minihd.qq" );
90
- virtualCore .addVisibleOutsidePackage ("com.tencent.qqlite" );
91
- virtualCore .addVisibleOutsidePackage ("com.facebook.katana" );
92
- virtualCore .addVisibleOutsidePackage ("com.whatsapp" );
93
- virtualCore .addVisibleOutsidePackage ("com.tencent.mm" );
94
- virtualCore .addVisibleOutsidePackage ("com.immomo.momo" );
95
- }
96
- });
97
- }
98
-
99
- public static SharedPreferences getPreferences () {
100
- return getApp ().mPreferences ;
48
+ virtualCore .initialize (new MyVirtualInitializer (this , virtualCore ));
101
49
}
102
50
103
51
}
0 commit comments