forked from android-hacker/VirtualXposed
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tiann <twsxtd@gmail.com>
- Loading branch information
Showing
4 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...lApp/lib/src/main/java/com/lody/virtual/client/hook/proxies/battery/BatteryStatsStub.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.lody.virtual.client.hook.proxies.battery; | ||
|
||
import android.content.Context; | ||
import android.os.IInterface; | ||
|
||
import com.lody.virtual.client.core.VirtualCore; | ||
import com.lody.virtual.client.hook.base.BinderInvocationProxy; | ||
import com.lody.virtual.client.hook.base.ReplaceLastUidMethodProxy; | ||
|
||
import mirror.com.android.internal.os.health.SystemHealthManager; | ||
|
||
/** | ||
* @author weishu | ||
* @date 2020/11/24. | ||
*/ | ||
public class BatteryStatsStub extends BinderInvocationProxy { | ||
|
||
public BatteryStatsStub() { | ||
super(getInterface(), "batterystats"); | ||
} | ||
|
||
private static IInterface getInterface() { | ||
Object manager = VirtualCore.get().getContext().getSystemService(Context.SYSTEM_HEALTH_SERVICE); | ||
return SystemHealthManager.mBatteryStats.get(manager); | ||
} | ||
|
||
@Override | ||
protected void onBindMethods() { | ||
super.onBindMethods(); | ||
|
||
addMethodProxy(new ReplaceLastUidMethodProxy("takeUidSnapshot")); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
VirtualApp/lib/src/main/java/mirror/com/android/internal/app/IBatteryStats.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package mirror.com.android.internal.app; | ||
|
||
import android.os.IBinder; | ||
import android.os.IInterface; | ||
|
||
import mirror.MethodParams; | ||
import mirror.RefClass; | ||
import mirror.RefStaticMethod; | ||
|
||
/** | ||
* @author weishu | ||
* @date 2020/11/24. | ||
*/ | ||
|
||
public class IBatteryStats { | ||
public static Class<?> TYPE = RefClass.load(IBatteryStats.class, "com.android.internal.app.IBatteryStats"); | ||
|
||
public static class Stub { | ||
public static Class<?> TYPE = RefClass.load(IBatteryStats.Stub.class, "com.android.internal.app.IBatteryStats$Stub"); | ||
@MethodParams({IBinder.class}) | ||
public static RefStaticMethod<IInterface> asInterface; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
VirtualApp/lib/src/main/java/mirror/com/android/internal/os/health/SystemHealthManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package mirror.com.android.internal.os.health; | ||
|
||
import android.os.IInterface; | ||
|
||
import mirror.RefClass; | ||
import mirror.RefObject; | ||
|
||
/** | ||
* @author weishu | ||
* @date 2020/11/24. | ||
*/ | ||
|
||
public class SystemHealthManager { | ||
public static Class<?> TYPE = RefClass.load(SystemHealthManager.class, "android.os.health.SystemHealthManager"); | ||
|
||
public static RefObject<IInterface> mBatteryStats; | ||
} |