version:5.6

fix:
update:设置默认桌面不再打开
This commit is contained in:
2022-07-06 09:18:48 +08:00
parent 5b49f1370f
commit 45ce0fc8ee
3 changed files with 27 additions and 13 deletions

View File

@@ -10,6 +10,7 @@ import android.util.Log;
import com.aoleyun.sn.SystemInfoInterface; import com.aoleyun.sn.SystemInfoInterface;
import com.aoleyun.sn.utils.ForegroundAppUtil; import com.aoleyun.sn.utils.ForegroundAppUtil;
import com.aoleyun.sn.utils.JGYUtils; import com.aoleyun.sn.utils.JGYUtils;
import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.Utils; import com.aoleyun.sn.utils.Utils;
import java.util.List; import java.util.List;
@@ -63,12 +64,14 @@ public class RemoteService extends Service {
@Override @Override
public boolean SystemPutInt(String name, int value) throws RemoteException { public boolean SystemPutInt(String name, int value) throws RemoteException {
Log.e(TAG, "SystemPutInt: " + "name = " + name + "\t value = " + value);
return Settings.System.putInt(getContentResolver(), name, value); return Settings.System.putInt(getContentResolver(), name, value);
} }
@Override @Override
public void setDefaultDesktop(String pkg) throws RemoteException { public void setDefaultDesktop(String pkg) throws RemoteException {
JGYUtils.getInstance().setDefaultDesktop(pkg); JGYUtils.getInstance().setDefaultDesktop(pkg);
SPUtils.put(RemoteService.this, "default_launcher", pkg);
} }
}; };
} }

View File

@@ -15,6 +15,7 @@ import com.aoleyun.sn.utils.SPUtils;
import com.aoleyun.sn.utils.ToastUtil; import com.aoleyun.sn.utils.ToastUtil;
import com.aoleyun.sn.utils.URLUtils; import com.aoleyun.sn.utils.URLUtils;
import com.aoleyun.sn.utils.Utils; import com.aoleyun.sn.utils.Utils;
import com.arialyy.aria.orm.annotation.Ignore;
import com.tencent.mmkv.MMKV; import com.tencent.mmkv.MMKV;
import com.trello.rxlifecycle4.android.ActivityEvent; import com.trello.rxlifecycle4.android.ActivityEvent;
@@ -253,13 +254,19 @@ public class MainSPresenter implements MainSContact.Presenter {
if (JGYUtils.isOfficialVersion() || !JGYUtils.getInstance().getDeviceIsLocked()) { if (JGYUtils.isOfficialVersion() || !JGYUtils.getInstance().getDeviceIsLocked()) {
mView.getDefaultDesktopFinish(); mView.getDefaultDesktopFinish();
} else { } else {
NetInterfaceManager.getInstance() int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
.getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() { if (JGYUtils.getInstance().isAihuaFramwwork() && aihuaUnlock == 1) {
@Override mView.getDefaultDesktopFinish();
public void onComplete() { } else {
mView.getDefaultDesktopFinish(); NetInterfaceManager.getInstance()
} .getDefaultDesktop(true, getLifecycle(), new NetInterfaceManager.onCompleteCallback() {
}); @Override
public void onComplete() {
mView.getDefaultDesktopFinish();
}
});
}
} }
} }

View File

@@ -2080,22 +2080,26 @@ public class JGYUtils {
// setDefaultLauncher(mContext, pkg, className); // setDefaultLauncher(mContext, pkg, className);
Log.e(TAG, "setDefaultDesktop: setDefaultLauncher"); Log.e(TAG, "setDefaultDesktop: setDefaultLauncher");
} }
String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", ""); // String oldDesktop = (String) SPUtils.get(mContext, "default_launcher", "");
if (Objects.equals(oldDesktop, pkg)) { // if (Objects.equals(oldDesktop, pkg)) {
Log.e(TAG, "setDefaultDesktop: " + "数据一致"); // Log.e(TAG, "setDefaultDesktop: " + "数据一致");
return; // return;
} // }
Intent intent = new Intent("setDefaultLauncher"); Intent intent = new Intent("setDefaultLauncher");
intent.putExtra("package", pkg); intent.putExtra("package", pkg);
intent.putExtra("className", className); intent.putExtra("className", className);
if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) { if (JGYUtils.getInstance().checkAppPlatform() == MTKPlatform) {
Log.e(TAG, "setDefaultDesktop: MTK");
//爱华定制 //爱华定制
intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver")); intent.setComponent(new ComponentName("com.android.settings", "com.android.settings.AoleReceiver"));
// TODO: 2022/7/6 有问题
setDefaultLauncher(mContext, "com.android.transfer", "com.android.transfer.MainActivity"); setDefaultLauncher(mContext, "com.android.transfer", "com.android.transfer.MainActivity");
SystemProperties.set("persist.sys.launcher.pkgname", pkg);
SystemProperties.set("persist.sys.launcher.classname", className);
} }
intent.setPackage("com.android.settings"); intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent); mContext.sendBroadcast(intent);
ApkUtils.openPackage(mContext, pkg); // ApkUtils.openPackage(mContext, pkg);
Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className); Log.e(TAG, "setDefaultDesktop: " + pkg + ":" + className);
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname")); Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.pkgname = " + SystemProperties.get("persist.sys.launcher.pkgname"));
Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.classname = " + SystemProperties.get("persist.sys.launcher.classname")); Log.e(TAG, "setDefaultDesktop: " + "persist.sys.launcher.classname = " + SystemProperties.get("persist.sys.launcher.classname"));