File tree Expand file tree Collapse file tree
VirtualApp/lib/src/main/java
mirror/com/android/internal Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1515import com .lody .virtual .client .hook .proxies .appwidget .AppWidgetManagerStub ;
1616import com .lody .virtual .client .hook .proxies .audio .AudioManagerStub ;
1717import com .lody .virtual .client .hook .proxies .backup .BackupManagerStub ;
18+ import com .lody .virtual .client .hook .proxies .battery .BatteryStatsStub ;
1819import com .lody .virtual .client .hook .proxies .bluetooth .BluetoothStub ;
1920import com .lody .virtual .client .hook .proxies .clipboard .ClipBoardStub ;
2021import com .lody .virtual .client .hook .proxies .connectivity .ConnectivityStub ;
@@ -187,6 +188,8 @@ private void injectInternal() throws Throwable {
187188 addInjector (new WifiScannerStub ());
188189 addInjector (new ShortcutServiceStub ());
189190 addInjector (new DevicePolicyManagerStub ());
191+
192+ addInjector (new BatteryStatsStub ());
190193 }
191194 if (BuildCompat .isOreo ()) {
192195 addInjector (new AutoFillManagerStub ());
Original file line number Diff line number Diff line change 1+ package com .lody .virtual .client .hook .proxies .battery ;
2+
3+ import android .content .Context ;
4+ import android .os .IInterface ;
5+
6+ import com .lody .virtual .client .core .VirtualCore ;
7+ import com .lody .virtual .client .hook .base .BinderInvocationProxy ;
8+ import com .lody .virtual .client .hook .base .ReplaceLastUidMethodProxy ;
9+
10+ import mirror .com .android .internal .os .health .SystemHealthManager ;
11+
12+ /**
13+ * @author weishu
14+ * @date 2020/11/24.
15+ */
16+ public class BatteryStatsStub extends BinderInvocationProxy {
17+
18+ public BatteryStatsStub () {
19+ super (getInterface (), "batterystats" );
20+ }
21+
22+ private static IInterface getInterface () {
23+ Object manager = VirtualCore .get ().getContext ().getSystemService (Context .SYSTEM_HEALTH_SERVICE );
24+ return SystemHealthManager .mBatteryStats .get (manager );
25+ }
26+
27+ @ Override
28+ protected void onBindMethods () {
29+ super .onBindMethods ();
30+
31+ addMethodProxy (new ReplaceLastUidMethodProxy ("takeUidSnapshot" ));
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ package mirror .com .android .internal .app ;
2+
3+ import android .os .IBinder ;
4+ import android .os .IInterface ;
5+
6+ import mirror .MethodParams ;
7+ import mirror .RefClass ;
8+ import mirror .RefStaticMethod ;
9+
10+ /**
11+ * @author weishu
12+ * @date 2020/11/24.
13+ */
14+
15+ public class IBatteryStats {
16+ public static Class <?> TYPE = RefClass .load (IBatteryStats .class , "com.android.internal.app.IBatteryStats" );
17+
18+ public static class Stub {
19+ public static Class <?> TYPE = RefClass .load (IBatteryStats .Stub .class , "com.android.internal.app.IBatteryStats$Stub" );
20+ @ MethodParams ({IBinder .class })
21+ public static RefStaticMethod <IInterface > asInterface ;
22+ }
23+ }
Original file line number Diff line number Diff line change 1+ package mirror .com .android .internal .os .health ;
2+
3+ import android .os .IInterface ;
4+
5+ import mirror .RefClass ;
6+ import mirror .RefObject ;
7+
8+ /**
9+ * @author weishu
10+ * @date 2020/11/24.
11+ */
12+
13+ public class SystemHealthManager {
14+ public static Class <?> TYPE = RefClass .load (SystemHealthManager .class , "android.os.health.SystemHealthManager" );
15+
16+ public static RefObject <IInterface > mBatteryStats ;
17+ }
You can’t perform that action at this time.
0 commit comments