MD5 校验值:13dc6b335e0f136597784161f314cd8e
MainService.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.skyroam.silverhelper.msp; import a2.g; import android.app.AlertDialog; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.ServiceConnection; import android.content.pm.PackageManager; import android.content.pm.Signature; import android.os.Binder; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.Parcel; import android.os.RemoteException; import android.text.TextUtils; import android.util.Log; import android.widget.RemoteViews; import c0.e0; import com.sensorsdata.analytics.android.sdk.R; import com.sensorsdata.analytics.android.sdk.aop.push.PushAutoTrackHelper; import com.skyroam.javattlv.utils.PackageUtils; import com.skyroam.silverhelper.MyApplication; import d2.d; import d2.f; import d2.k; import java.lang.ref.WeakReference; import java.util.Random; import o1.e; import org.json.JSONObject; public class MainService extends Service { public static final int f2208n = 0; public AlertDialog f2209c; public Intent f2210d; public boolean f2211e = false; public long f2212f = 3600000; public boolean f2213g = false; public boolean f2214h = false; public boolean f2215i = false; public long f2216j = 0; public final c f2217k = new c(this); public final a f2218l = new a(); public b f2219m = new b(); public class a extends e { public a() { } @Override public final boolean onTransact(int i4, Parcel parcel, Parcel parcel2, int i5) throws RemoteException { boolean z3; MainService mainService = MainService.this; int i6 = MainService.f2208n; PackageManager packageManager = mainService.getPackageManager(); String nameForUid = packageManager.getNameForUid(Binder.getCallingUid()); if (PackageUtils.GENIEX_APP.equals(nameForUid)) { try { for (Signature signature : packageManager.getPackageInfo(nameForUid, 134217728).signingInfo.getApkContentsSigners()) { String c4 = k.c(signature.toByteArray()); if (c4.equals(PackageUtils.GENIEX_SIGN) || c4.equals(PackageUtils.GENIEX_SIGN2)) { z3 = true; break; } } } catch (Exception e4) { StringBuilder a4 = androidx.activity.result.a.a("Get Signature Failed "); a4.append(e4.getMessage()); f.e("MainService", a4.toString()); } } z3 = false; if (z3) { return super.onTransact(i4, parcel, parcel2, i5); } int i7 = MainService.f2208n; f.e("MainService", "no permission"); return false; } } public class b implements ServiceConnection { public b() { } @Override public final void onBindingDied(ComponentName componentName) { int i4 = MainService.f2208n; f.a("MainService", "onBindingDied"); super.onBindingDied(componentName); } @Override public final void onNullBinding(ComponentName componentName) { int i4 = MainService.f2208n; f.a("MainService", "onNullBinding"); MainService.this.f2211e = true; } @Override public final void onServiceConnected(ComponentName componentName, IBinder iBinder) { int i4 = MainService.f2208n; f.a("MainService", "onServiceConnected"); MainService.this.f2211e = true; } @Override public final void onServiceDisconnected(ComponentName componentName) { int i4 = MainService.f2208n; f.a("MainService", "onServiceDisconnected"); MainService.this.f2211e = false; } } public static class c extends Handler { public final WeakReference<MainService> f2222a; public Context f2223b = MyApplication.f2189c; public c(MainService mainService) { this.f2222a = new WeakReference<>(mainService); } @Override public final void handleMessage(Message message) { try { int i4 = MainService.f2208n; f.e("MainService", "handleMessage " + message.what); switch (message.what) { case 1: this.f2223b.startActivity((Intent) message.obj); break; case 2: this.f2223b.sendBroadcast((Intent) message.obj); break; case 3: MainService mainService = this.f2222a.get(); if (mainService != null) { mainService.b((Intent) message.obj, false); break; } break; case 4: MainService mainService2 = this.f2222a.get(); if (mainService2 != null && mainService2.f2211e) { f.a("MainService", "ub " + mainService2.f2219m); mainService2.unbindService(mainService2.f2219m); mainService2.f2211e = false; break; } break; case 5: MainService mainService3 = this.f2222a.get(); if (mainService3 != null) { MainService.a(mainService3, (Intent) message.obj); break; } break; case 6: MainService mainService4 = this.f2222a.get(); if (mainService4 != null) { mainService4.startForegroundService((Intent) message.obj); break; } break; case 7: case 8: MainService mainService5 = this.f2222a.get(); if (mainService5 != null) { mainService5.f((Intent) message.obj, false); break; } break; } } catch (Exception e4) { int i5 = MainService.f2208n; StringBuilder a4 = androidx.activity.result.a.a("error "); a4.append(e4.getMessage()); f.e("MainService", a4.toString()); } } } public static void a(MainService mainService, Intent intent) { String stringExtra = intent.getStringExtra("title"); String stringExtra2 = intent.getStringExtra("content"); RemoteViews remoteViews = (RemoteViews) intent.getParcelableExtra("small"); RemoteViews remoteViews2 = (RemoteViews) intent.getParcelableExtra("big"); PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra("intent"); a2.a c4 = a2.a.c(); c4.getClass(); try { Notification.Builder builder = new Notification.Builder(a2.a.f7c, "com.skyroam.silver"); builder.setSmallIcon(R.drawable.notification).setContentTitle(stringExtra).setContentIntent(pendingIntent).setContentText(stringExtra2).setAutoCancel(true); if (Build.VERSION.SDK_INT >= 31) { builder.setStyle(new Notification.DecoratedCustomViewStyle()); } if (remoteViews2 != null) { builder.setCustomBigContentView(remoteViews2); } builder.setCustomContentView(remoteViews); NotificationManager notificationManager = c4.f9a; Notification build = builder.build(); notificationManager.notify(10, build); PushAutoTrackHelper.onNotify(notificationManager, 10, build); } catch (Exception e4) { StringBuilder a4 = androidx.activity.result.a.a("recall notification exception : "); a4.append(e4.toString()); f.e("a", a4.toString()); } } public final void b(Intent intent, boolean z3) { if (this.f2210d != null) { if (d.a(this).f2262a.getLong("k_1", 0L) > 0) { boolean f4 = k.f(this); if (!f4) { k.g(this, true); } bindService(intent, this.f2219m, 1); if (!f4) { k.g(this, false); } c cVar = this.f2217k; cVar.sendMessageDelayed(Message.obtain(cVar, 4, null), 60000L); } if (z3) { return; } c cVar2 = this.f2217k; cVar2.sendMessageDelayed(Message.obtain(cVar2, 3, intent), this.f2212f); } } public final void c() { try { String g4 = g.f().g(); if (TextUtils.isEmpty(g4)) { return; } JSONObject jSONObject = new JSONObject(g4); this.f2212f = jSONObject.getInt("frequency") * 60000; String string = jSONObject.getString("serverFiled"); boolean z3 = true; if (jSONObject.getInt("hitchUpFlag") != 1) { z3 = false; } this.f2213g = z3; Intent intent = new Intent(); this.f2210d = intent; intent.setPackage(PackageUtils.GENIEX_APP); this.f2210d.setComponent(new ComponentName(PackageUtils.GENIEX_APP, string)); } catch (Exception e4) { StringBuilder a4 = androidx.activity.result.a.a("error "); a4.append(e4.getMessage()); f.a("MainService", a4.toString()); } } public final void d() { c(); if (this.f2210d != null) { try { int i4 = 7; if (this.f2217k.hasMessages(this.f2215i ? 7 : 3)) { return; } long nextInt = new Random().nextInt((int) this.f2212f); f.a("MainService", "sleep " + nextInt); c cVar = this.f2217k; if (!this.f2215i) { i4 = 3; } cVar.sendMessageDelayed(Message.obtain(cVar, i4, this.f2210d), nextInt); } catch (Exception e4) { e4.printStackTrace(); } } } public final void e() { if (d.a(this).f2262a.getLong("k_1", 0L) != 0) { if (this.f2210d == null || !this.f2214h || System.currentTimeMillis() - this.f2216j <= 60000) { return; } this.f2214h = false; this.f2216j = System.currentTimeMillis(); Intent intent = new Intent(this.f2210d); intent.putExtra("com.transtech.geniex.CMD", 4); f(intent, true); return; } c(); if (this.f2213g) { try { Intent intent2 = new Intent(); intent2.setClassName(PackageUtils.GENIEX_APP, "com.transtech.geniex.PermitActivity"); intent2.putExtra("from", "AUTO_SYSTEM"); intent2.setFlags(268435456); startActivity(intent2); } catch (Exception e4) { StringBuilder a4 = androidx.activity.result.a.a("start startGeniex failed "); a4.append(e4.getMessage()); Log.w("MainService", a4.toString()); } } } public final void f(Intent intent, boolean z3) { if (this.f2210d != null) { if (d.a(this).f2262a.getLong("k_1", 0L) > 0) { try { boolean f4 = k.f(this); if (!f4) { k.g(this, true); } startService(intent); if (!f4) { k.g(this, false); } } catch (Throwable unused) { } } if (z3) { return; } this.f2217k.removeMessages(7); c cVar = this.f2217k; cVar.sendMessageDelayed(Message.obtain(cVar, 7, intent), this.f2212f); } } @Override public final IBinder onBind(Intent intent) { return this.f2218l; } @Override public final void onCreate() { int i4; super.onCreate(); if (!e0.n(getApplicationContext())) { f.a("MainService", "CloudControl disable, exit"); System.exit(0); return; } f.a("MainService", "onCreate"); k.a(this); Context applicationContext = getApplicationContext(); int i5 = m1.k.f3089a; try { i4 = applicationContext.getPackageManager().getPackageInfo(PackageUtils.GENIEX_APP, 0).versionCode; } catch (PackageManager.NameNotFoundException unused) { i4 = 0; } this.f2215i = i4 >= 1646; d(); } @Override public final void onDestroy() { super.onDestroy(); f.a("MainService", "onDestroy"); this.f2217k.removeCallbacksAndMessages(null); } @Override public final int onStartCommand(Intent intent, int i4, int i5) { PushAutoTrackHelper.onServiceStartCommand(this, intent, i4, i5); if (intent != null) { try { if ("sub".equals(intent.getAction())) { d(); } else if ("launch".equals(intent.getAction())) { e(); } else if ("load".equals(intent.getAction())) { if (this.f2215i) { f(this.f2210d, true); } else { b(this.f2210d, true); } } } catch (Exception e4) { StringBuilder a4 = androidx.activity.result.a.a("error "); a4.append(e4.getMessage()); f.e("MainService", a4.toString()); } } return 1; } }