|
|
@@ -144,6 +144,7 @@ public class ModifierService extends android.accessibilityservice.AccessibilityS
|
|
|
} catch (JSONException e) {
|
|
|
}
|
|
|
mSocket.emit("callback", res);
|
|
|
+ updateDevice("busy", false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -184,7 +185,7 @@ public class ModifierService extends android.accessibilityservice.AccessibilityS
|
|
|
Log.i(TAG, "RCS not detected");
|
|
|
}
|
|
|
return false;
|
|
|
- }, 1, java.util.concurrent.TimeUnit.SECONDS);
|
|
|
+ }, 2, java.util.concurrent.TimeUnit.SECONDS);
|
|
|
synchronized (f) {
|
|
|
Log.i(TAG, "Waiting for task to complete...");
|
|
|
return f.get();
|
|
|
@@ -205,12 +206,16 @@ public class ModifierService extends android.accessibilityservice.AccessibilityS
|
|
|
String text = Optional.ofNullable(node.getText()).map(CharSequence::toString).orElse(null);
|
|
|
String id = node.getViewIdResourceName();
|
|
|
|
|
|
-// Log.i(TAG, "Node: class=" + className + ", text=" + text + ", name=" + name + ", id=" + id);
|
|
|
+ Log.i(TAG, "Node: class=" + className + ", text=" + text + ", name=" + name + ", id=" + id);
|
|
|
|
|
|
if ("Compose:Draft:Send".equals(name)) {
|
|
|
result.setSendBtn(node);
|
|
|
}
|
|
|
|
|
|
+ if ("com.google.android.apps.messaging:id/send_message_button_icon".equals(id)) {
|
|
|
+ result.setSendBtn(node);
|
|
|
+ }
|
|
|
+
|
|
|
if (text != null && (text.contains("RCS 聊天") || text.contains("RCS chat"))) {
|
|
|
result.setRcsCapable(true);
|
|
|
}
|
|
|
@@ -229,6 +234,7 @@ public class ModifierService extends android.accessibilityservice.AccessibilityS
|
|
|
instance = this;
|
|
|
|
|
|
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
|
|
|
+ info.flags = AccessibilityServiceInfo.DEFAULT | AccessibilityServiceInfo.FLAG_REPORT_VIEW_IDS;
|
|
|
info.eventTypes = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
|
|
|
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
|
|
|
info.notificationTimeout = 100;
|
|
|
@@ -264,16 +270,20 @@ public class ModifierService extends android.accessibilityservice.AccessibilityS
|
|
|
getSharedPreferences(BuildConfig.APPLICATION_ID, MODE_PRIVATE).edit().putBoolean("canSend", isChecked).apply();
|
|
|
canSend = isChecked;
|
|
|
|
|
|
- JSONObject data = new JSONObject();
|
|
|
- try {
|
|
|
- data.put("action", "updateDevice");
|
|
|
- JSONObject dataObj = new JSONObject();
|
|
|
- dataObj.put("canSend", canSend);
|
|
|
- data.put("data", dataObj);
|
|
|
- } catch (JSONException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- mSocket.emit("message", data);
|
|
|
+ updateDevice("canSend", canSend);
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ private void updateDevice(String key, Object value) {
|
|
|
+ JSONObject data = new JSONObject();
|
|
|
+ try {
|
|
|
+ data.put("action", "updateDevice");
|
|
|
+ JSONObject dataObj = new JSONObject();
|
|
|
+ dataObj.put(key, value);
|
|
|
+ data.put("data", dataObj);
|
|
|
+ mSocket.emit("message", data);
|
|
|
+ } catch (JSONException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|