We have an application that is running on an HP Slate 21 Pro with Android 4.3, the tablet and application function in the context of a kiosk where users can walk-up to it to perform a task.
The application is quite small and has two screens:
The first screen allows the entry of a employee number, this input is taken using an attached RFID USB reader which reads a card. The RFID readers acts using keyboard emulation to populate a hidden field and "submit" the number using an Async task to a back end API.
Once the user scans their card they are effectivley "signed in" and a second activity loads, looks up data relevant to the user using an Async task, and displays the data user. At which point the user can select items on the screen.
The issue we are having is after loading this activity with a user's data the application does not respond to any touch events, all buttons are not clickable nor respond. In addition the tablet's Home, Back, and Recent Items button do not function either. All buttons are not changing state when pressed as well.
It would appear the screen is locked and not taking user input. The challenge is that this does not happen all the time, nor have we been able to reproduce the issue anywhere but in the field (production).
The initial thought was something was blocking the Main thread, however on the screen that is loaded after the user "logs in" there is a screen timeout initiated using a Handler to post a delayed timeout call where if the user does not interact with the screen they are taken back to the main screen, effectively acting as "logging" the user out for inactivity. This handler is firing and returning the user to the main activity.
Once back to the main screen the tablet does still not respond to touch events, however the user can scan their card repeating the process to "log in" and are taken to the same screen at which point the same behavior exists where the screen does not respond to touch events.
Here is the base activity that the screen timeout is implemented in:
public abstract class BaseActivity extends Activity {
@Override
public void onResume() {
super.onResume();
resetDisconnectTimer();
}
@Override
public void onStop() {
super.onStop();
stopDisconnectTimer();
}
@Override
public void onUserInteraction(){
resetDisconnectTimer();
}
public void quit(View view) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
if (imm != null) {
imm.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
Intent intent = new Intent(this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
public void resetDisconnectTimer(){
disconnectHandler.removeCallbacks(disconnectCallback);
disconnectHandler.postDelayed(disconnectCallback, 10000);
}
public void stopDisconnectTimer(){
disconnectHandler.removeCallbacks(disconnectCallback);
}
private Handler disconnectHandler = new Handler(){
public void handleMessage(Message msg) {
}
};
private Runnable disconnectCallback = new Runnable() {
@Override
public void run() {
quit(getWindow().getDecorView());
}
};
}
I have done some testing where I intentionally block the Main thread and the timeout will not fire until the thread is unblocked which leads me to believe the thread is not being blocked.
Eventually after a shore period of time (around 10 to 30 seconds) the application starts responding to touch events again.
EDIT 2014-09-30
I am starting to suspect something besides the software causing an issue as this device has a hardware settings button that will open the settings application.
When the application freezes this hardware button opens the settings screen. However the settings application experiences the same behavior as the original application as it does not respond to touch events.
EDIT 2014-10-02
I have confirmed that other input devices when the touch screen does not. I was able to attach a mouse when this situation occurs. I used the mouse to navigate to the home screen and then to the settings screen. During this time the touch screen did not respond however the device was responding to the mouse clicks. This is leading me to believe there is a hardware issue with the touch screen.