未命名文档

SmartisanOS 的 smartisanos.api 包下 API 大都不需要特殊权限即可调用,其中包含一些危险 API,任何应用都可以直接调用。

锤子,你的安全意识真的不太高啊.

获取顶部activity

1
2
3
4
5
6
7
8
9
10
11
public static ComponentName getTopActivitySmartisan(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
try {
Class clazz = Class.forName("smartisanos.api.ActivityManagerSmt");
Object obj = clazz.getMethod("getInstance").invoke(null);
Method method = clazz.getMethod("getTopActivity", ActivityManager.class);
return (ComponentName) method.invoke(obj, activityManager);
} catch (Exception e) {
return null;
}
}

移除多任务卡片

1
2
3
4
5
6
7
8
9
10
11
12
public static boolean removeTaskByPackageNameSmartisan(String packageName) {
try {
Class clazz = Class.forName("smartisanos.api.ActivityManagerSmt");
Object obj = clazz.getMethod("getInstance").invoke(null);
Method method = clazz.getMethod("removeTaskByPackageName", String.class);
method.invoke(obj, packageName);
return true;
} catch (Exception e) {
Log.e(Activity2.class.getName(), e.toString());
return false;
}
}

设置 CPU 加速

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
public static boolean setCpuBoost(int ms) {
try {
Class clazz = Class.forName("smartisanos.api.PerformanceSmt");
Object obj = clazz.newInstance();
Method method = clazz.getMethod("setCpuBoost", int.class);
method.invoke(obj, ms);
return true;
} catch (Exception e) {
return false;
}
}

public static boolean releaseCpuBoost() {
try {
Class clazz = Class.forName("smartisanos.api.PerformanceSmt");
Object obj = clazz.newInstance();
Method method = clazz.getMethod("releaseCpuBoost");
method.invoke(obj);
return true;
} catch (Exception e) {
return false;
}
}


未命名文档
https://https.gs/archives/262/
作者
web1n
发布于
2019年2月11日
许可协议