Commit a75c81c 1 parent 159ab13 commit a75c81c Copy full SHA for a75c81c
File tree 3 files changed +27
-0
lines changed
sdk/core/runtime/src/main/java/com/tencent/shadow/core/runtime
dynamic/host/test-dynamic-host/src/androidTest/java/com/tencent/shadow/test/cases/plugin_main
plugin/general-cases/general-cases-lib/src/main/java/com/tencent/shadow/test/plugin/general_cases/lib/usecases/application
3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 18
18
19
19
package com .tencent .shadow .core .runtime ;
20
20
21
+ import android .annotation .SuppressLint ;
21
22
import android .annotation .TargetApi ;
22
23
import android .app .Application ;
23
24
import android .content .BroadcastReceiver ;
@@ -158,4 +159,9 @@ public void attachBaseContext(Context base) {
158
159
public void setAppComponentFactory (ShadowAppComponentFactory factory ) {
159
160
mAppComponentFactory = factory ;
160
161
}
162
+
163
+ @ SuppressLint ("NewApi" )
164
+ public static String getProcessName () {
165
+ return Application .getProcessName ();
166
+ }
161
167
}
Original file line number Diff line number Diff line change 19
19
package com .tencent .shadow .test .cases .plugin_main ;
20
20
21
21
import android .content .Intent ;
22
+ import android .os .Build ;
22
23
23
24
import androidx .test .core .app .ApplicationProvider ;
24
25
import androidx .test .ext .junit .runners .AndroidJUnit4 ;
25
26
import androidx .test .filters .LargeTest ;
26
27
28
+ import org .junit .Assume ;
27
29
import org .junit .Test ;
28
30
import org .junit .runner .RunWith ;
29
31
@@ -48,4 +50,10 @@ public void testApplication() {
48
50
matchTextWithViewTag ("TAG_IS_ON_CREATE" , Boolean .toString (true ));
49
51
}
50
52
53
+ @ Test
54
+ public void testApplicationGetProcessName () {
55
+ Assume .assumeTrue (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P );
56
+ matchTextWithViewTag ("Application.getProcessName()" ,
57
+ ApplicationProvider .getApplicationContext ().getPackageName ());
58
+ }
51
59
}
Original file line number Diff line number Diff line change 19
19
package com .tencent .shadow .test .plugin .general_cases .lib .usecases .application ;
20
20
21
21
import android .app .Activity ;
22
+ import android .app .Application ;
23
+ import android .os .Build ;
22
24
import android .os .Bundle ;
23
25
import android .support .annotation .Nullable ;
24
26
import android .view .ViewGroup ;
@@ -43,5 +45,16 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
43
45
Boolean .toString (TestApplication .getInstance ().isOnCreate )
44
46
)
45
47
);
48
+
49
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .P ) {
50
+ mItemViewGroup .addView (
51
+ UiUtil .makeItem (
52
+ this ,
53
+ "Application.getProcessName()" ,
54
+ "Application.getProcessName()" ,
55
+ Application .getProcessName ()
56
+ )
57
+ );
58
+ }
46
59
}
47
60
}
You can’t perform that action at this time.
0 commit comments