Bug 747273 - Remove emitGeckoAccessibilityEvent, just emit one directly.

This commit is contained in:
Eitan Isaacson 2012-04-27 10:35:47 -07:00
parent 2d39356968
commit e81ce5777f
3 changed files with 21 additions and 38 deletions

View File

@ -1826,9 +1826,6 @@ public class GeckoAppShell
return false;
}
public static void emitGeckoAccessibilityEvent (int eventType, String[] textList, String description, boolean enabled, boolean checked, boolean password) {
}
public static double[] getCurrentNetworkInformation() {
return GeckoNetworkManager.getInstance().getCurrentInformation();
}

View File

@ -82,6 +82,8 @@ import android.graphics.drawable.BitmapDrawable;
import android.widget.*;
import android.hardware.*;
import android.location.*;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityEvent;
import android.util.*;
import android.net.*;
@ -1017,22 +1019,30 @@ abstract public class GeckoApp
}
});
} else if (event.equals("Accessibility:Event")) {
final int eventType = message.getInt("eventType");
final AccessibilityEvent accEvent = AccessibilityEvent.obtain(message.getInt("eventType"));
accEvent.setClassName(LayerView.class.getName());
accEvent.setPackageName(mAppContext.getPackageName());
final JSONArray text = message.getJSONArray("text");
final int len = text.length();
final String[] textList = new String[len];
for (int i = 0; i < len; i++)
textList[i] = text.getString(i);
for (int i = 0; i < text.length(); i++)
accEvent.getText().add(text.getString(i));
accEvent.setContentDescription(message.optString("description"));
accEvent.setEnabled(message.optBoolean("enabled", true));
accEvent.setChecked(message.optBoolean("checked"));
accEvent.setPassword(message.optBoolean("password"));
accEvent.setAddedCount(message.optInt("addedCount"));
accEvent.setRemovedCount(message.optInt("removedCount"));
accEvent.setFromIndex(message.optInt("fromIndex"));
accEvent.setItemCount(message.optInt("itemCount"));
accEvent.setCurrentItemIndex(message.optInt("currentItemIndex"));
accEvent.setBeforeText(message.optString("beforeText"));
final String description = message.optString("description");
final boolean enabled = message.optBoolean("enabled", true);
final boolean checked = message.optBoolean("checked");
final boolean password = message.optBoolean("password");
mMainHandler.post(new Runnable() {
public void run() {
GeckoAppShell.emitGeckoAccessibilityEvent(eventType, textList, description,
enabled, checked, password);
AccessibilityManager accessibilityManager =
(AccessibilityManager) mAppContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
accessibilityManager.sendAccessibilityEvent(accEvent);
}
});
}

View File

@ -72,7 +72,6 @@ import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.provider.Settings;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityEvent;
import android.opengl.GLES20;
import android.util.*;
@ -1964,29 +1963,6 @@ public class GeckoAppShell
return false;
}
public static void emitGeckoAccessibilityEvent (int eventType, String[] textList, String description, boolean enabled, boolean checked, boolean password) {
AccessibilityManager accessibilityManager =
(AccessibilityManager) GeckoApp.mAppContext.getSystemService(Context.ACCESSIBILITY_SERVICE);
if (!accessibilityManager.isEnabled())
return;
LayerController layerController = GeckoApp.mAppContext.getLayerController();
LayerView layerView = layerController.getView();
AccessibilityEvent event = AccessibilityEvent.obtain(eventType);
event.setClassName(layerView.getClass().getName());
event.setPackageName(GeckoApp.mAppContext.getPackageName());
event.setEnabled(enabled);
event.setChecked(checked);
event.setPassword(password);
event.setContentDescription(description);
for (String text: textList)
event.getText().add(text);
accessibilityManager.sendAccessibilityEvent(event);
}
public static void viewSizeChanged() {
if (mInputConnection != null && mInputConnection.isIMEEnabled()) {
sendEventToGecko(GeckoEvent.createBroadcastEvent("ScrollTo:FocusedInput", ""));