fix:修复g10上删除手动安装的应用,修复默认输入法设置问题

update:更新头像
This commit is contained in:
2023-04-20 16:27:06 +08:00
parent c7046475da
commit 539203e818
10 changed files with 62 additions and 28 deletions

View File

@@ -442,9 +442,9 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
public void setIv_head(String url) {
if (TextUtils.isEmpty(url)) {
Glide.with(iv_head).load(getDrawable(R.drawable.default_head)).into(iv_head);
Glide.with(iv_head).load(getDrawable(R.drawable.default_avatar)).into(iv_head);
} else {
Glide.with(iv_head).load(url).error(R.drawable.default_head).into(iv_head);
Glide.with(iv_head).load(url).error(R.drawable.default_avatar).into(iv_head);
}
}
@@ -611,7 +611,7 @@ public class MainActivity extends BaseActivity implements MainAContact.MainView,
setNameText("", View.GONE);
setClassText("", View.GONE);
setBatchText("", View.GONE);
Glide.with(iv_head).load(getDrawable(R.drawable.default_head)).error(R.drawable.default_head).into(iv_head);
Glide.with(iv_head).load(getDrawable(R.drawable.default_avatar)).error(R.drawable.default_avatar).into(iv_head);
SysSettingUtils.setEnableSetting(MainActivity.this);
}
}

View File

@@ -18,5 +18,5 @@ public class PackageNames {
public static final String NOTIFICATIONS = "com.aoleyun.info";
public static final String BROWSER = "com.aoleyun.browser";
public static final String APP_STORE_BOOTRECEIVER = "com.aoleyun.appstore.receiver.BootReceiver";
public static final String LEARNING_DESKTOP = "com.aoleyunos.dop2";
}

View File

@@ -10,6 +10,8 @@ import android.os.Build;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
@@ -750,7 +752,8 @@ public class NetInterfaceManager {
.getUpdateApi().getUpdate(PackageNames.NOTIFICATIONS, JGYUtils.getInstance().checkAppPlatform());
Observable<BaseResponse<AppUpdateInfo>> browserUpdateObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.BROWSER, JGYUtils.getInstance().checkAppPlatform());
Observable<BaseResponse<AppUpdateInfo>> learningDesktopObservable = NetInterfaceManager.getInstance()
.getUpdateApi().getUpdate(PackageNames.LEARNING_DESKTOP, JGYUtils.getInstance().checkAppPlatform());
Observable.zip(infoUpdateObservable, storeUpdateObservable, desktopUpdateObservable, notifyUpdateObservable, browserUpdateObservable,
new Function5<BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, BaseResponse<AppUpdateInfo>, List<AppUpdateInfo>>() {
@Override
@@ -1773,9 +1776,9 @@ public class NetInterfaceManager {
int code = defaultAppBaseResponse.code;
if (code == OK) {
DefaultApp defaultApp = defaultAppBaseResponse.data;
setDefaultDesktop(defaultApp.getDefault_launcher());
setDefaultApp(defaultApp);
} else {
setDefaultDesktop(null);
setDefaultApp(null);
Log.e("getDefaultApp", "onNext: " + defaultAppBaseResponse.msg);
}
}
@@ -1794,6 +1797,35 @@ public class NetInterfaceManager {
});
}
private void setDefaultApp(DefaultApp defaultApp) {
if (defaultApp == null) {
Log.e(TAG, "setDefaultApp: defaultApp is null");
return;
}
String default_IME = defaultApp.getDefault_IME();
if (!TextUtils.isEmpty(default_IME)) {
Intent intent = new Intent("setDefaultInputMethod");
intent.putExtra("package", default_IME);
intent.setPackage("com.android.settings");
mContext.sendBroadcast(intent);
} else {
Log.e(TAG, "setDefaultApp: default_IME is empty");
}
}
private String getInputMethodId(String pkg) {
InputMethodManager imeManager = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
List<InputMethodInfo> InputMethods = imeManager.getInputMethodList();
Map<String, String> inputMap = new HashMap<>();
for (InputMethodInfo inputMethodInfo : InputMethods) {
inputMap.put(inputMethodInfo.getPackageName(), inputMethodInfo.getId());
}
String id = inputMap.get(pkg);
Log.e(TAG, "getInputMethodId: " + id);
return id;
}
private void setDefaultDesktop(String defaultApp) {
// int aihuaUnlock = Settings.System.getInt(mContext.getContentResolver(), CommonConfig.AIHUA_UNLOCK, 0);
// if (aihuaUnlock == 1) {

View File

@@ -52,8 +52,6 @@ public class UrlAddress {
public static final String SEND_DOWNLOAD_TIMES = "count/index";
/*上传安装的应用信息*/
public static final String UPLOAD_APPINFO = "log/index";
/*通过sn获取信息*/
@@ -111,7 +109,7 @@ public class UrlAddress {
/*开机动画*/
public static final String GET_LOGO_IMG = "Sn/getLogoImg";
// /*获取默认桌面升级*/
/*获取默认桌面升级*/
public static final String GET_DESKTOP = "Sn/getSnDesktop";
/*获取系统默认程序*/
public static final String GET_DEFAULT_APP = "app/getDefaultApp";

View File

@@ -1310,7 +1310,11 @@ public class JGYUtils {
//删除用户除了在应用市场的其他应用
public void deleteOtherApp() {
Log.e(TAG, "deleteOtherApp: " + Build.MODEL);
if ("K106".equals(Build.MODEL)) {
if ("K106".equalsIgnoreCase(Build.MODEL)
||"G10".equalsIgnoreCase(Build.MODEL)
||"G10P".equalsIgnoreCase(Build.MODEL)
||"G10R".equalsIgnoreCase(Build.MODEL)
) {
return;
}
int locked = Settings.System.getInt(crv, JGYActions.ACTION_QCH_UNLOCK_IPAD, 0);
@@ -2040,17 +2044,17 @@ public class JGYUtils {
* @param pkg
*/
public void setDefaultDesktop(String pkg) {
// Log.e(TAG, "setDefaultDesktop: " + pkg);
// if (TextUtils.isEmpty(pkg)) {
// openLauncher3();
// } else {
// String className = getStartClassName(pkg);
// if (TextUtils.isEmpty(className)) {
// openLauncher3();
// } else {
// setDefaultDesktop(pkg, className);
// }
// }
Log.e(TAG, "setDefaultDesktop: " + pkg);
if (TextUtils.isEmpty(pkg)) {
openLauncher3();
} else {
String className = getStartClassName(pkg);
if (TextUtils.isEmpty(className)) {
openLauncher3();
} else {
setDefaultDesktop(pkg, className);
}
}
}
public void setJxwLauncher(String pkg) {