Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #261 from JulioV/mask_touch
Browse files Browse the repository at this point in the history
- Feature: add touch event text masking
  • Loading branch information
denzilferreira authored Mar 11, 2019
2 parents 1f7c35b + 2a2d793 commit 3eb90fe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
10 changes: 8 additions & 2 deletions aware-core/src/main/java/com/aware/Applications.java
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,10 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
touch.put(Screen_Provider.Screen_Touch.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID));
touch.put(Screen_Provider.Screen_Touch.TOUCH_APP, event.getPackageName().toString());
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION, Screen.ACTION_AWARE_TOUCH_CLICKED);
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, event.getText().toString());
if (Aware.getSetting(getApplicationContext(), Aware_Preferences.MASK_TOUCH_TEXT).equals("true"))
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, Converters.maskString(event.getText().toString()));
else
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, event.getText().toString());
touch.put(Screen_Provider.Screen_Touch.TOUCH_INDEX_ITEMS, event.getItemCount());
touch.put(Screen_Provider.Screen_Touch.TOUCH_FROM_INDEX, event.getFromIndex());
touch.put(Screen_Provider.Screen_Touch.TOUCH_TO_INDEX, event.getToIndex());
Expand All @@ -363,7 +366,10 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
touch.put(Screen_Provider.Screen_Touch.DEVICE_ID, Aware.getSetting(getApplicationContext(), Aware_Preferences.DEVICE_ID));
touch.put(Screen_Provider.Screen_Touch.TOUCH_APP, event.getPackageName().toString());
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION, Screen.ACTION_AWARE_TOUCH_LONG_CLICKED);
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, event.getText().toString());
if (Aware.getSetting(getApplicationContext(), Aware_Preferences.MASK_TOUCH_TEXT).equals("true"))
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, Converters.maskString(event.getText().toString()));
else
touch.put(Screen_Provider.Screen_Touch.TOUCH_ACTION_TEXT, event.getText().toString());
touch.put(Screen_Provider.Screen_Touch.TOUCH_INDEX_ITEMS, event.getItemCount());
touch.put(Screen_Provider.Screen_Touch.TOUCH_FROM_INDEX, event.getFromIndex());
touch.put(Screen_Provider.Screen_Touch.TOUCH_TO_INDEX, event.getToIndex());
Expand Down
5 changes: 5 additions & 0 deletions aware-core/src/main/java/com/aware/Aware_Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -645,4 +645,9 @@ public class Aware_Preferences {
* Log touch and gesture events
*/
public static final String STATUS_TOUCH = "status_touch";

/**
* Masks text produced by touch events
*/
public static final String MASK_TOUCH_TEXT = "mask_touch_text";
}
2 changes: 1 addition & 1 deletion aware-core/src/main/java/com/aware/utils/Converters.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static boolean isNumeric(String str) {
}

/**
* Anonymises a string by substituting all alphanumeric characters with a random one.
* Anonymises a string by substituting all alphanumeric characters with A, a, or 1.
*
* @param originalInput
* @return string
Expand Down
8 changes: 8 additions & 0 deletions aware-core/src/main/res/xml/aware_preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,14 @@
android:summary="Capture clicks, long clicks and scroll up/down events"
android:title="Screen interaction" />

<CheckBoxPreference
android:defaultValue="false"
android:dependency="status_touch"
android:key="mask_touch_text"
android:persistent="true"
android:summary="Swaps all alphanumeric characters by A, a, and 1"
android:title="Mask text in touch events" />

</PreferenceScreen>
<PreferenceScreen
android:icon="@drawable/ic_action_significant_motion"
Expand Down

0 comments on commit 3eb90fe

Please sign in to comment.