Merge remote-tracking branch 'GitLab/master'
This commit is contained in:
@@ -458,8 +458,14 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
private static final String JIGUANG_ADMIN_APP = "63";
|
||||
/*投屏开关*/
|
||||
private static final String SCRENN_SHARED = "74";
|
||||
/**/
|
||||
/*移动热点开关*/
|
||||
private static final String HOT_SPOT = "75";
|
||||
/*桌面默认应用*/
|
||||
private static final String ACTION_DEFAULT_DESKTOP = "76";
|
||||
/*浏览器默认应用*/
|
||||
private static final String ACTION_DEFAULT_BRPWSER = "77";
|
||||
/*输入法默认应用*/
|
||||
private static final String ACTION_DEFAULT_INPUT_METHOD = "78";
|
||||
|
||||
private void processCustomMessage(Context context, XGPushTextMessage message) {
|
||||
if (context == null || message == null) {
|
||||
@@ -734,6 +740,15 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
case HOT_SPOT:
|
||||
ToastUtil.debugShow("收到推送消息: 热点开关");
|
||||
break;
|
||||
case ACTION_DEFAULT_DESKTOP:
|
||||
|
||||
break;
|
||||
case ACTION_DEFAULT_BRPWSER:
|
||||
|
||||
break;
|
||||
case ACTION_DEFAULT_INPUT_METHOD:
|
||||
setDefaultInputMethod(context, extras);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -1414,4 +1429,10 @@ public class MessageReceiver extends XGPushBaseReceiver {
|
||||
String packages = jsonObject.get("package").getAsString();
|
||||
String app_url = jsonObject.get("app_url").getAsString();
|
||||
}
|
||||
|
||||
private void setDefaultInputMethod(Context context, String extras) {
|
||||
JsonObject jsonObject = GsonUtils.getJsonObject(extras);
|
||||
String packeges = jsonObject.get("package").getAsString();
|
||||
JGYUtils.getInstance().setDefaultInputMethod(packeges);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.inputmethod.InputMethodInfo;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
@@ -48,6 +50,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE;
|
||||
@@ -946,6 +949,43 @@ public class JGYUtils {
|
||||
mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, currentVolume, 0);
|
||||
}
|
||||
|
||||
public void setDefaultLauncher(String pkg) {
|
||||
Intent intent = new Intent("setDefaultLauncher");
|
||||
intent.putExtra("package", "com.uiui.os");
|
||||
intent.putExtra("className", "com.uiui.os.Launcher");
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
public void getLauncherClassName(String pkg) {
|
||||
|
||||
}
|
||||
|
||||
public 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;
|
||||
}
|
||||
|
||||
public void setDefaultInputMethod(String pkg) {
|
||||
String id = getInputMethodId(pkg);
|
||||
if (TextUtils.isEmpty(id)) {
|
||||
Log.e(TAG, "setDefaultInputMethod: id is empty");
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent("setDefaultInputMethod");
|
||||
intent.putExtra("package", id);
|
||||
intent.setPackage("com.android.settings");
|
||||
mContext.sendBroadcast(intent);
|
||||
}
|
||||
|
||||
|
||||
/*AI健康*/
|
||||
public static final String AIHealth = "com.uiui.health";
|
||||
/*老人桌面*/
|
||||
|
||||
Reference in New Issue
Block a user