Commit 50678f5 1 parent f2fef8e commit 50678f5 Copy full SHA for 50678f5
File tree 6 files changed +86
-1
lines changed
loader/src/main/kotlin/com/tencent/shadow/core/loader/managers
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/test-plugin-general-cases/src/main
java/com/tencent/shadow/test/plugin/general_cases/lib/usecases/context
6 files changed +86
-1
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,8 @@ internal class PluginPackageManagerImpl(
95
95
return hostPackageManager.resolveService(intent, flags)
96
96
}
97
97
98
+ override fun getArchiveFilePath () = pluginArchiveFilePath
99
+
98
100
private fun <T : ComponentInfo > getComponentInfo (
99
101
component : ComponentName ,
100
102
flags : Int ,
Original file line number Diff line number Diff line change 7
7
import android .content .pm .PackageInfo ;
8
8
import android .content .pm .ProviderInfo ;
9
9
import android .content .pm .ResolveInfo ;
10
-
11
10
import android .content .pm .ServiceInfo ;
12
11
13
12
import java .util .List ;
@@ -28,4 +27,6 @@ public interface PluginPackageManager {
28
27
ResolveInfo resolveActivity (Intent intent , int flags );
29
28
30
29
ResolveInfo resolveService (Intent intent , int flags );
30
+
31
+ String getArchiveFilePath ();
31
32
}
Original file line number Diff line number Diff line change @@ -283,6 +283,12 @@ public void unregisterReceiver(BroadcastReceiver receiver) {
283
283
}
284
284
}
285
285
286
+ @ Override
287
+ public String getPackageCodePath () {
288
+ PluginPartInfo pluginInfo = PluginPartInfoManager .getPluginInfo (getClassLoader ());
289
+ return pluginInfo .packageManager .getArchiveFilePath ();
290
+ }
291
+
286
292
private BroadcastReceiverWapper wrapBroadcastReceiver (BroadcastReceiver receiver ) {
287
293
if (receiver == null ) {
288
294
return null ;
Original file line number Diff line number Diff line change
1
+ package com .tencent .shadow .test .cases .plugin_main ;
2
+
3
+ import android .content .Intent ;
4
+
5
+ import androidx .test .core .app .ApplicationProvider ;
6
+ import androidx .test .ext .junit .runners .AndroidJUnit4 ;
7
+ import androidx .test .filters .LargeTest ;
8
+
9
+ import org .junit .Test ;
10
+ import org .junit .runner .RunWith ;
11
+
12
+
13
+ @ RunWith (AndroidJUnit4 .class )
14
+ @ LargeTest
15
+ public class ContextGetPackageCodePathTest extends PluginMainAppTest {
16
+
17
+ @ Override
18
+ protected Intent getLaunchIntent () {
19
+ Intent pluginIntent = new Intent ();
20
+ String packageName = ApplicationProvider .getApplicationContext ().getPackageName ();
21
+ pluginIntent .setClassName (
22
+ packageName ,
23
+ "com.tencent.shadow.test.plugin.general_cases.lib.usecases.context.ContextGetPackageCodePathTestActivity"
24
+ );
25
+ return pluginIntent ;
26
+ }
27
+
28
+ @ Test
29
+ public void testGetPackageCodePath () {
30
+ matchSubstringWithViewTag ("PackageCodePath" , "/plugin-debug.zip/test-plugin-general-cases-plugin-debug.apk" );
31
+ }
32
+
33
+ }
Original file line number Diff line number Diff line change 95
95
<activity android : name =" .lib.usecases.application.ActivityLifecycleCallbacksTestActivity" />
96
96
<activity android : name =" .lib.usecases.classloader.TestBootClassloaderActivity" />
97
97
<activity android : name =" .lib.usecases.context.TestLayoutInflaterActivity" />
98
+ <activity android : name =" .lib.usecases.context.ContextGetPackageCodePathTestActivity" />
98
99
99
100
<provider
100
101
android : name =" .lib.usecases.provider.TestProvider"
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Tencent is pleased to support the open source community by making Tencent Shadow available.
3
+ * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved.
4
+ *
5
+ * Licensed under the BSD 3-Clause License (the "License"); you may not use
6
+ * this file except in compliance with the License. You may obtain a copy of
7
+ * the License at
8
+ *
9
+ * https://opensource.org/licenses/BSD-3-Clause
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ *
17
+ */
18
+
19
+ package com .tencent .shadow .test .plugin .general_cases .lib .usecases .context ;
20
+
21
+ import android .app .Activity ;
22
+ import android .os .Bundle ;
23
+ import android .view .ViewGroup ;
24
+
25
+ import com .tencent .shadow .test .plugin .general_cases .lib .gallery .util .UiUtil ;
26
+
27
+ public class ContextGetPackageCodePathTestActivity extends Activity {
28
+ @ Override
29
+ protected void onCreate (Bundle savedInstanceState ) {
30
+ super .onCreate (savedInstanceState );
31
+ ViewGroup mItemViewGroup = UiUtil .setActivityContentView (this );
32
+
33
+ mItemViewGroup .addView (
34
+ UiUtil .makeItem (
35
+ this ,
36
+ "PackageCodePath" ,
37
+ "PackageCodePath" ,
38
+ getPackageCodePath ()
39
+ )
40
+ );
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments