Skip to content

Commit 9cf9517

Browse files
committed
[service] change service publish solution
1 parent 0cdc808 commit 9cf9517

File tree

5 files changed

+31
-1
lines changed

5 files changed

+31
-1
lines changed

android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/app/ThanosManagerNative.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
import static github.tornaco.android.thanos.core.app.ThanosManager.PROXIED_ANDROID_SERVICE_NAME;
44

5+
import android.content.Context;
6+
import android.content.pm.ParceledListSlice;
7+
import android.os.Bundle;
58
import android.os.IBinder;
69
import android.os.Parcel;
710
import android.os.RemoteException;
811
import android.os.ServiceManager;
912

13+
import com.android.internal.appwidget.IAppWidgetService;
1014
import com.elvishew.xlog.XLog;
1115

1216
import github.tornaco.android.thanos.core.IThanos;
@@ -27,6 +31,23 @@ protected IThanos create() {
2731
if (localService != null) {
2832
return localService;
2933
}
34+
35+
try {
36+
IAppWidgetService appWidgetService = IAppWidgetService.Stub.asInterface(ServiceManager.getService(Context.APPWIDGET_SERVICE));
37+
ParceledListSlice list = appWidgetService.startListening(null, "thanox", 6, new int[]{2, 0, 2, 3});
38+
XLog.d("IAppWidgetService thanox list: " + list);
39+
Bundle bundle = (Bundle) list.getList().get(0);
40+
IBinder thanox = bundle.getBinder("thanox-binder");
41+
XLog.d("IAppWidgetService thanox binder: " + thanox);
42+
IThanos thanos = IThanos.Stub.asInterface(thanox);
43+
if (thanos != null) {
44+
return thanos;
45+
}
46+
} catch (Throwable e) {
47+
XLog.e(e, "call IAppWidgetService");
48+
}
49+
50+
3051
IThanos thanos = IThanos.Stub.asInterface(
3152
ServiceManager.getService(T.serviceInstallName()));
3253
if (thanos != null) {

android/app/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ dependencies {
180180

181181
compileOnly(Libs.Others.xposedApi)
182182

183+
implementation(Libs.Others.hiddenApiByPass)
184+
183185
implementation(Libs.Others.retrofit)
184186
implementation(Libs.Others.retrofitConverterGson)
185187
implementation(Libs.Others.retrofitAdapterRxJava2)

android/app/src/main/java/github/tornaco/android/thanos/ThanosApp.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package github.tornaco.android.thanos
1919

2020
import android.content.Context
21+
import android.os.Build
2122
import com.elvishew.xlog.XLog
2223
import dagger.hilt.android.HiltAndroidApp
2324
import dev.enro.annotations.NavigationComponent
@@ -33,6 +34,7 @@ import github.tornaco.android.thanos.core.app.AppGlobals
3334
import github.tornaco.thanos.android.noroot.NoRootSupport
3435
import github.tornaco.thanos.module.component.manager.initRules
3536
import io.reactivex.plugins.RxJavaPlugins
37+
import org.lsposed.hiddenapibypass.HiddenApiBypass
3638

3739
@HiltAndroidApp
3840
@NavigationComponent
@@ -63,6 +65,10 @@ class ThanosApp : MultipleModulesApp(), NavigationApplication {
6365
DeveloperDiag.diag(this)
6466
}
6567

68+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
69+
HiddenApiBypass.addHiddenApiExemptions("")
70+
}
71+
6672
Init.init(this)
6773
FeatureAccessStats.init(this)
6874
initRules(this.applicationContext)

android/buildSrc/src/main/kotlin/tornaco/project/android/thanox/Dependencies.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ object Libs {
138138
const val glideCompiler = "com.github.bumptech.glide:compiler:4.13.0"
139139

140140
const val xposedApi = "de.robv.android.xposed:api:82"
141+
const val hiddenApiByPass = "org.lsposed.hiddenapibypass:hiddenapibypass:4.3"
141142

142143
const val lombok = "org.projectlombok:lombok:1.18.20"
143144

0 commit comments

Comments
 (0)