80,470
社区成员




//系统应用路径(/system/app/)
final File path =new File( Environment.getRootDirectory(),"/app");
File file = new File(path, "/Launcher3");
if (!file.exists()) {
file = new File(path, "/Launcher");
}
if (file.exists()) {
//系统桌面路径
final String finalFile = file.getAbsolutePath();
ThreadPools.execute(() -> {
//单用户模式
String cmd="mount -o rw,remount /system";
//强制删除系统桌面
String delLauncher="rm -rf "+ finalFile;
//修改文件权限
String modifyPermissionsCmd="chmod 777 /system";
//移动app到system/app下
String moveCmd="cp " + getPackageResourcePath() + " " + path.getAbsolutePath();
//重启
String reboot ="reboot";
AppUtils.executeCmd(cmd,delLauncher,modifyPermissionsCmd,moveCmd,reboot);
});
}
ThreadPools是线程池,AppUtils.executeCmd是操作命令<activity android:name=".MainActivity">
<intent-filter>
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
这个让系统层面实现会简单很多
解决了没有啊,我也遇到了。。。
做个人吧。。。。。在这样搞 我们这行 就臭了
2L可以将系统桌面替换成应用界面,但是操作跳转到其他活动界面之后返回好像会重新走一遍主活动界面流程,导致一些变量重新初始化 [quote=引用 16 楼 立青_ 的回复:][quote=引用 12 楼 SentinEM 的回复:][quote=引用 10 楼 心的夙愿 的回复:]解决了没有啊,我也遇到了。。。
//系统应用路径(/system/app/)
final File path =new File( Environment.getRootDirectory(),"/app");
File file = new File(path, "/Launcher3");
if (!file.exists()) {
file = new File(path, "/Launcher");
}
if (file.exists()) {
//系统桌面路径
final String finalFile = file.getAbsolutePath();
ThreadPools.execute(() -> {
//单用户模式
String cmd="mount -o rw,remount /system";
//强制删除系统桌面
String delLauncher="rm -rf "+ finalFile;
//修改文件权限
String modifyPermissionsCmd="chmod 777 /system";
//移动app到system/app下
String moveCmd="cp " + getPackageResourcePath() + " " + path.getAbsolutePath();
//重启
String reboot ="reboot";
AppUtils.executeCmd(cmd,delLauncher,modifyPermissionsCmd,moveCmd,reboot);
});
}
2L可以将系统桌面替换成应用界面,但是操作跳转到其他活动界面之后返回好像会重新走一遍主活动界面流程,导致一些变量重新初始化 [quote=引用 12 楼 SentinEM 的回复:][quote=引用 10 楼 心的夙愿 的回复:]解决了没有啊,我也遇到了。。。
//系统应用路径(/system/app/)
final File path =new File( Environment.getRootDirectory(),"/app");
File file = new File(path, "/Launcher3");
if (!file.exists()) {
file = new File(path, "/Launcher");
}
if (file.exists()) {
//系统桌面路径
final String finalFile = file.getAbsolutePath();
ThreadPools.execute(() -> {
//单用户模式
String cmd="mount -o rw,remount /system";
//强制删除系统桌面
String delLauncher="rm -rf "+ finalFile;
//修改文件权限
String modifyPermissionsCmd="chmod 777 /system";
//移动app到system/app下
String moveCmd="cp " + getPackageResourcePath() + " " + path.getAbsolutePath();
//重启
String reboot ="reboot";
AppUtils.executeCmd(cmd,delLauncher,modifyPermissionsCmd,moveCmd,reboot);
});
}
ThreadPools是线程池,AppUtils.executeCmd是操作命令[/quote]没有其他回复就拿你的结帖了...2L可以将系统桌面替换成应用界面,但是操作跳转到其他活动界面之后返回好像会重新走一遍主活动界面流程,导致一些变量重新初始化 [quote=引用 10 楼 心的夙愿 的回复:]解决了没有啊,我也遇到了。。。
//系统应用路径(/system/app/)
final File path =new File( Environment.getRootDirectory(),"/app");
File file = new File(path, "/Launcher3");
if (!file.exists()) {
file = new File(path, "/Launcher");
}
if (file.exists()) {
//系统桌面路径
final String finalFile = file.getAbsolutePath();
ThreadPools.execute(() -> {
//单用户模式
String cmd="mount -o rw,remount /system";
//强制删除系统桌面
String delLauncher="rm -rf "+ finalFile;
//修改文件权限
String modifyPermissionsCmd="chmod 777 /system";
//移动app到system/app下
String moveCmd="cp " + getPackageResourcePath() + " " + path.getAbsolutePath();
//重启
String reboot ="reboot";
AppUtils.executeCmd(cmd,delLauncher,modifyPermissionsCmd,moveCmd,reboot);
});
}